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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
| # RUN: llvm-mc -triple=hexagon -disassemble < %s | FileCheck %s
# Hexagon Programmer's Reference Manual 11.10.8 XTYPE/SHIFT
# Shift by immediate
0x10 0xdf 0x14 0x80
# CHECK: r17:16 = asr(r21:20,#31)
0x30 0xdf 0x14 0x80
# CHECK: r17:16 = lsr(r21:20,#31)
0x50 0xdf 0x14 0x80
# CHECK: r17:16 = asl(r21:20,#31)
0x11 0xdf 0x15 0x8c
# CHECK: r17 = asr(r21,#31)
0x31 0xdf 0x15 0x8c
# CHECK: r17 = lsr(r21,#31)
0x51 0xdf 0x15 0x8c
# CHECK: r17 = asl(r21,#31)
# Shift by immediate and accumulate
0x10 0xdf 0x14 0x82
# CHECK: r17:16 -= asr(r21:20,#31)
0x30 0xdf 0x14 0x82
# CHECK: r17:16 -= lsr(r21:20,#31)
0x50 0xdf 0x14 0x82
# CHECK: r17:16 -= asl(r21:20,#31)
0x90 0xdf 0x14 0x82
# CHECK: r17:16 += asr(r21:20,#31)
0xb0 0xdf 0x14 0x82
# CHECK: r17:16 += lsr(r21:20,#31)
0xd0 0xdf 0x14 0x82
# CHECK: r17:16 += asl(r21:20,#31)
0x11 0xdf 0x15 0x8e
# CHECK: r17 -= asr(r21,#31)
0x31 0xdf 0x15 0x8e
# CHECK: r17 -= lsr(r21,#31)
0x51 0xdf 0x15 0x8e
# CHECK: r17 -= asl(r21,#31)
0x91 0xdf 0x15 0x8e
# CHECK: r17 += asr(r21,#31)
0xb1 0xdf 0x15 0x8e
# CHECK: r17 += lsr(r21,#31)
0xd1 0xdf 0x15 0x8e
# CHECK: r17 += asl(r21,#31)
0x4c 0xf7 0x11 0xde
# CHECK: r17 = add(#21,asl(r17,#23))
0x4e 0xf7 0x11 0xde
# CHECK: r17 = sub(#21,asl(r17,#23))
0x5c 0xf7 0x11 0xde
# CHECK: r17 = add(#21,lsr(r17,#23))
0x5e 0xf7 0x11 0xde
# CHECK: r17 = sub(#21,lsr(r17,#23))
# Shift by immediate and add
0xf1 0xd5 0x1f 0xc4
# CHECK: r17 = addasl(r21,r31,#7)
# Shift by immediate and logical
0x10 0xdf 0x54 0x82
# CHECK: r17:16 &= asr(r21:20,#31)
0x30 0xdf 0x54 0x82
# CHECK: r17:16 &= lsr(r21:20,#31)
0x50 0xdf 0x54 0x82
# CHECK: r17:16 &= asl(r21:20,#31)
0x90 0xdf 0x54 0x82
# CHECK: r17:16 |= asr(r21:20,#31)
0xb0 0xdf 0x54 0x82
# CHECK: r17:16 |= lsr(r21:20,#31)
0xd0 0xdf 0x54 0x82
# CHECK: r17:16 |= asl(r21:20,#31)
0x30 0xdf 0x94 0x82
# CHECK: r17:16 ^= lsr(r21:20,#31)
0x50 0xdf 0x94 0x82
# CHECK: r17:16 ^= asl(r21:20,#31)
0x11 0xdf 0x55 0x8e
# CHECK: r17 &= asr(r21,#31)
0x31 0xdf 0x55 0x8e
# CHECK: r17 &= lsr(r21,#31)
0x51 0xdf 0x55 0x8e
# CHECK: r17 &= asl(r21,#31)
0x91 0xdf 0x55 0x8e
# CHECK: r17 |= asr(r21,#31)
0xb1 0xdf 0x55 0x8e
# CHECK: r17 |= lsr(r21,#31)
0xd1 0xdf 0x55 0x8e
# CHECK: r17 |= asl(r21,#31)
0x31 0xdf 0x95 0x8e
# CHECK: r17 ^= lsr(r21,#31)
0x51 0xdf 0x95 0x8e
# CHECK: r17 ^= asl(r21,#31)
0x48 0xff 0x11 0xde
# CHECK: r17 = and(#21,asl(r17,#31))
0x4a 0xff 0x11 0xde
# CHECK: r17 = or(#21,asl(r17,#31))
0x58 0xff 0x11 0xde
# CHECK: r17 = and(#21,lsr(r17,#31))
0x5a 0xff 0x11 0xde
# CHECK: r17 = or(#21,lsr(r17,#31))
# Shift right by immediate with rounding
0xf0 0xdf 0xd4 0x80
# CHECK: r17:16 = asr(r21:20,#31):rnd
0x11 0xdf 0x55 0x8c
# CHECK: r17 = asr(r21,#31):rnd
# Shift left by immediate with saturation
0x51 0xdf 0x55 0x8c
# CHECK: r17 = asl(r21,#31):sat
# Shift by register
0x10 0xdf 0x94 0xc3
# CHECK: r17:16 = asr(r21:20,r31)
0x50 0xdf 0x94 0xc3
# CHECK: r17:16 = lsr(r21:20,r31)
0x90 0xdf 0x94 0xc3
# CHECK: r17:16 = asl(r21:20,r31)
0xd0 0xdf 0x94 0xc3
# CHECK: r17:16 = lsl(r21:20,r31)
0x11 0xdf 0x55 0xc6
# CHECK: r17 = asr(r21,r31)
0x51 0xdf 0x55 0xc6
# CHECK: r17 = lsr(r21,r31)
0x91 0xdf 0x55 0xc6
# CHECK: r17 = asl(r21,r31)
0xd1 0xdf 0x55 0xc6
# CHECK: r17 = lsl(r21,r31)
0xf1 0xdf 0x8a 0xc6
# CHECK: r17 = lsl(#21,r31)
# Shift by register and accumulate
0x10 0xdf 0x94 0xcb
# CHECK: r17:16 -= asr(r21:20,r31)
0x50 0xdf 0x94 0xcb
# CHECK: r17:16 -= lsr(r21:20,r31)
0x90 0xdf 0x94 0xcb
# CHECK: r17:16 -= asl(r21:20,r31)
0xd0 0xdf 0x94 0xcb
# CHECK: r17:16 -= lsl(r21:20,r31)
0x10 0xdf 0xd4 0xcb
# CHECK: r17:16 += asr(r21:20,r31)
0x50 0xdf 0xd4 0xcb
# CHECK: r17:16 += lsr(r21:20,r31)
0x90 0xdf 0xd4 0xcb
# CHECK: r17:16 += asl(r21:20,r31)
0xd0 0xdf 0xd4 0xcb
# CHECK: r17:16 += lsl(r21:20,r31)
0x11 0xdf 0x95 0xcc
# CHECK: r17 -= asr(r21,r31)
0x51 0xdf 0x95 0xcc
# CHECK: r17 -= lsr(r21,r31)
0x91 0xdf 0x95 0xcc
# CHECK: r17 -= asl(r21,r31)
0xd1 0xdf 0x95 0xcc
# CHECK: r17 -= lsl(r21,r31)
0x11 0xdf 0xd5 0xcc
# CHECK: r17 += asr(r21,r31)
0x51 0xdf 0xd5 0xcc
# CHECK: r17 += lsr(r21,r31)
0x91 0xdf 0xd5 0xcc
# CHECK: r17 += asl(r21,r31)
0xd1 0xdf 0xd5 0xcc
# CHECK: r17 += lsl(r21,r31)
# Shift by register and logical
0x10 0xdf 0x14 0xcb
# CHECK: r17:16 |= asr(r21:20,r31)
0x50 0xdf 0x14 0xcb
# CHECK: r17:16 |= lsr(r21:20,r31)
0x90 0xdf 0x14 0xcb
# CHECK: r17:16 |= asl(r21:20,r31)
0xd0 0xdf 0x14 0xcb
# CHECK: r17:16 |= lsl(r21:20,r31)
0x10 0xdf 0x54 0xcb
# CHECK: r17:16 &= asr(r21:20,r31)
0x50 0xdf 0x54 0xcb
# CHECK: r17:16 &= lsr(r21:20,r31)
0x90 0xdf 0x54 0xcb
# CHECK: r17:16 &= asl(r21:20,r31)
0xd0 0xdf 0x54 0xcb
# CHECK: r17:16 &= lsl(r21:20,r31)
0x10 0xdf 0x74 0xcb
# CHECK: r17:16 ^= asr(r21:20,r31)
0x50 0xdf 0x74 0xcb
# CHECK: r17:16 ^= lsr(r21:20,r31)
0x90 0xdf 0x74 0xcb
# CHECK: r17:16 ^= asl(r21:20,r31)
0xd0 0xdf 0x74 0xcb
# CHECK: r17:16 ^= lsl(r21:20,r31)
0x11 0xdf 0x15 0xcc
# CHECK: r17 |= asr(r21,r31)
0x51 0xdf 0x15 0xcc
# CHECK: r17 |= lsr(r21,r31)
0x91 0xdf 0x15 0xcc
# CHECK: r17 |= asl(r21,r31)
0xd1 0xdf 0x15 0xcc
# CHECK: r17 |= lsl(r21,r31)
0x11 0xdf 0x55 0xcc
# CHECK: r17 &= asr(r21,r31)
0x51 0xdf 0x55 0xcc
# CHECK: r17 &= lsr(r21,r31)
0x91 0xdf 0x55 0xcc
# CHECK: r17 &= asl(r21,r31)
0xd1 0xdf 0x55 0xcc
# CHECK: r17 &= lsl(r21,r31)
# Shift by register with saturation
0x11 0xdf 0x15 0xc6
# CHECK: r17 = asr(r21,r31):sat
0x91 0xdf 0x15 0xc6
# CHECK: r17 = asl(r21,r31):sat
# Vector shift halfwords by immediate
0x10 0xc5 0x94 0x80
# CHECK: r17:16 = vasrh(r21:20,#5)
0x30 0xc5 0x94 0x80
# CHECK: r17:16 = vlsrh(r21:20,#5)
0x50 0xc5 0x94 0x80
# CHECK: r17:16 = vaslh(r21:20,#5)
# Vector arithmetic shift halfwords with round
0x10 0xc5 0x34 0x80
# CHECK: r17:16 = vasrh(r21:20,#5):raw
# Vector arithmetic shift halfwords with saturate and pack
0x91 0xc5 0x74 0x88
# CHECK: r17 = vasrhub(r21:20,#5):raw
0xb1 0xc5 0x74 0x88
# CHECK: r17 = vasrhub(r21:20,#5):sat
# Vector shift halfwords by register
0x10 0xdf 0x54 0xc3
# CHECK: r17:16 = vasrh(r21:20,r31)
0x50 0xdf 0x54 0xc3
# CHECK: r17:16 = vlsrh(r21:20,r31)
0x90 0xdf 0x54 0xc3
# CHECK: r17:16 = vaslh(r21:20,r31)
0xd0 0xdf 0x54 0xc3
# CHECK: r17:16 = vlslh(r21:20,r31)
# Vector shift words by immediate
0x10 0xdf 0x54 0x80
# CHECK: r17:16 = vasrw(r21:20,#31)
0x30 0xdf 0x54 0x80
# CHECK: r17:16 = vlsrw(r21:20,#31)
0x50 0xdf 0x54 0x80
# CHECK: r17:16 = vaslw(r21:20,#31)
# Vector shift words by register
0x10 0xdf 0x14 0xc3
# CHECK: r17:16 = vasrw(r21:20,r31)
0x50 0xdf 0x14 0xc3
# CHECK: r17:16 = vlsrw(r21:20,r31)
0x90 0xdf 0x14 0xc3
# CHECK: r17:16 = vaslw(r21:20,r31)
0xd0 0xdf 0x14 0xc3
# CHECK: r17:16 = vlslw(r21:20,r31)
# Vector shift words with truncate and pack
0x51 0xdf 0xd4 0x88
# CHECK: r17 = vasrw(r21:20,#31)
0x51 0xdf 0x14 0xc5
# CHECK: r17 = vasrw(r21:20,r31)
|