@@ -177,3 +177,57 @@ define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind {
177
177
%t2 = or i16 %t0 , %t1
178
178
ret i16 %t2
179
179
}
180
+
181
+ define i32 @rot16_demandedbits (i32 %x , i32 %y ) nounwind {
182
+ ; X32-LABEL: rot16_demandedbits:
183
+ ; X32: # %bb.0:
184
+ ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
185
+ ; X32-NEXT: movl %eax, %ecx
186
+ ; X32-NEXT: shrl $11, %ecx
187
+ ; X32-NEXT: shll $5, %eax
188
+ ; X32-NEXT: orl %ecx, %eax
189
+ ; X32-NEXT: andl $65536, %eax # imm = 0x10000
190
+ ; X32-NEXT: retl
191
+ ;
192
+ ; X64-LABEL: rot16_demandedbits:
193
+ ; X64: # %bb.0:
194
+ ; X64-NEXT: movl %edi, %eax
195
+ ; X64-NEXT: movl %edi, %ecx
196
+ ; X64-NEXT: shrl $11, %ecx
197
+ ; X64-NEXT: shll $5, %eax
198
+ ; X64-NEXT: orl %ecx, %eax
199
+ ; X64-NEXT: andl $65536, %eax # imm = 0x10000
200
+ ; X64-NEXT: retq
201
+ %t0 = lshr i32 %x , 11
202
+ %t1 = shl i32 %x , 5
203
+ %t2 = or i32 %t0 , %t1
204
+ %t3 = and i32 %t2 , 65536
205
+ ret i32 %t3
206
+ }
207
+
208
+ define i16 @rot16_trunc (i32 %x , i32 %y ) nounwind {
209
+ ; X32-LABEL: rot16_trunc:
210
+ ; X32: # %bb.0:
211
+ ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
212
+ ; X32-NEXT: movl %eax, %ecx
213
+ ; X32-NEXT: shrl $11, %ecx
214
+ ; X32-NEXT: shll $5, %eax
215
+ ; X32-NEXT: orl %ecx, %eax
216
+ ; X32-NEXT: # kill: def $ax killed $ax killed $eax
217
+ ; X32-NEXT: retl
218
+ ;
219
+ ; X64-LABEL: rot16_trunc:
220
+ ; X64: # %bb.0:
221
+ ; X64-NEXT: movl %edi, %eax
222
+ ; X64-NEXT: movl %edi, %ecx
223
+ ; X64-NEXT: shrl $11, %ecx
224
+ ; X64-NEXT: shll $5, %eax
225
+ ; X64-NEXT: orl %ecx, %eax
226
+ ; X64-NEXT: # kill: def $ax killed $ax killed $eax
227
+ ; X64-NEXT: retq
228
+ %t0 = lshr i32 %x , 11
229
+ %t1 = shl i32 %x , 5
230
+ %t2 = or i32 %t0 , %t1
231
+ %t3 = trunc i32 %t2 to i16
232
+ ret i16 %t3
233
+ }
0 commit comments