1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=cortex-m0 -verify-machineinstrs | FileCheck --check-prefix CHECK-T1 %s
3 ; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi -mcpu=cortex-m3 -verify-machineinstrs | FileCheck --check-prefix CHECK-T2 %s
5 define i32 @i(i32 %a) {
7 ; CHECK-T1: @ %bb.0: @ %entry
8 ; CHECK-T1-NEXT: movs r1, #255
9 ; CHECK-T1-NEXT: adds r1, #20
10 ; CHECK-T1-NEXT: bics r0, r1
11 ; CHECK-T1-NEXT: bx lr
14 ; CHECK-T2: @ %bb.0: @ %entry
15 ; CHECK-T2-NEXT: movw r1, #275
16 ; CHECK-T2-NEXT: bics r0, r1
17 ; CHECK-T2-NEXT: bx lr
19 %and = and i32 %a, -276
23 define i32 @j(i32 %a) {
25 ; CHECK-T1: @ %bb.0: @ %entry
26 ; CHECK-T1-NEXT: movs r1, #128
27 ; CHECK-T1-NEXT: bics r0, r1
28 ; CHECK-T1-NEXT: bx lr
31 ; CHECK-T2: @ %bb.0: @ %entry
32 ; CHECK-T2-NEXT: bic r0, r0, #128
33 ; CHECK-T2-NEXT: bx lr
35 %and = and i32 %a, -129
39 define void @truncated(i16 %a, i16* %p) {
40 ; CHECK-T1-LABEL: truncated:
42 ; CHECK-T1-NEXT: movs r2, #128
43 ; CHECK-T1-NEXT: bics r0, r2
44 ; CHECK-T1-NEXT: strh r0, [r1]
45 ; CHECK-T1-NEXT: bx lr
47 ; CHECK-T2-LABEL: truncated:
49 ; CHECK-T2-NEXT: bic r0, r0, #128
50 ; CHECK-T2-NEXT: strh r0, [r1]
51 ; CHECK-T2-NEXT: bx lr
52 %and = and i16 %a, -129
53 store i16 %and, i16* %p
57 define void @truncated_neg2(i16 %a, i16* %p) {
58 ; CHECK-T1-LABEL: truncated_neg2:
60 ; CHECK-T1-NEXT: movs r2, #1
61 ; CHECK-T1-NEXT: bics r0, r2
62 ; CHECK-T1-NEXT: strh r0, [r1]
63 ; CHECK-T1-NEXT: bx lr
65 ; CHECK-T2-LABEL: truncated_neg2:
67 ; CHECK-T2-NEXT: bic r0, r0, #1
68 ; CHECK-T2-NEXT: strh r0, [r1]
69 ; CHECK-T2-NEXT: bx lr
71 store i16 %and, i16* %p
75 define void @truncated_neg256(i16 %a, i16* %p) {
76 ; CHECK-T1-LABEL: truncated_neg256:
78 ; CHECK-T1-NEXT: movs r2, #255
79 ; CHECK-T1-NEXT: bics r0, r2
80 ; CHECK-T1-NEXT: strh r0, [r1]
81 ; CHECK-T1-NEXT: bx lr
83 ; CHECK-T2-LABEL: truncated_neg256:
85 ; CHECK-T2-NEXT: bic r0, r0, #255
86 ; CHECK-T2-NEXT: strh r0, [r1]
87 ; CHECK-T2-NEXT: bx lr
88 %and = and i16 %a, -256
89 store i16 %and, i16* %p
93 ; FIXME: Thumb2 supports "bic r0, r0, #510"
94 define void @truncated_neg511(i16 %a, i16* %p) {
95 ; CHECK-T1-LABEL: truncated_neg511:
97 ; CHECK-T1-NEXT: ldr r2, .LCPI5_0
98 ; CHECK-T1-NEXT: ands r2, r0
99 ; CHECK-T1-NEXT: strh r2, [r1]
100 ; CHECK-T1-NEXT: bx lr
101 ; CHECK-T1-NEXT: .p2align 2
102 ; CHECK-T1-NEXT: @ %bb.1:
103 ; CHECK-T1-NEXT: .LCPI5_0:
104 ; CHECK-T1-NEXT: .long 65025 @ 0xfe01
106 ; CHECK-T2-LABEL: truncated_neg511:
108 ; CHECK-T2-NEXT: movw r2, #65025
109 ; CHECK-T2-NEXT: ands r0, r2
110 ; CHECK-T2-NEXT: strh r0, [r1]
111 ; CHECK-T2-NEXT: bx lr
112 %and = and i16 %a, -511
113 store i16 %and, i16* %p