1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
5 define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind {
8 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
9 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
10 ; X32-NEXT: rolw %cl, %ax
15 ; X64-NEXT: movl %edx, %ecx
16 ; X64-NEXT: movl %edi, %eax
17 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
18 ; X64-NEXT: rolw %cl, %ax
19 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
23 %t2 = lshr i16 %x, %t1
28 define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind {
31 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx
32 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
33 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
34 ; X32-NEXT: andb $15, %cl
35 ; X32-NEXT: shldw %cl, %dx, %ax
40 ; X64-NEXT: movl %edx, %ecx
41 ; X64-NEXT: movl %esi, %eax
42 ; X64-NEXT: andb $15, %cl
43 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
44 ; X64-NEXT: shldw %cl, %di, %ax
45 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
49 %t2 = lshr i16 %x, %t1
54 define i16 @un(i16 %x, i16 %y, i16 %z) nounwind {
57 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
58 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
59 ; X32-NEXT: rorw %cl, %ax
64 ; X64-NEXT: movl %edx, %ecx
65 ; X64-NEXT: movl %edi, %eax
66 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
67 ; X64-NEXT: rorw %cl, %ax
68 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
77 define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind {
80 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %edx
81 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
82 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
83 ; X32-NEXT: andb $15, %cl
84 ; X32-NEXT: shrdw %cl, %dx, %ax
89 ; X64-NEXT: movl %edx, %ecx
90 ; X64-NEXT: movl %esi, %eax
91 ; X64-NEXT: andb $15, %cl
92 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
93 ; X64-NEXT: shrdw %cl, %di, %ax
94 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
103 define i16 @xfoo(i16 %x, i16 %y, i16 %z) nounwind {
106 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
107 ; X32-NEXT: rolw $5, %ax
112 ; X64-NEXT: movl %edi, %eax
113 ; X64-NEXT: rolw $5, %ax
114 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
116 %t0 = lshr i16 %x, 11
118 %t2 = or i16 %t0, %t1
122 define i16 @xbar(i16 %x, i16 %y, i16 %z) nounwind {
125 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
126 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
127 ; X32-NEXT: shldw $5, %cx, %ax
132 ; X64-NEXT: movl %esi, %eax
133 ; X64-NEXT: shldw $5, %di, %ax
134 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
137 %t1 = lshr i16 %x, 11
138 %t2 = or i16 %t0, %t1
142 define i16 @xun(i16 %x, i16 %y, i16 %z) nounwind {
145 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
146 ; X32-NEXT: rolw $11, %ax
151 ; X64-NEXT: movl %edi, %eax
152 ; X64-NEXT: rolw $11, %ax
153 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
157 %t2 = or i16 %t0, %t1
161 define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind {
164 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
165 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
166 ; X32-NEXT: shldw $11, %cx, %ax
171 ; X64-NEXT: movl %edi, %eax
172 ; X64-NEXT: shldw $11, %si, %ax
173 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
177 %t2 = or i16 %t0, %t1
181 define i32 @rot16_demandedbits(i32 %x, i32 %y) nounwind {
182 ; X32-LABEL: rot16_demandedbits:
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: movzwl %ax, %eax
192 ; X64-LABEL: rot16_demandedbits:
194 ; X64-NEXT: movl %edi, %eax
195 ; X64-NEXT: shrl $11, %eax
196 ; X64-NEXT: shll $5, %edi
197 ; X64-NEXT: orl %eax, %edi
198 ; X64-NEXT: movzwl %di, %eax
200 %t0 = lshr i32 %x, 11
202 %t2 = or i32 %t0, %t1
203 %t3 = and i32 %t2, 65535
207 define i16 @rot16_trunc(i32 %x, i32 %y) nounwind {
208 ; X32-LABEL: rot16_trunc:
210 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
211 ; X32-NEXT: movl %eax, %ecx
212 ; X32-NEXT: shrl $11, %ecx
213 ; X32-NEXT: shll $5, %eax
214 ; X32-NEXT: orl %ecx, %eax
215 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
218 ; X64-LABEL: rot16_trunc:
220 ; X64-NEXT: movl %edi, %eax
221 ; X64-NEXT: movl %edi, %ecx
222 ; X64-NEXT: shrl $11, %ecx
223 ; X64-NEXT: shll $5, %eax
224 ; X64-NEXT: orl %ecx, %eax
225 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
227 %t0 = lshr i32 %x, 11
229 %t2 = or i32 %t0, %t1
230 %t3 = trunc i32 %t2 to i16