2017-02-16 08:04:05 +08:00
|
|
|
# RUN: llc -mtriple x86_64-- -verify-machineinstrs -run-pass branch-folder -o - %s | FileCheck %s
|
|
|
|
|
|
|
|
# Check the TCRETURNdi64cc optimization.
|
|
|
|
|
|
|
|
--- |
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
define i64 @test(i64 %arg, i8* %arg1) optsize {
|
|
|
|
%tmp = icmp ult i64 %arg, 100
|
|
|
|
br i1 %tmp, label %1, label %4
|
|
|
|
|
|
|
|
%tmp3 = icmp ult i64 %arg, 10
|
|
|
|
br i1 %tmp3, label %2, label %3
|
|
|
|
|
|
|
|
%tmp5 = tail call i64 @f1(i8* %arg1, i64 %arg)
|
|
|
|
ret i64 %tmp5
|
|
|
|
|
|
|
|
%tmp7 = tail call i64 @f2(i8* %arg1, i64 %arg)
|
|
|
|
ret i64 %tmp7
|
|
|
|
|
|
|
|
ret i64 123
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i64 @f1(i8*, i64)
|
|
|
|
declare i64 @f2(i8*, i64)
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: test
|
|
|
|
tracksRegLiveness: true
|
|
|
|
liveins:
|
2018-02-01 06:04:26 +08:00
|
|
|
- { reg: '$rdi' }
|
|
|
|
- { reg: '$rsi' }
|
2017-02-16 08:04:05 +08:00
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
successors: %bb.1, %bb.4
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $rdi, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
$rax = COPY $rdi
|
|
|
|
CMP64ri8 $rax, 99, implicit-def $eflags
|
|
|
|
JA_1 %bb.4, implicit $eflags
|
2017-02-16 08:04:05 +08:00
|
|
|
JMP_1 %bb.1
|
|
|
|
|
|
|
|
; CHECK: bb.1:
|
|
|
|
; CHECK-NEXT: successors: %bb.2({{[^)]+}}){{$}}
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: liveins: $rax, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
; CHECK-NEXT: {{^ $}}
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: $rdi = COPY $rsi
|
|
|
|
; CHECK-NEXT: $rsi = COPY $rax
|
|
|
|
; CHECK-NEXT: CMP64ri8 $rax, 9, implicit-def $eflags
|
[X86] Merge the different CMOV instructions for each condition code into single instructions that store the condition code as an immediate.
Summary:
Reorder the condition code enum to match their encodings. Move it to MC layer so it can be used by the scheduler models.
This avoids needing an isel pattern for each condition code. And it removes
translation switches for converting between CMOV instructions and condition
codes.
Now the printer, encoder and disassembler take care of converting the immediate.
We use InstAliases to handle the assembly matching. But we print using the
asm string in the instruction definition. The instruction itself is marked
IsCodeGenOnly=1 to hide it from the assembly parser.
This does complicate the scheduler models a little since we can't assign the
A and BE instructions to a separate class now.
I plan to make similar changes for SETcc and Jcc.
Reviewers: RKSimon, spatel, lebedev.ri, andreadb, courbet
Reviewed By: RKSimon
Subscribers: gchatelet, hiraditya, kristina, lebedev.ri, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60041
llvm-svn: 357800
2019-04-06 03:27:41 +08:00
|
|
|
; CHECK-NEXT: TCRETURNdi64cc @f1, 0, 6, csr_64, implicit $rsp, implicit $eflags, implicit $ssp, implicit $rsp, implicit $rdi, implicit $rsi, implicit $rdi, implicit-def $rdi, implicit $hsi, implicit-def $hsi, implicit $sih, implicit-def $sih, implicit $sil, implicit-def $sil, implicit $si, implicit-def $si, implicit $esi, implicit-def $esi, implicit $rsi, implicit-def $rsi, implicit $hdi, implicit-def $hdi, implicit $dih, implicit-def $dih, implicit $dil, implicit-def $dil, implicit $di, implicit-def $di, implicit $edi, implicit-def $edi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
|
|
|
bb.1:
|
|
|
|
successors: %bb.2, %bb.3
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $rax, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
CMP64ri8 $rax, 9, implicit-def $eflags
|
|
|
|
JA_1 %bb.3, implicit $eflags
|
2017-02-16 08:04:05 +08:00
|
|
|
JMP_1 %bb.2
|
|
|
|
|
|
|
|
bb.2:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $rax, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
$rdi = COPY $rsi
|
|
|
|
$rsi = COPY $rax
|
2017-02-16 08:04:05 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
TCRETURNdi64 @f1, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
|
|
|
; CHECK: bb.2:
|
2018-06-07 15:20:33 +08:00
|
|
|
; CHECK-NEXT: liveins: $rdi, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
; CHECK-NEXT: {{^ $}}
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK-NEXT: TCRETURNdi64 @f2, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
|
|
|
bb.3:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $rax, $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
2018-02-01 06:04:26 +08:00
|
|
|
$rdi = COPY $rsi
|
|
|
|
$rsi = COPY $rax
|
|
|
|
TCRETURNdi64 @f2, 0, csr_64, implicit $rsp, implicit $rdi, implicit $rsi
|
2017-02-16 08:04:05 +08:00
|
|
|
|
|
|
|
bb.4:
|
2018-08-11 13:33:00 +08:00
|
|
|
dead $eax = MOV32ri 123, implicit-def $rax
|
2018-02-01 06:04:26 +08:00
|
|
|
RET 0, $rax
|
2017-02-16 08:04:05 +08:00
|
|
|
|
|
|
|
...
|