Skip to content

Commit 4d4df2b

Browse files
committed
[AArch64][GlobalISel] Add test coverage for dp-3source.ll. NFC
madd-lohi.ll is removed as the test is available elsewhere.
1 parent f9c2565 commit 4d4df2b

File tree

2 files changed

+92
-46
lines changed

2 files changed

+92
-46
lines changed
Lines changed: 92 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,212 @@
1-
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3+
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
24

35
define i32 @test_madd32(i32 %val0, i32 %val1, i32 %val2) {
46
; CHECK-LABEL: test_madd32:
7+
; CHECK: ; %bb.0:
8+
; CHECK-NEXT: madd w0, w1, w2, w0
9+
; CHECK-NEXT: ret
510
%mid = mul i32 %val1, %val2
611
%res = add i32 %val0, %mid
7-
; CHECK: madd {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
812
ret i32 %res
913
}
1014

1115
define i64 @test_madd64(i64 %val0, i64 %val1, i64 %val2) {
1216
; CHECK-LABEL: test_madd64:
17+
; CHECK: ; %bb.0:
18+
; CHECK-NEXT: madd x0, x1, x2, x0
19+
; CHECK-NEXT: ret
1320
%mid = mul i64 %val1, %val2
1421
%res = add i64 %val0, %mid
15-
; CHECK: madd {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
1622
ret i64 %res
1723
}
1824

1925
define i32 @test_msub32(i32 %val0, i32 %val1, i32 %val2) {
2026
; CHECK-LABEL: test_msub32:
27+
; CHECK: ; %bb.0:
28+
; CHECK-NEXT: msub w0, w1, w2, w0
29+
; CHECK-NEXT: ret
2130
%mid = mul i32 %val1, %val2
2231
%res = sub i32 %val0, %mid
23-
; CHECK: msub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
2432
ret i32 %res
2533
}
2634

2735
define i64 @test_msub64(i64 %val0, i64 %val1, i64 %val2) {
2836
; CHECK-LABEL: test_msub64:
37+
; CHECK: ; %bb.0:
38+
; CHECK-NEXT: msub x0, x1, x2, x0
39+
; CHECK-NEXT: ret
2940
%mid = mul i64 %val1, %val2
3041
%res = sub i64 %val0, %mid
31-
; CHECK: msub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
3242
ret i64 %res
3343
}
3444

3545
define i64 @test_smaddl(i64 %acc, i32 %val1, i32 %val2) {
3646
; CHECK-LABEL: test_smaddl:
47+
; CHECK: ; %bb.0:
48+
; CHECK-NEXT: smaddl x0, w1, w2, x0
49+
; CHECK-NEXT: ret
3750
%ext1 = sext i32 %val1 to i64
3851
%ext2 = sext i32 %val2 to i64
3952
%prod = mul i64 %ext1, %ext2
4053
%res = add i64 %acc, %prod
41-
; CHECK: smaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
4254
ret i64 %res
4355
}
4456

4557
define i64 @test_smsubl(i64 %acc, i32 %val1, i32 %val2) {
4658
; CHECK-LABEL: test_smsubl:
59+
; CHECK: ; %bb.0:
60+
; CHECK-NEXT: smsubl x0, w1, w2, x0
61+
; CHECK-NEXT: ret
4762
%ext1 = sext i32 %val1 to i64
4863
%ext2 = sext i32 %val2 to i64
4964
%prod = mul i64 %ext1, %ext2
5065
%res = sub i64 %acc, %prod
51-
; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
5266
ret i64 %res
5367
}
5468

5569
define i64 @test_umaddl(i64 %acc, i32 %val1, i32 %val2) {
5670
; CHECK-LABEL: test_umaddl:
71+
; CHECK: ; %bb.0:
72+
; CHECK-NEXT: umaddl x0, w1, w2, x0
73+
; CHECK-NEXT: ret
5774
%ext1 = zext i32 %val1 to i64
5875
%ext2 = zext i32 %val2 to i64
5976
%prod = mul i64 %ext1, %ext2
6077
%res = add i64 %acc, %prod
61-
; CHECK: umaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
6278
ret i64 %res
6379
}
6480

6581
define i64 @test_umsubl(i64 %acc, i32 %val1, i32 %val2) {
6682
; CHECK-LABEL: test_umsubl:
83+
; CHECK: ; %bb.0:
84+
; CHECK-NEXT: umsubl x0, w1, w2, x0
85+
; CHECK-NEXT: ret
6786
%ext1 = zext i32 %val1 to i64
6887
%ext2 = zext i32 %val2 to i64
6988
%prod = mul i64 %ext1, %ext2
7089
%res = sub i64 %acc, %prod
71-
; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
7290
ret i64 %res
7391
}
7492

7593
define i64 @test_smulh(i64 %lhs, i64 %rhs) {
76-
; CHECK-LABEL: test_smulh:
94+
; CHECK-SD-LABEL: test_smulh:
95+
; CHECK-SD: ; %bb.0:
96+
; CHECK-SD-NEXT: smulh x0, x0, x1
97+
; CHECK-SD-NEXT: ret
98+
;
99+
; CHECK-GI-LABEL: test_smulh:
100+
; CHECK-GI: ; %bb.0:
101+
; CHECK-GI-NEXT: asr x8, x1, #63
102+
; CHECK-GI-NEXT: asr x9, x0, #63
103+
; CHECK-GI-NEXT: umulh x10, x0, x1
104+
; CHECK-GI-NEXT: mul x8, x0, x8
105+
; CHECK-GI-NEXT: madd x8, x9, x1, x8
106+
; CHECK-GI-NEXT: add x0, x8, x10
107+
; CHECK-GI-NEXT: ret
77108
%ext1 = sext i64 %lhs to i128
78109
%ext2 = sext i64 %rhs to i128
79110
%res = mul i128 %ext1, %ext2
80111
%high = lshr i128 %res, 64
81112
%val = trunc i128 %high to i64
82-
; CHECK: smulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
83113
ret i64 %val
84114
}
85115

86116
define i64 @test_umulh(i64 %lhs, i64 %rhs) {
87117
; CHECK-LABEL: test_umulh:
118+
; CHECK: ; %bb.0:
119+
; CHECK-NEXT: umulh x0, x0, x1
120+
; CHECK-NEXT: ret
88121
%ext1 = zext i64 %lhs to i128
89122
%ext2 = zext i64 %rhs to i128
90123
%res = mul i128 %ext1, %ext2
91124
%high = lshr i128 %res, 64
92125
%val = trunc i128 %high to i64
93-
; CHECK: umulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
94126
ret i64 %val
95127
}
96128

97129
define i32 @test_mul32(i32 %lhs, i32 %rhs) {
98130
; CHECK-LABEL: test_mul32:
131+
; CHECK: ; %bb.0:
132+
; CHECK-NEXT: mul w0, w0, w1
133+
; CHECK-NEXT: ret
99134
%res = mul i32 %lhs, %rhs
100-
; CHECK: mul {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
101135
ret i32 %res
102136
}
103137

104138
define i64 @test_mul64(i64 %lhs, i64 %rhs) {
105139
; CHECK-LABEL: test_mul64:
140+
; CHECK: ; %bb.0:
141+
; CHECK-NEXT: mul x0, x0, x1
142+
; CHECK-NEXT: ret
106143
%res = mul i64 %lhs, %rhs
107-
; CHECK: mul {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
108144
ret i64 %res
109145
}
110146

111147
define i32 @test_mneg32(i32 %lhs, i32 %rhs) {
112148
; CHECK-LABEL: test_mneg32:
149+
; CHECK: ; %bb.0:
150+
; CHECK-NEXT: mneg w0, w0, w1
151+
; CHECK-NEXT: ret
113152
%prod = mul i32 %lhs, %rhs
114153
%res = sub i32 0, %prod
115-
; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
116154
ret i32 %res
117155
}
118156

119157
define i64 @test_mneg64(i64 %lhs, i64 %rhs) {
120158
; CHECK-LABEL: test_mneg64:
159+
; CHECK: ; %bb.0:
160+
; CHECK-NEXT: mneg x0, x0, x1
161+
; CHECK-NEXT: ret
121162
%prod = mul i64 %lhs, %rhs
122163
%res = sub i64 0, %prod
123-
; CHECK: mneg {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
124164
ret i64 %res
125165
}
126166

127167
define i64 @test_smull(i32 %lhs, i32 %rhs) {
128168
; CHECK-LABEL: test_smull:
169+
; CHECK: ; %bb.0:
170+
; CHECK-NEXT: smull x0, w0, w1
171+
; CHECK-NEXT: ret
129172
%ext1 = sext i32 %lhs to i64
130173
%ext2 = sext i32 %rhs to i64
131174
%res = mul i64 %ext1, %ext2
132-
; CHECK: smull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
133175
ret i64 %res
134176
}
135177

136178
define i64 @test_umull(i32 %lhs, i32 %rhs) {
137179
; CHECK-LABEL: test_umull:
180+
; CHECK: ; %bb.0:
181+
; CHECK-NEXT: umull x0, w0, w1
182+
; CHECK-NEXT: ret
138183
%ext1 = zext i32 %lhs to i64
139184
%ext2 = zext i32 %rhs to i64
140185
%res = mul i64 %ext1, %ext2
141-
; CHECK: umull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
142186
ret i64 %res
143187
}
144188

145189
define i64 @test_smnegl(i32 %lhs, i32 %rhs) {
146190
; CHECK-LABEL: test_smnegl:
191+
; CHECK: ; %bb.0:
192+
; CHECK-NEXT: smnegl x0, w0, w1
193+
; CHECK-NEXT: ret
147194
%ext1 = sext i32 %lhs to i64
148195
%ext2 = sext i32 %rhs to i64
149196
%prod = mul i64 %ext1, %ext2
150197
%res = sub i64 0, %prod
151-
; CHECK: smnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
152198
ret i64 %res
153199
}
154200

155201
define i64 @test_umnegl(i32 %lhs, i32 %rhs) {
156202
; CHECK-LABEL: test_umnegl:
203+
; CHECK: ; %bb.0:
204+
; CHECK-NEXT: umnegl x0, w0, w1
205+
; CHECK-NEXT: ret
157206
%ext1 = zext i32 %lhs to i64
158207
%ext2 = zext i32 %rhs to i64
159208
%prod = mul i64 %ext1, %ext2
160209
%res = sub i64 0, %prod
161-
; CHECK: umnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
162210
ret i64 %res
163211
}
164212

@@ -168,11 +216,34 @@ define i64 @test_umnegl(i32 %lhs, i32 %rhs) {
168216

169217
define void @test_mneg(){
170218
; CHECK-LABEL: test_mneg:
219+
; CHECK: ; %bb.0:
220+
; CHECK-NEXT: Lloh0:
221+
; CHECK-NEXT: adrp x8, _a@GOTPAGE
222+
; CHECK-NEXT: Lloh1:
223+
; CHECK-NEXT: adrp x9, _b@GOTPAGE
224+
; CHECK-NEXT: Lloh2:
225+
; CHECK-NEXT: ldr x8, [x8, _a@GOTPAGEOFF]
226+
; CHECK-NEXT: Lloh3:
227+
; CHECK-NEXT: ldr x9, [x9, _b@GOTPAGEOFF]
228+
; CHECK-NEXT: Lloh4:
229+
; CHECK-NEXT: ldr w8, [x8]
230+
; CHECK-NEXT: Lloh5:
231+
; CHECK-NEXT: ldr w9, [x9]
232+
; CHECK-NEXT: mneg w8, w8, w9
233+
; CHECK-NEXT: Lloh6:
234+
; CHECK-NEXT: adrp x9, _c@GOTPAGE
235+
; CHECK-NEXT: Lloh7:
236+
; CHECK-NEXT: ldr x9, [x9, _c@GOTPAGEOFF]
237+
; CHECK-NEXT: Lloh8:
238+
; CHECK-NEXT: str w8, [x9]
239+
; CHECK-NEXT: ret
240+
; CHECK-NEXT: .loh AdrpLdrGotStr Lloh6, Lloh7, Lloh8
241+
; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh1, Lloh3, Lloh5
242+
; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh0, Lloh2, Lloh4
171243
%1 = load i32, ptr @a, align 4
172244
%2 = load i32, ptr @b, align 4
173245
%3 = sub i32 0, %1
174246
%4 = mul i32 %2, %3
175247
store i32 %4, ptr @c, align 4
176-
; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
177248
ret void
178249
}

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

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)