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
4 define i64 @f0(i64 %A, i64 %B) {
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
20 define i32 @f1(i64 %x, i64 %y) {
22 ; CHECK-LE: lsl{{.*}}r2
23 ; CHECK-BE: lsl{{.*}}r3
25 %b = trunc i64 %a to i32
29 define i32 @f2(i64 %x, i64 %y) {
31 ; CHECK-LE: rsb r3, r2, #32
32 ; CHECK-LE-NEXT: lsr{{.*}}r2
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
38 ; CHECK-BE: rsb r2, r3, #32
39 ; CHECK-BE-NEXT: lsr{{.*}}r3
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
46 %b = trunc i64 %a to i32
50 define i32 @f3(i64 %x, i64 %y) {
52 ; CHECK-LE: rsb r3, r2, #32
53 ; CHECK-LE-NEXT: lsr{{.*}}r2
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
59 ; CHECK-BE: rsb r2, r3, #32
60 ; CHECK-BE-NEXT: lsr{{.*}}r3
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
67 %b = trunc i64 %a to i32