Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
      2 ; RUN: llc -mtriple=armeb-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
      3 
      4 define i64 @f0(i64 %A, i64 %B) {
      5 ; CHECK-LABEL: f0:
      6 ; CHECK-LE:      lsrs    r3, r3, #1
      7 ; CHECK-LE-NEXT: rrx     r2, r2
      8 ; CHECK-LE-NEXT: subs    r0, r0, r2
      9 ; CHECK-LE-NEXT: sbc     r1, r1, r3
     10 ; CHECK-BE:      lsrs    r2, r2, #1
     11 ; CHECK-BE-NEXT: rrx     r3, r3
     12 ; CHECK-BE-NEXT: subs    r1, r1, r3
     13 ; CHECK-BE-NEXT: sbc     r0, r0, r2
     14 	%tmp = bitcast i64 %A to i64
     15 	%tmp2 = lshr i64 %B, 1
     16 	%tmp3 = sub i64 %tmp, %tmp2
     17 	ret i64 %tmp3
     18 }
     19 
     20 define i32 @f1(i64 %x, i64 %y) {
     21 ; CHECK-LABEL: f1:
     22 ; CHECK-LE: lsl{{.*}}r2
     23 ; CHECK-BE: lsl{{.*}}r3
     24 	%a = shl i64 %x, %y
     25 	%b = trunc i64 %a to i32
     26 	ret i32 %b
     27 }
     28 
     29 define i32 @f2(i64 %x, i64 %y) {
     30 ; CHECK-LABEL: f2:
     31 ; CHECK-LE:      lsr{{.*}}r2
     32 ; CHECK-LE-NEXT: rsb     r3, r2, #32
     33 ; CHECK-LE-NEXT: sub     r2, r2, #32
     34 ; CHECK-LE-NEXT: orr     r0, r0, r1, lsl r3
     35 ; CHECK-LE-NEXT: cmp     r2, #0
     36 ; CHECK-LE-NEXT: asrge   r0, r1, r2
     37 
     38 ; CHECK-BE:      lsr{{.*}}r3
     39 ; CHECK-BE-NEXT: rsb     r2, r3, #32
     40 ; CHECK-BE-NEXT: orr     r1, r1, r0, lsl r2
     41 ; CHECK-BE-NEXT: sub     r2, r3, #32
     42 ; CHECK-BE-NEXT: cmp     r2, #0
     43 ; CHECK-BE-NEXT: asrge   r1, r0, r2
     44 
     45 	%a = ashr i64 %x, %y
     46 	%b = trunc i64 %a to i32
     47 	ret i32 %b
     48 }
     49 
     50 define i32 @f3(i64 %x, i64 %y) {
     51 ; CHECK-LABEL: f3:
     52 ; CHECK-LE:      lsr{{.*}}r2
     53 ; CHECK-LE-NEXT: rsb     r3, r2, #32
     54 ; CHECK-LE-NEXT: sub     r2, r2, #32
     55 ; CHECK-LE-NEXT: orr     r0, r0, r1, lsl r3
     56 ; CHECK-LE-NEXT: cmp     r2, #0
     57 ; CHECK-LE-NEXT: lsrge   r0, r1, r2
     58 
     59 ; CHECK-BE:      lsr{{.*}}r3
     60 ; CHECK-BE-NEXT: rsb     r2, r3, #32
     61 ; CHECK-BE-NEXT: orr     r1, r1, r0, lsl r2
     62 ; CHECK-BE-NEXT: sub     r2, r3, #32
     63 ; CHECK-BE-NEXT: cmp     r2, #0
     64 ; CHECK-BE-NEXT: lsrge   r1, r0, r2
     65 
     66 	%a = lshr i64 %x, %y
     67 	%b = trunc i64 %a to i32
     68 	ret i32 %b
     69 }
     70