Skip to content

Commit a84b781

Browse files
committed
[AArch64] Regenerate some more tests
This updates the check lines in some extra tests, to make them more maintainable going forward.
1 parent 0776924 commit a84b781

File tree

7 files changed

+242
-136
lines changed

7 files changed

+242
-136
lines changed

llvm/test/CodeGen/AArch64/cond-sel-value-prop.ll

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,54 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
23

34
; Transform "a == C ? C : x" to "a == C ? a : x" to avoid materializing C.
4-
; CHECK-LABEL: test1:
5-
; CHECK: cmp w[[REG1:[0-9]+]], #2
6-
; CHECK: mov w[[REG2:[0-9]+]], #7
7-
; CHECK: csel w0, w[[REG1]], w[[REG2]], eq
85
define i32 @test1(i32 %x) {
6+
; CHECK-LABEL: test1:
7+
; CHECK: // %bb.0:
8+
; CHECK-NEXT: cmp w0, #2
9+
; CHECK-NEXT: mov w8, #7
10+
; CHECK-NEXT: csel w0, w0, w8, eq
11+
; CHECK-NEXT: ret
912
%cmp = icmp eq i32 %x, 2
1013
%res = select i1 %cmp, i32 2, i32 7
1114
ret i32 %res
1215
}
1316

1417
; Transform "a == C ? C : x" to "a == C ? a : x" to avoid materializing C.
15-
; CHECK-LABEL: test2:
16-
; CHECK: cmp x[[REG1:[0-9]+]], #2
17-
; CHECK: mov w[[REG2:[0-9]+]], #7
18-
; CHECK: csel x0, x[[REG1]], x[[REG2]], eq
1918
define i64 @test2(i64 %x) {
19+
; CHECK-LABEL: test2:
20+
; CHECK: // %bb.0:
21+
; CHECK-NEXT: cmp x0, #2
22+
; CHECK-NEXT: mov w8, #7
23+
; CHECK-NEXT: csel x0, x0, x8, eq
24+
; CHECK-NEXT: ret
2025
%cmp = icmp eq i64 %x, 2
2126
%res = select i1 %cmp, i64 2, i64 7
2227
ret i64 %res
2328
}
2429

2530
; Transform "a != C ? x : C" to "a != C ? x : a" to avoid materializing C.
26-
; CHECK-LABEL: test3:
27-
; CHECK: cmp x[[REG1:[0-9]+]], #7
28-
; CHECK: mov w[[REG2:[0-9]+]], #2
29-
; CHECK: csel x0, x[[REG2]], x[[REG1]], ne
3031
define i64 @test3(i64 %x) {
32+
; CHECK-LABEL: test3:
33+
; CHECK: // %bb.0:
34+
; CHECK-NEXT: cmp x0, #7
35+
; CHECK-NEXT: mov w8, #2
36+
; CHECK-NEXT: csel x0, x8, x0, ne
37+
; CHECK-NEXT: ret
3138
%cmp = icmp ne i64 %x, 7
3239
%res = select i1 %cmp, i64 2, i64 7
3340
ret i64 %res
3441
}
3542

3643
; Don't transform "a == C ? C : x" to "a == C ? a : x" if a == 0. If we did we
3744
; would needlessly extend the live range of x0 when we can just use xzr.
38-
; CHECK-LABEL: test4:
39-
; CHECK: cmp x0, #0
40-
; CHECK: mov w8, #7
41-
; CHECK: csel x0, xzr, x8, eq
4245
define i64 @test4(i64 %x) {
46+
; CHECK-LABEL: test4:
47+
; CHECK: // %bb.0:
48+
; CHECK-NEXT: cmp x0, #0
49+
; CHECK-NEXT: mov w8, #7
50+
; CHECK-NEXT: csel x0, xzr, x8, eq
51+
; CHECK-NEXT: ret
4352
%cmp = icmp eq i64 %x, 0
4453
%res = select i1 %cmp, i64 0, i64 7
4554
ret i64 %res
@@ -48,11 +57,13 @@ define i64 @test4(i64 %x) {
4857
; Don't transform "a == C ? C : x" to "a == C ? a : x" if a == 1. If we did we
4958
; would needlessly extend the live range of x0 when we can just use xzr with
5059
; CSINC to materialize the 1.
51-
; CHECK-LABEL: test5:
52-
; CHECK: cmp x0, #1
53-
; CHECK: mov w[[REG:[0-9]+]], #7
54-
; CHECK: csinc x0, x[[REG]], xzr, ne
5560
define i64 @test5(i64 %x) {
61+
; CHECK-LABEL: test5:
62+
; CHECK: // %bb.0:
63+
; CHECK-NEXT: cmp x0, #1
64+
; CHECK-NEXT: mov w8, #7
65+
; CHECK-NEXT: csinc x0, x8, xzr, ne
66+
; CHECK-NEXT: ret
5667
%cmp = icmp eq i64 %x, 1
5768
%res = select i1 %cmp, i64 1, i64 7
5869
ret i64 %res
@@ -61,49 +72,59 @@ define i64 @test5(i64 %x) {
6172
; Don't transform "a == C ? C : x" to "a == C ? a : x" if a == -1. If we did we
6273
; would needlessly extend the live range of x0 when we can just use xzr with
6374
; CSINV to materialize the -1.
64-
; CHECK-LABEL: test6:
65-
; CHECK: cmn x0, #1
66-
; CHECK: mov w[[REG:[0-9]+]], #7
67-
; CHECK: csinv x0, x[[REG]], xzr, ne
6875
define i64 @test6(i64 %x) {
76+
; CHECK-LABEL: test6:
77+
; CHECK: // %bb.0:
78+
; CHECK-NEXT: cmn x0, #1
79+
; CHECK-NEXT: mov w8, #7
80+
; CHECK-NEXT: csinv x0, x8, xzr, ne
81+
; CHECK-NEXT: ret
6982
%cmp = icmp eq i64 %x, -1
7083
%res = select i1 %cmp, i64 -1, i64 7
7184
ret i64 %res
7285
}
7386

74-
; CHECK-LABEL: test7:
75-
; CHECK: cmp x[[REG:[0-9]]], #7
76-
; CHECK: csinc x0, x[[REG]], xzr, eq
7787
define i64 @test7(i64 %x) {
88+
; CHECK-LABEL: test7:
89+
; CHECK: // %bb.0:
90+
; CHECK-NEXT: cmp x0, #7
91+
; CHECK-NEXT: csinc x0, x0, xzr, eq
92+
; CHECK-NEXT: ret
7893
%cmp = icmp eq i64 %x, 7
7994
%res = select i1 %cmp, i64 7, i64 1
8095
ret i64 %res
8196
}
8297

83-
; CHECK-LABEL: test8:
84-
; CHECK: cmp x[[REG:[0-9]]], #7
85-
; CHECK: csinc x0, x[[REG]], xzr, eq
8698
define i64 @test8(i64 %x) {
99+
; CHECK-LABEL: test8:
100+
; CHECK: // %bb.0:
101+
; CHECK-NEXT: cmp x0, #7
102+
; CHECK-NEXT: csinc x0, x0, xzr, eq
103+
; CHECK-NEXT: ret
87104
%cmp = icmp ne i64 %x, 7
88105
%res = select i1 %cmp, i64 1, i64 7
89106
ret i64 %res
90107
}
91108

92-
; CHECK-LABEL: test9:
93-
; CHECK: cmp x[[REG:[0-9]]], #7
94-
; CHECK: csinv x0, x[[REG]], xzr, eq
95109
define i64 @test9(i64 %x) {
110+
; CHECK-LABEL: test9:
111+
; CHECK: // %bb.0:
112+
; CHECK-NEXT: cmp x0, #7
113+
; CHECK-NEXT: csinv x0, x0, xzr, eq
114+
; CHECK-NEXT: ret
96115
%cmp = icmp eq i64 %x, 7
97116
%res = select i1 %cmp, i64 7, i64 -1
98117
ret i64 %res
99118
}
100119

101120
; Rather than use a CNEG, use a CSINV to transform "a == 1 ? 1 : -1" to
102121
; "a == 1 ? a : -1" to avoid materializing a constant.
103-
; CHECK-LABEL: test10:
104-
; CHECK: cmp w[[REG:[0-9]]], #1
105-
; CHECK: csinv w0, w[[REG]], wzr, eq
106122
define i32 @test10(i32 %x) {
123+
; CHECK-LABEL: test10:
124+
; CHECK: // %bb.0:
125+
; CHECK-NEXT: cmp w0, #1
126+
; CHECK-NEXT: csinv w0, w0, wzr, eq
127+
; CHECK-NEXT: ret
107128
%cmp = icmp eq i32 %x, 1
108129
%res = select i1 %cmp, i32 1, i32 -1
109130
ret i32 %res

llvm/test/CodeGen/AArch64/isinf.ll

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+neon,+fullfp16 < %s -o -| FileCheck %s
23

34
declare half @llvm.fabs.f16(half)
@@ -8,11 +9,13 @@ declare fp128 @llvm.fabs.f128(fp128)
89
; INFINITY requires loading the constant for _Float16
910
define i32 @replace_isinf_call_f16(half %x) {
1011
; CHECK-LABEL: replace_isinf_call_f16:
11-
; CHECK: adrp [[ADDR:x[0-9]+]], [[CSTLABEL:.LCP.*]]
12-
; CHECK: ldr [[INFINITY:h[0-9]+]], {{[[]}}[[ADDR]], :lo12:[[CSTLABEL]]{{[]]}}
13-
; CHECK-NEXT: fabs [[ABS:h[0-9]+]], h0
14-
; CHECK-NEXT: fcmp [[ABS]], [[INFINITY]]
15-
; CHECK-NEXT: cset w0, eq
12+
; CHECK: // %bb.0:
13+
; CHECK-NEXT: adrp x8, .LCPI0_0
14+
; CHECK-NEXT: ldr h1, [x8, :lo12:.LCPI0_0]
15+
; CHECK-NEXT: fabs h0, h0
16+
; CHECK-NEXT: fcmp h0, h1
17+
; CHECK-NEXT: cset w0, eq
18+
; CHECK-NEXT: ret
1619
%abs = tail call half @llvm.fabs.f16(half %x)
1720
%cmpinf = fcmp oeq half %abs, 0xH7C00
1821
%ret = zext i1 %cmpinf to i32
@@ -22,11 +25,13 @@ define i32 @replace_isinf_call_f16(half %x) {
2225
; Check if INFINITY for float is materialized
2326
define i32 @replace_isinf_call_f32(float %x) {
2427
; CHECK-LABEL: replace_isinf_call_f32:
25-
; CHECK: mov [[INFSCALARREG:w[0-9]+]], #2139095040
26-
; CHECK-NEXT: fabs [[ABS:s[0-9]+]], s0
27-
; CHECK-NEXT: fmov [[INFREG:s[0-9]+]], [[INFSCALARREG]]
28-
; CHECK-NEXT: fcmp [[ABS]], [[INFREG]]
29-
; CHECK-NEXT: cset w0, eq
28+
; CHECK: // %bb.0:
29+
; CHECK-NEXT: mov w8, #2139095040
30+
; CHECK-NEXT: fabs s0, s0
31+
; CHECK-NEXT: fmov s1, w8
32+
; CHECK-NEXT: fcmp s0, s1
33+
; CHECK-NEXT: cset w0, eq
34+
; CHECK-NEXT: ret
3035
%abs = tail call float @llvm.fabs.f32(float %x)
3136
%cmpinf = fcmp oeq float %abs, 0x7FF0000000000000
3237
%ret = zext i1 %cmpinf to i32
@@ -36,11 +41,13 @@ define i32 @replace_isinf_call_f32(float %x) {
3641
; Check if INFINITY for double is materialized
3742
define i32 @replace_isinf_call_f64(double %x) {
3843
; CHECK-LABEL: replace_isinf_call_f64:
39-
; CHECK: mov [[INFSCALARREG:x[0-9]+]], #9218868437227405312
40-
; CHECK-NEXT: fabs [[ABS:d[0-9]+]], d0
41-
; CHECK-NEXT: fmov [[INFREG:d[0-9]+]], [[INFSCALARREG]]
42-
; CHECK-NEXT: fcmp [[ABS]], [[INFREG]]
43-
; CHECK-NEXT: cset w0, eq
44+
; CHECK: // %bb.0:
45+
; CHECK-NEXT: mov x8, #9218868437227405312
46+
; CHECK-NEXT: fabs d0, d0
47+
; CHECK-NEXT: fmov d1, x8
48+
; CHECK-NEXT: fcmp d0, d1
49+
; CHECK-NEXT: cset w0, eq
50+
; CHECK-NEXT: ret
4451
%abs = tail call double @llvm.fabs.f64(double %x)
4552
%cmpinf = fcmp oeq double %abs, 0x7FF0000000000000
4653
%ret = zext i1 %cmpinf to i32
@@ -50,11 +57,24 @@ define i32 @replace_isinf_call_f64(double %x) {
5057
; For long double it still requires loading the constant.
5158
define i32 @replace_isinf_call_f128(fp128 %x) {
5259
; CHECK-LABEL: replace_isinf_call_f128:
53-
; CHECK: adrp [[ADDR:x[0-9]+]], [[CSTLABEL:.LCP.*]]
54-
; CHECK: ldr q1, {{[[]}}[[ADDR]], :lo12:[[CSTLABEL]]{{[]]}}
55-
; CHECK: bl __eqtf2
56-
; CHECK: cmp w0, #0
57-
; CHECK: cset w0, eq
60+
; CHECK: // %bb.0:
61+
; CHECK-NEXT: sub sp, sp, #32
62+
; CHECK-NEXT: str x30, [sp, #16] // 8-byte Folded Spill
63+
; CHECK-NEXT: .cfi_def_cfa_offset 32
64+
; CHECK-NEXT: .cfi_offset w30, -16
65+
; CHECK-NEXT: str q0, [sp]
66+
; CHECK-NEXT: ldrb w8, [sp, #15]
67+
; CHECK-NEXT: and w8, w8, #0x7f
68+
; CHECK-NEXT: strb w8, [sp, #15]
69+
; CHECK-NEXT: adrp x8, .LCPI3_0
70+
; CHECK-NEXT: ldr q0, [sp]
71+
; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI3_0]
72+
; CHECK-NEXT: bl __eqtf2
73+
; CHECK-NEXT: ldr x30, [sp, #16] // 8-byte Folded Reload
74+
; CHECK-NEXT: cmp w0, #0
75+
; CHECK-NEXT: cset w0, eq
76+
; CHECK-NEXT: add sp, sp, #32
77+
; CHECK-NEXT: ret
5878
%abs = tail call fp128 @llvm.fabs.f128(fp128 %x)
5979
%cmpinf = fcmp oeq fp128 %abs, 0xL00000000000000007FFF000000000000
6080
%ret = zext i1 %cmpinf to i32

llvm/test/CodeGen/AArch64/machine_cse_impdef_killflags.ll

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc < %s -mtriple=aarch64-apple-ios -fast-isel -verify-machineinstrs | FileCheck %s
23

34
; Check that the kill flag is cleared between CSE'd instructions on their
45
; imp-def'd registers.
56
; The verifier would complain otherwise.
6-
define i64 @csed-impdef-killflag(i64 %a) {
7-
; CHECK-LABEL: csed-impdef-killflag
8-
; CHECK-DAG: mov [[REG1:w[0-9]+]], #1
9-
; CHECK-DAG: mov [[REG2:x[0-9]+]], #2
10-
; CHECK-DAG: mov [[REG3:x[0-9]+]], #3
11-
; CHECK-DAG: cmp x0, #0
12-
; CHECK: csel w[[SELECT_WREG_1:[0-9]+]], wzr, [[REG1]], ne
13-
; CHECK-DAG: csel [[SELECT_XREG_2:x[0-9]+]], [[REG2]], [[REG3]], ne
14-
; CHECK: ubfx [[SELECT_XREG_1:x[0-9]+]], x[[SELECT_WREG_1]], #0, #32
15-
; CHECK-NEXT: add x0, [[SELECT_XREG_2]], [[SELECT_XREG_1]]
16-
; CHECK-NEXT: ret
7+
define i64 @csed_impdef_killflag(i64 %a) {
8+
; CHECK-LABEL: csed_impdef_killflag:
9+
; CHECK: ; %bb.0:
10+
; CHECK-NEXT: mov w8, #1
11+
; CHECK-NEXT: cmp x0, #0
12+
; CHECK-NEXT: mov x9, #2
13+
; CHECK-NEXT: mov x10, #3
14+
; CHECK-NEXT: csel w8, wzr, w8, ne
15+
; CHECK-NEXT: csel x9, x9, x10, ne
16+
; CHECK-NEXT: ubfx x8, x8, #0, #32
17+
; CHECK-NEXT: add x0, x9, x8
18+
; CHECK-NEXT: ret
1719

1820
%1 = icmp ne i64 %a, 0
1921
%2 = select i1 %1, i32 0, i32 1

llvm/test/CodeGen/AArch64/madd-lohi.ll

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc -mtriple=arm64-apple-ios7.0 %s -o - | FileCheck %s
23
; RUN: llc -mtriple=aarch64_be-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-BE %s
34

45
define i128 @test_128bitmul(i128 %lhs, i128 %rhs) {
56
; CHECK-LABEL: test_128bitmul:
6-
; CHECK-DAG: umulh [[CARRY:x[0-9]+]], x0, x2
7-
; CHECK-DAG: madd [[PART1:x[0-9]+]], x0, x3, [[CARRY]]
8-
; CHECK: madd x1, x1, x2, [[PART1]]
9-
; CHECK: mul x0, x0, x2
10-
7+
; CHECK: ; %bb.0:
8+
; CHECK-NEXT: umulh x8, x0, x2
9+
; CHECK-NEXT: madd x8, x0, x3, x8
10+
; CHECK-NEXT: madd x1, x1, x2, x8
11+
; CHECK-NEXT: mul x0, x0, x2
12+
; CHECK-NEXT: ret
13+
;
1114
; CHECK-BE-LABEL: test_128bitmul:
12-
; CHECK-BE-DAG: umulh [[CARRY:x[0-9]+]], x1, x3
13-
; CHECK-BE-DAG: madd [[PART1:x[0-9]+]], x1, x2, [[CARRY]]
14-
; CHECK-BE: madd x0, x0, x3, [[PART1]]
15-
; CHECK-BE: mul x1, x1, x3
15+
; CHECK-BE: // %bb.0:
16+
; CHECK-BE-NEXT: umulh x8, x1, x3
17+
; CHECK-BE-NEXT: madd x8, x1, x2, x8
18+
; CHECK-BE-NEXT: madd x0, x0, x3, x8
19+
; CHECK-BE-NEXT: mul x1, x1, x3
20+
; CHECK-BE-NEXT: ret
21+
1622

1723
%prod = mul i128 %lhs, %rhs
1824
ret i128 %prod

0 commit comments

Comments
 (0)