Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=0 | FileCheck %s
      2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
      3 target triple = "i686-pc-linux-gnu"
      4 
      5 define zeroext i16 @test1(i16 zeroext %x) nounwind {
      6 entry:
      7 	%div = udiv i16 %x, 33
      8 	ret i16 %div
      9 ; CHECK: test1:
     10 ; CHECK: imull	$63551, %eax, %eax
     11 ; CHECK-NEXT: shrl	$21, %eax
     12 ; CHECK-NEXT: ret
     13 }
     14 
     15 define zeroext i16 @test2(i8 signext %x, i16 zeroext %c) nounwind readnone ssp noredzone {
     16 entry:
     17   %div = udiv i16 %c, 3
     18   ret i16 %div
     19 
     20 ; CHECK: test2:
     21 ; CHECK: imull	$43691, %eax, %eax
     22 ; CHECK-NEXT: shrl	$17, %eax
     23 ; CHECK-NEXT: ret
     24 }
     25 
     26 define zeroext i8 @test3(i8 zeroext %x, i8 zeroext %c) nounwind readnone ssp noredzone {
     27 entry:
     28   %div = udiv i8 %c, 3
     29   ret i8 %div
     30 
     31 ; CHECK: test3:
     32 ; CHECK: movzbl  8(%esp), %eax
     33 ; CHECK-NEXT: imull	$171, %eax, %eax
     34 ; CHECK-NEXT: shrl	$9, %eax
     35 ; CHECK-NEXT: ret
     36 }
     37 
     38 define signext i16 @test4(i16 signext %x) nounwind {
     39 entry:
     40 	%div = sdiv i16 %x, 33		; <i32> [#uses=1]
     41 	ret i16 %div
     42 ; CHECK: test4:
     43 ; CHECK: imull	$1986, %eax, %
     44 }
     45 
     46 define i32 @test5(i32 %A) nounwind {
     47         %tmp1 = udiv i32 %A, 1577682821         ; <i32> [#uses=1]
     48         ret i32 %tmp1
     49 ; CHECK: test5:
     50 ; CHECK: movl	$365384439, %eax
     51 ; CHECK: mull	4(%esp)
     52 }
     53 
     54 define signext i16 @test6(i16 signext %x) nounwind {
     55 entry:
     56   %div = sdiv i16 %x, 10
     57   ret i16 %div
     58 ; CHECK: test6:
     59 ; CHECK: imull	$26215, %eax, %eax
     60 ; CHECK: shrl	$31, %ecx
     61 ; CHECK: sarl	$18, %eax
     62 }
     63 
     64 define i32 @test7(i32 %x) nounwind {
     65   %div = udiv i32 %x, 28
     66   ret i32 %div
     67 ; CHECK: test7:
     68 ; CHECK: shrl $2
     69 ; CHECK: movl $613566757
     70 ; CHECK: mull
     71 ; CHECK-NOT: shrl
     72 ; CHECK: ret
     73 }
     74