Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc < %s -march=arm | FileCheck %s
      2 
      3 define i64 @f0(i64 %A, i64 %B) {
      4 ; CHECK: f0
      5 ; CHECK:      lsrs    r3, r3, #1
      6 ; CHECK-NEXT: rrx     r2, r2
      7 ; CHECK-NEXT: subs    r0, r0, r2
      8 ; CHECK-NEXT: sbc     r1, r1, r3
      9 	%tmp = bitcast i64 %A to i64
     10 	%tmp2 = lshr i64 %B, 1
     11 	%tmp3 = sub i64 %tmp, %tmp2
     12 	ret i64 %tmp3
     13 }
     14 
     15 define i32 @f1(i64 %x, i64 %y) {
     16 ; CHECK: f1
     17 ; CHECK: lsl{{.*}}r2
     18 	%a = shl i64 %x, %y
     19 	%b = trunc i64 %a to i32
     20 	ret i32 %b
     21 }
     22 
     23 define i32 @f2(i64 %x, i64 %y) {
     24 ; CHECK: f2
     25 ; CHECK:      lsr{{.*}}r2
     26 ; CHECK-NEXT: rsb     r3, r2, #32
     27 ; CHECK-NEXT: sub     r2, r2, #32
     28 ; CHECK-NEXT: orr     r0, r0, r1, lsl r3
     29 ; CHECK-NEXT: cmp     r2, #0
     30 ; CHECK-NEXT: asrge   r0, r1, r2
     31 	%a = ashr i64 %x, %y
     32 	%b = trunc i64 %a to i32
     33 	ret i32 %b
     34 }
     35 
     36 define i32 @f3(i64 %x, i64 %y) {
     37 ; CHECK: f3
     38 ; CHECK:      lsr{{.*}}r2
     39 ; CHECK-NEXT: rsb     r3, r2, #32
     40 ; CHECK-NEXT: sub     r2, r2, #32
     41 ; CHECK-NEXT: orr     r0, r0, r1, lsl r3
     42 ; CHECK-NEXT: cmp     r2, #0
     43 ; CHECK-NEXT: lsrge   r0, r1, r2
     44 	%a = lshr i64 %x, %y
     45 	%b = trunc i64 %a to i32
     46 	ret i32 %b
     47 }
     48