Skip to content

Commit ac17b6b

Browse files
committed
[NFC] Autogenerate CodeGen/X86/sdiv-pow2.ll
1 parent 192c0e5 commit ac17b6b

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

llvm/test/CodeGen/X86/sdiv-pow2.ll

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
12
; RUN: llc -mtriple=i686-- < %s | FileCheck %s
23

34
; No attributes, should not use idiv
45
define i32 @test1(i32 inreg %x) {
6+
; CHECK-LABEL: test1:
7+
; CHECK: # %bb.0: # %entry
8+
; CHECK-NEXT: movl %eax, %ecx
9+
; CHECK-NEXT: sarl $31, %ecx
10+
; CHECK-NEXT: shrl $28, %ecx
11+
; CHECK-NEXT: addl %ecx, %eax
12+
; CHECK-NEXT: sarl $4, %eax
13+
; CHECK-NEXT: retl
514
entry:
615
%div = sdiv i32 %x, 16
716
ret i32 %div
8-
; CHECK-LABEL: test1:
9-
; CHECK-NOT: idivl
10-
; CHECK: ret
1117
}
1218

1319
; Has minsize (-Oz) attribute, should generate idiv
1420
define i32 @test2(i32 inreg %x) minsize {
21+
; CHECK-LABEL: test2:
22+
; CHECK: # %bb.0: # %entry
23+
; CHECK-NEXT: pushl $16
24+
; CHECK-NEXT: .cfi_adjust_cfa_offset 4
25+
; CHECK-NEXT: popl %ecx
26+
; CHECK-NEXT: .cfi_adjust_cfa_offset -4
27+
; CHECK-NEXT: cltd
28+
; CHECK-NEXT: idivl %ecx
29+
; CHECK-NEXT: retl
1530
entry:
1631
%div = sdiv i32 %x, 16
1732
ret i32 %div
18-
; CHECK-LABEL: test2:
19-
; CHECK: idivl
20-
; CHECK: ret
2133
}
2234

2335
; Has optsize (-Os) attribute, should not generate idiv
2436
define i32 @test3(i32 inreg %x) optsize {
37+
; CHECK-LABEL: test3:
38+
; CHECK: # %bb.0: # %entry
39+
; CHECK-NEXT: movl %eax, %ecx
40+
; CHECK-NEXT: sarl $31, %ecx
41+
; CHECK-NEXT: shrl $28, %ecx
42+
; CHECK-NEXT: addl %ecx, %eax
43+
; CHECK-NEXT: sarl $4, %eax
44+
; CHECK-NEXT: retl
2545
entry:
2646
%div = sdiv i32 %x, 16
2747
ret i32 %div
28-
; CHECK-LABEL: test3:
29-
; CHECK-NOT: idivl
30-
; CHECK: ret
3148
}
3249

3350

0 commit comments

Comments
 (0)