Skip to content

Commit 2b21c68

Browse files
committed
[X86][test] Simplify tests for flag copy lowering, NFCI
1 parent 5c7c1f6 commit 2b21c68

File tree

2 files changed

+19
-246
lines changed

2 files changed

+19
-246
lines changed

llvm/test/CodeGen/X86/apx/flags-copy-lowering.mir

Lines changed: 6 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,10 @@
11
# RUN: llc -run-pass x86-flags-copy-lowering -mattr=+ndd -verify-machineinstrs -o - %s | FileCheck %s
22
# Lower various interesting copy patterns of EFLAGS without using LAHF/SAHF.
33

4-
--- |
5-
target triple = "x86_64-unknown-unknown"
6-
7-
declare void @foo()
8-
9-
define void @test_adc(i64 %a, i64 %b) {
10-
entry:
11-
call void @foo()
12-
ret void
13-
}
14-
15-
define void @test_sbb(i64 %a, i64 %b) {
16-
entry:
17-
call void @foo()
18-
ret void
19-
}
20-
21-
define void @test_rcl(i64 %a, i64 %b) {
22-
entry:
23-
call void @foo()
24-
ret void
25-
}
26-
27-
define void @test_rcr(i64 %a, i64 %b) {
28-
entry:
29-
call void @foo()
30-
ret void
31-
}
32-
33-
define void @test_cmov(i64 %a, i64 %b) {
34-
entry:
35-
call void @foo()
36-
ret void
37-
}
38-
39-
define void @test_cfcmov(i64 %a, i64 %b) {
40-
entry:
41-
call void @foo()
42-
ret void
43-
}
444
...
455
---
466
name: test_adc
477
# CHECK-LABEL: name: test_adc
48-
liveins:
49-
- { reg: '$rdi', virtual-reg: '%0' }
50-
- { reg: '$rsi', virtual-reg: '%1' }
518
body: |
529
bb.0:
5310
liveins: $rdi, $rsi
@@ -60,9 +17,7 @@ body: |
6017
; CHECK: %[[CF_REG:[^:]*]]:gr8 = SETCCr 2, implicit $eflags
6118
; CHECK-NOT: COPY{{( killed)?}} $eflags
6219
63-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
64-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
65-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
20+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
6621
6722
$eflags = COPY %3
6823
%4:gr64 = ADC64ri32_ND %2:gr64, 42, implicit-def $eflags, implicit $eflags
@@ -79,9 +34,6 @@ body: |
7934
---
8035
name: test_sbb
8136
# CHECK-LABEL: name: test_sbb
82-
liveins:
83-
- { reg: '$rdi', virtual-reg: '%0' }
84-
- { reg: '$rsi', virtual-reg: '%1' }
8537
body: |
8638
bb.0:
8739
liveins: $rdi, $rsi
@@ -94,9 +46,7 @@ body: |
9446
; CHECK: %[[CF_REG:[^:]*]]:gr8 = SETCCr 2, implicit $eflags
9547
; CHECK-NOT: COPY{{( killed)?}} $eflags
9648
97-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
98-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
99-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
49+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
10050
10151
$eflags = COPY %3
10252
%4:gr64 = SBB64ri32_ND %2:gr64, 42, implicit-def $eflags, implicit killed $eflags
@@ -113,9 +63,6 @@ body: |
11363
---
11464
name: test_rcl
11565
# CHECK-LABEL: name: test_rcl
116-
liveins:
117-
- { reg: '$rdi', virtual-reg: '%0' }
118-
- { reg: '$rsi', virtual-reg: '%1' }
11966
body: |
12067
bb.0:
12168
liveins: $rdi, $rsi
@@ -128,9 +75,7 @@ body: |
12875
; CHECK: %[[CF_REG:[^:]*]]:gr8 = SETCCr 2, implicit $eflags
12976
; CHECK-NOT: COPY{{( killed)?}} $eflags
13077
131-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
132-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
133-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
78+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
13479
13580
$eflags = COPY %3
13681
%4:gr64 = RCL64r1_ND %2:gr64, implicit-def $eflags, implicit $eflags
@@ -147,9 +92,6 @@ body: |
14792
---
14893
name: test_rcr
14994
# CHECK-LABEL: name: test_rcr
150-
liveins:
151-
- { reg: '$rdi', virtual-reg: '%0' }
152-
- { reg: '$rsi', virtual-reg: '%1' }
15395
body: |
15496
bb.0:
15597
liveins: $rdi, $rsi
@@ -162,9 +104,7 @@ body: |
162104
; CHECK: %[[CF_REG:[^:]*]]:gr8 = SETCCr 2, implicit $eflags
163105
; CHECK-NOT: COPY{{( killed)?}} $eflags
164106
165-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
166-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
167-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
107+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
168108
169109
$eflags = COPY %3
170110
%4:gr64 = RCR64r1_ND %2:gr64, implicit-def $eflags, implicit $eflags
@@ -181,9 +121,6 @@ body: |
181121
---
182122
name: test_cmov
183123
# CHECK-LABEL: name: test_cmov
184-
liveins:
185-
- { reg: '$rdi', virtual-reg: '%0' }
186-
- { reg: '$rsi', virtual-reg: '%1' }
187124
body: |
188125
bb.0:
189126
liveins: $rdi, $rsi
@@ -198,9 +135,7 @@ body: |
198135
; CHECK-NEXT: %[[E_REG:[^:]*]]:gr8 = SETCCr 4, implicit $eflags
199136
; CHECK-NOT: COPY{{( killed)?}} $eflags
200137
201-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
202-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
203-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
138+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
204139
205140
$eflags = COPY %2
206141
%3:gr64 = CMOV64rr_ND %0, %1, 7, implicit $eflags
@@ -226,9 +161,6 @@ body: |
226161
---
227162
name: test_cfcmov
228163
# CHECK-LABEL: name: test_cfcmov
229-
liveins:
230-
- { reg: '$rdi', virtual-reg: '%0' }
231-
- { reg: '$rsi', virtual-reg: '%1' }
232164
body: |
233165
bb.0:
234166
liveins: $rdi, $rsi
@@ -243,9 +175,7 @@ body: |
243175
; CHECK-NEXT: %[[E_REG:[^:]*]]:gr8 = SETCCr 4, implicit $eflags
244176
; CHECK-NOT: COPY{{( killed)?}} $eflags
245177
246-
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
247-
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
248-
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
178+
INLINEASM &nop, 1, 12, implicit-def dead $eflags
249179
250180
$eflags = COPY %2
251181
%3:gr64 = CFCMOV64rr %1, 7, implicit $eflags

0 commit comments

Comments
 (0)