1
- ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
1
; Check that 64-bit division is bypassed correctly.
3
2
; RUN: llc < %s -mtriple=x86_64-- -mattr=-idivq-to-divl | FileCheck %s --check-prefixes=CHECK,FAST-DIVQ
4
3
; RUN: llc < %s -mtriple=x86_64-- -mattr=+idivq-to-divl | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ
13
12
; RUN: llc < %s -mtriple=x86_64-- -mcpu=skylake | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ
14
13
; RUN: llc < %s -mtriple=x86_64-- -mcpu=alderlake | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ
15
14
; AMD
16
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=barcelona | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
17
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver1 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
18
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
19
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver1 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
20
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver2 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
21
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver3 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
22
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver4 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
23
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
24
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
25
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
26
- ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,FAST -DIVQ
15
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=barcelona | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
16
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver1 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
17
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
18
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver1 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
19
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver2 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
20
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver3 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
21
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=bdver4 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
22
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
23
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
24
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
25
+ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,SLOW -DIVQ
27
26
28
27
; Additional tests for 64-bit divide bypass
29
28
@@ -40,22 +39,8 @@ define i64 @sdiv_quotient(i64 %a, i64 %b) nounwind {
40
39
; FAST-DIVQ-NEXT: retq
41
40
;
42
41
; SLOW-DIVQ-LABEL: sdiv_quotient:
43
- ; SLOW-DIVQ: # %bb.0:
44
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
45
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
46
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
47
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
48
- ; SLOW-DIVQ-NEXT: je .LBB0_1
49
- ; SLOW-DIVQ-NEXT: # %bb.2:
50
- ; SLOW-DIVQ-NEXT: cqto
51
- ; SLOW-DIVQ-NEXT: idivq %rsi
52
- ; SLOW-DIVQ-NEXT: retq
53
- ; SLOW-DIVQ-NEXT: .LBB0_1:
54
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
55
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
56
- ; SLOW-DIVQ-NEXT: divl %esi
57
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax def $rax
58
- ; SLOW-DIVQ-NEXT: retq
42
+ ; SLOW-DIVQ-DAG: idivq %rsi
43
+ ; SLOW-DIVQ-DAG: divl %esi
59
44
%result = sdiv i64 %a , %b
60
45
ret i64 %result
61
46
}
@@ -92,23 +77,8 @@ define i64 @sdiv_remainder(i64 %a, i64 %b) nounwind {
92
77
; FAST-DIVQ-NEXT: retq
93
78
;
94
79
; SLOW-DIVQ-LABEL: sdiv_remainder:
95
- ; SLOW-DIVQ: # %bb.0:
96
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
97
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
98
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
99
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
100
- ; SLOW-DIVQ-NEXT: je .LBB3_1
101
- ; SLOW-DIVQ-NEXT: # %bb.2:
102
- ; SLOW-DIVQ-NEXT: cqto
103
- ; SLOW-DIVQ-NEXT: idivq %rsi
104
- ; SLOW-DIVQ-NEXT: movq %rdx, %rax
105
- ; SLOW-DIVQ-NEXT: retq
106
- ; SLOW-DIVQ-NEXT: .LBB3_1:
107
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
108
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
109
- ; SLOW-DIVQ-NEXT: divl %esi
110
- ; SLOW-DIVQ-NEXT: movl %edx, %eax
111
- ; SLOW-DIVQ-NEXT: retq
80
+ ; SLOW-DIVQ-DAG: idivq %rsi
81
+ ; SLOW-DIVQ-DAG: divl %esi
112
82
%result = srem i64 %a , %b
113
83
ret i64 %result
114
84
}
@@ -147,25 +117,8 @@ define i64 @sdiv_quotient_and_remainder(i64 %a, i64 %b) nounwind {
147
117
; FAST-DIVQ-NEXT: retq
148
118
;
149
119
; SLOW-DIVQ-LABEL: sdiv_quotient_and_remainder:
150
- ; SLOW-DIVQ: # %bb.0:
151
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
152
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
153
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
154
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
155
- ; SLOW-DIVQ-NEXT: je .LBB6_1
156
- ; SLOW-DIVQ-NEXT: # %bb.2:
157
- ; SLOW-DIVQ-NEXT: cqto
158
- ; SLOW-DIVQ-NEXT: idivq %rsi
159
- ; SLOW-DIVQ-NEXT: addq %rdx, %rax
160
- ; SLOW-DIVQ-NEXT: retq
161
- ; SLOW-DIVQ-NEXT: .LBB6_1:
162
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
163
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
164
- ; SLOW-DIVQ-NEXT: divl %esi
165
- ; SLOW-DIVQ-NEXT: # kill: def $edx killed $edx def $rdx
166
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax def $rax
167
- ; SLOW-DIVQ-NEXT: addq %rdx, %rax
168
- ; SLOW-DIVQ-NEXT: retq
120
+ ; SLOW-DIVQ-DAG: idivq %rsi
121
+ ; SLOW-DIVQ-DAG: divl %esi
169
122
%resultdiv = sdiv i64 %a , %b
170
123
%resultrem = srem i64 %a , %b
171
124
%result = add i64 %resultdiv , %resultrem
@@ -213,22 +166,8 @@ define i64 @udiv_quotient(i64 %a, i64 %b) nounwind {
213
166
; FAST-DIVQ-NEXT: retq
214
167
;
215
168
; SLOW-DIVQ-LABEL: udiv_quotient:
216
- ; SLOW-DIVQ: # %bb.0:
217
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
218
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
219
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
220
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
221
- ; SLOW-DIVQ-NEXT: je .LBB9_1
222
- ; SLOW-DIVQ-NEXT: # %bb.2:
223
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
224
- ; SLOW-DIVQ-NEXT: divq %rsi
225
- ; SLOW-DIVQ-NEXT: retq
226
- ; SLOW-DIVQ-NEXT: .LBB9_1:
227
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
228
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
229
- ; SLOW-DIVQ-NEXT: divl %esi
230
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax def $rax
231
- ; SLOW-DIVQ-NEXT: retq
169
+ ; SLOW-DIVQ-DAG: divq %rsi
170
+ ; SLOW-DIVQ-DAG: divl %esi
232
171
%result = udiv i64 %a , %b
233
172
ret i64 %result
234
173
}
@@ -265,23 +204,8 @@ define i64 @udiv_remainder(i64 %a, i64 %b) nounwind {
265
204
; FAST-DIVQ-NEXT: retq
266
205
;
267
206
; SLOW-DIVQ-LABEL: udiv_remainder:
268
- ; SLOW-DIVQ: # %bb.0:
269
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
270
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
271
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
272
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
273
- ; SLOW-DIVQ-NEXT: je .LBB12_1
274
- ; SLOW-DIVQ-NEXT: # %bb.2:
275
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
276
- ; SLOW-DIVQ-NEXT: divq %rsi
277
- ; SLOW-DIVQ-NEXT: movq %rdx, %rax
278
- ; SLOW-DIVQ-NEXT: retq
279
- ; SLOW-DIVQ-NEXT: .LBB12_1:
280
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
281
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
282
- ; SLOW-DIVQ-NEXT: divl %esi
283
- ; SLOW-DIVQ-NEXT: movl %edx, %eax
284
- ; SLOW-DIVQ-NEXT: retq
207
+ ; SLOW-DIVQ-DAG: divq %rsi
208
+ ; SLOW-DIVQ-DAG: divl %esi
285
209
%result = urem i64 %a , %b
286
210
ret i64 %result
287
211
}
@@ -320,25 +244,8 @@ define i64 @udiv_quotient_and_remainder(i64 %a, i64 %b) nounwind {
320
244
; FAST-DIVQ-NEXT: retq
321
245
;
322
246
; SLOW-DIVQ-LABEL: udiv_quotient_and_remainder:
323
- ; SLOW-DIVQ: # %bb.0:
324
- ; SLOW-DIVQ-NEXT: movq %rdi, %rax
325
- ; SLOW-DIVQ-NEXT: movq %rdi, %rcx
326
- ; SLOW-DIVQ-NEXT: orq %rsi, %rcx
327
- ; SLOW-DIVQ-NEXT: shrq $32, %rcx
328
- ; SLOW-DIVQ-NEXT: je .LBB15_1
329
- ; SLOW-DIVQ-NEXT: # %bb.2:
330
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
331
- ; SLOW-DIVQ-NEXT: divq %rsi
332
- ; SLOW-DIVQ-NEXT: addq %rdx, %rax
333
- ; SLOW-DIVQ-NEXT: retq
334
- ; SLOW-DIVQ-NEXT: .LBB15_1:
335
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax killed $rax
336
- ; SLOW-DIVQ-NEXT: xorl %edx, %edx
337
- ; SLOW-DIVQ-NEXT: divl %esi
338
- ; SLOW-DIVQ-NEXT: # kill: def $edx killed $edx def $rdx
339
- ; SLOW-DIVQ-NEXT: # kill: def $eax killed $eax def $rax
340
- ; SLOW-DIVQ-NEXT: addq %rdx, %rax
341
- ; SLOW-DIVQ-NEXT: retq
247
+ ; SLOW-DIVQ-DAG: divq %rsi
248
+ ; SLOW-DIVQ-DAG: divl %esi
342
249
%resultdiv = udiv i64 %a , %b
343
250
%resultrem = urem i64 %a , %b
344
251
%result = add i64 %resultdiv , %resultrem
0 commit comments