51 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=i686-- < %s | FileCheck %s3 4; No attributes, should not use idiv5define i32 @test1(i32 inreg %x) {6; CHECK-LABEL: test1:7; CHECK: # %bb.0: # %entry8; CHECK-NEXT: movl %eax, %ecx9; CHECK-NEXT: sarl $31, %ecx10; CHECK-NEXT: shrl $28, %ecx11; CHECK-NEXT: addl %ecx, %eax12; CHECK-NEXT: sarl $4, %eax13; CHECK-NEXT: retl14entry:15 %div = sdiv i32 %x, 1616 ret i32 %div17}18 19; Has minsize (-Oz) attribute, should generate idiv20define i32 @test2(i32 inreg %x) minsize {21; CHECK-LABEL: test2:22; CHECK: # %bb.0: # %entry23; CHECK-NEXT: pushl $1624; CHECK-NEXT: .cfi_adjust_cfa_offset 425; CHECK-NEXT: popl %ecx26; CHECK-NEXT: .cfi_adjust_cfa_offset -427; CHECK-NEXT: cltd28; CHECK-NEXT: idivl %ecx29; CHECK-NEXT: retl30entry:31 %div = sdiv i32 %x, 1632 ret i32 %div33}34 35; Has optsize (-Os) attribute, should not generate idiv36define i32 @test3(i32 inreg %x) optsize {37; CHECK-LABEL: test3:38; CHECK: # %bb.0: # %entry39; CHECK-NEXT: movl %eax, %ecx40; CHECK-NEXT: sarl $31, %ecx41; CHECK-NEXT: shrl $28, %ecx42; CHECK-NEXT: addl %ecx, %eax43; CHECK-NEXT: sarl $4, %eax44; CHECK-NEXT: retl45entry:46 %div = sdiv i32 %x, 1647 ret i32 %div48}49 50 51