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