1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=i686-- < %s | FileCheck %s
4 ; No attributes, should not use idiv
5 define i32 @test1(i32 inreg %x) {
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
15 %div = sdiv i32 %x, 16
19 ; Has minsize (-Oz) attribute, should generate idiv
20 define i32 @test2(i32 inreg %x) minsize {
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
28 ; CHECK-NEXT: idivl %ecx
31 %div = sdiv i32 %x, 16
35 ; Has optsize (-Os) attribute, should not generate idiv
36 define i32 @test3(i32 inreg %x) optsize {
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
46 %div = sdiv i32 %x, 16