1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-a8 %s -o - | FileCheck %s -check-prefixes=CHECK,CHECK-DSP
3 ; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-m3 %s -o - | FileCheck %s -check-prefixes=CHECK,CHECK-NO-DSP
4 ; RUN: llc -mtriple=thumbv7em-eabi %s -o - | FileCheck %s -check-prefixes=CHECK,CHECK-DSP
5 ; RUN: llc -mtriple=thumbv8m.main-none-eabi %s -o - | FileCheck %s -check-prefixes=CHECK,CHECK-NO-DSP
6 ; RUN: llc -mtriple=thumbv8m.main-none-eabi -mattr=+dsp %s -o - | FileCheck %s -check-prefixes=CHECK,CHECK-DSP
8 define i32 @test1(i32 %x) {
9 ; CHECK-DSP-LABEL: test1:
11 ; CHECK-DSP-NEXT: uxtb16 r0, r0
12 ; CHECK-DSP-NEXT: bx lr
14 ; CHECK-NO-DSP-LABEL: test1:
15 ; CHECK-NO-DSP: @ %bb.0:
16 ; CHECK-NO-DSP-NEXT: bic r0, r0, #-16711936
17 ; CHECK-NO-DSP-NEXT: bx lr
18 %tmp1 = and i32 %x, 16711935 ; <i32> [#uses=1]
23 define i32 @test2(i32 %x) {
24 ; CHECK-DSP-LABEL: test2:
26 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #8
27 ; CHECK-DSP-NEXT: bx lr
29 ; CHECK-NO-DSP-LABEL: test2:
30 ; CHECK-NO-DSP: @ %bb.0:
31 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
32 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, lsr #8
33 ; CHECK-NO-DSP-NEXT: bx lr
34 %tmp1 = lshr i32 %x, 8 ; <i32> [#uses=1]
35 %tmp2 = and i32 %tmp1, 16711935 ; <i32> [#uses=1]
39 define i32 @test3(i32 %x) {
40 ; CHECK-DSP-LABEL: test3:
42 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #8
43 ; CHECK-DSP-NEXT: bx lr
45 ; CHECK-NO-DSP-LABEL: test3:
46 ; CHECK-NO-DSP: @ %bb.0:
47 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
48 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, lsr #8
49 ; CHECK-NO-DSP-NEXT: bx lr
50 %tmp1 = lshr i32 %x, 8 ; <i32> [#uses=1]
51 %tmp2 = and i32 %tmp1, 16711935 ; <i32> [#uses=1]
55 define i32 @test4(i32 %x) {
56 ; CHECK-DSP-LABEL: test4:
58 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #8
59 ; CHECK-DSP-NEXT: bx lr
61 ; CHECK-NO-DSP-LABEL: test4:
62 ; CHECK-NO-DSP: @ %bb.0:
63 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
64 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, lsr #8
65 ; CHECK-NO-DSP-NEXT: bx lr
66 %tmp1 = lshr i32 %x, 8 ; <i32> [#uses=1]
67 %tmp6 = and i32 %tmp1, 16711935 ; <i32> [#uses=1]
71 define i32 @test5(i32 %x) {
72 ; CHECK-DSP-LABEL: test5:
74 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #8
75 ; CHECK-DSP-NEXT: bx lr
77 ; CHECK-NO-DSP-LABEL: test5:
78 ; CHECK-NO-DSP: @ %bb.0:
79 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
80 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, lsr #8
81 ; CHECK-NO-DSP-NEXT: bx lr
82 %tmp1 = lshr i32 %x, 8 ; <i32> [#uses=1]
83 %tmp2 = and i32 %tmp1, 16711935 ; <i32> [#uses=1]
87 define i32 @test6(i32 %x) {
88 ; CHECK-DSP-LABEL: test6:
90 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #16
91 ; CHECK-DSP-NEXT: bx lr
93 ; CHECK-NO-DSP-LABEL: test6:
94 ; CHECK-NO-DSP: @ %bb.0:
95 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
96 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, ror #16
97 ; CHECK-NO-DSP-NEXT: bx lr
98 %tmp1 = lshr i32 %x, 16 ; <i32> [#uses=1]
99 %tmp2 = and i32 %tmp1, 255 ; <i32> [#uses=1]
100 %tmp4 = shl i32 %x, 16 ; <i32> [#uses=1]
101 %tmp5 = and i32 %tmp4, 16711680 ; <i32> [#uses=1]
102 %tmp6 = or i32 %tmp2, %tmp5 ; <i32> [#uses=1]
106 define i32 @test7(i32 %x) {
107 ; CHECK-DSP-LABEL: test7:
108 ; CHECK-DSP: @ %bb.0:
109 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #16
110 ; CHECK-DSP-NEXT: bx lr
112 ; CHECK-NO-DSP-LABEL: test7:
113 ; CHECK-NO-DSP: @ %bb.0:
114 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
115 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, ror #16
116 ; CHECK-NO-DSP-NEXT: bx lr
117 %tmp1 = lshr i32 %x, 16 ; <i32> [#uses=1]
118 %tmp2 = and i32 %tmp1, 255 ; <i32> [#uses=1]
119 %tmp4 = shl i32 %x, 16 ; <i32> [#uses=1]
120 %tmp5 = and i32 %tmp4, 16711680 ; <i32> [#uses=1]
121 %tmp6 = or i32 %tmp2, %tmp5 ; <i32> [#uses=1]
125 define i32 @test8(i32 %x) {
126 ; CHECK-DSP-LABEL: test8:
127 ; CHECK-DSP: @ %bb.0:
128 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #24
129 ; CHECK-DSP-NEXT: bx lr
131 ; CHECK-NO-DSP-LABEL: test8:
132 ; CHECK-NO-DSP: @ %bb.0:
133 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
134 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, ror #24
135 ; CHECK-NO-DSP-NEXT: bx lr
136 %tmp1 = shl i32 %x, 8 ; <i32> [#uses=1]
137 %tmp2 = and i32 %tmp1, 16711680 ; <i32> [#uses=1]
138 %tmp5 = lshr i32 %x, 24 ; <i32> [#uses=1]
139 %tmp6 = or i32 %tmp2, %tmp5 ; <i32> [#uses=1]
143 define i32 @test9(i32 %x) {
144 ; CHECK-DSP-LABEL: test9:
145 ; CHECK-DSP: @ %bb.0:
146 ; CHECK-DSP-NEXT: uxtb16 r0, r0, ror #24
147 ; CHECK-DSP-NEXT: bx lr
149 ; CHECK-NO-DSP-LABEL: test9:
150 ; CHECK-NO-DSP: @ %bb.0:
151 ; CHECK-NO-DSP-NEXT: mov.w r1, #16711935
152 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, ror #24
153 ; CHECK-NO-DSP-NEXT: bx lr
154 %tmp1 = lshr i32 %x, 24 ; <i32> [#uses=1]
155 %tmp4 = shl i32 %x, 8 ; <i32> [#uses=1]
156 %tmp5 = and i32 %tmp4, 16711680 ; <i32> [#uses=1]
157 %tmp6 = or i32 %tmp5, %tmp1 ; <i32> [#uses=1]
161 define i32 @test10(i32 %p0) {
162 ; CHECK-DSP-LABEL: test10:
163 ; CHECK-DSP: @ %bb.0:
164 ; CHECK-DSP-NEXT: mov.w r1, #16253176
165 ; CHECK-DSP-NEXT: and.w r0, r1, r0, lsr #7
166 ; CHECK-DSP-NEXT: lsrs r1, r0, #5
167 ; CHECK-DSP-NEXT: uxtb16 r1, r1
168 ; CHECK-DSP-NEXT: add r0, r1
169 ; CHECK-DSP-NEXT: bx lr
171 ; CHECK-NO-DSP-LABEL: test10:
172 ; CHECK-NO-DSP: @ %bb.0:
173 ; CHECK-NO-DSP-NEXT: mov.w r1, #16253176
174 ; CHECK-NO-DSP-NEXT: and.w r0, r1, r0, lsr #7
175 ; CHECK-NO-DSP-NEXT: mov.w r1, #458759
176 ; CHECK-NO-DSP-NEXT: and.w r1, r1, r0, lsr #5
177 ; CHECK-NO-DSP-NEXT: add r0, r1
178 ; CHECK-NO-DSP-NEXT: bx lr
180 %tmp1 = lshr i32 %p0, 7 ; <i32> [#uses=1]
181 %tmp2 = and i32 %tmp1, 16253176 ; <i32> [#uses=2]
182 %tmp4 = lshr i32 %tmp2, 5 ; <i32> [#uses=1]
183 %tmp5 = and i32 %tmp4, 458759 ; <i32> [#uses=1]
184 %tmp7 = or i32 %tmp5, %tmp2 ; <i32> [#uses=1]