xref: /llvm-project/llvm/test/CodeGen/X86/shift-i128.ll (revision 3e0a76b1fd10d2f5f36d34a91b525c1d29685185)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefixes=ALL,i686
3; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=ALL,x86_64
4
5;
6; Scalars
7;
8
9define void @test_lshr_i128(i128 %x, i128 %a, ptr nocapture %r) nounwind {
10; i686-LABEL: test_lshr_i128:
11; i686:       # %bb.0: # %entry
12; i686-NEXT:    pushl %ebp
13; i686-NEXT:    movl %esp, %ebp
14; i686-NEXT:    pushl %ebx
15; i686-NEXT:    pushl %edi
16; i686-NEXT:    pushl %esi
17; i686-NEXT:    andl $-16, %esp
18; i686-NEXT:    subl $48, %esp
19; i686-NEXT:    movl 24(%ebp), %ecx
20; i686-NEXT:    movl 8(%ebp), %eax
21; i686-NEXT:    movl 12(%ebp), %edx
22; i686-NEXT:    movl 16(%ebp), %esi
23; i686-NEXT:    movl 20(%ebp), %edi
24; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
25; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
26; i686-NEXT:    movl %edx, {{[0-9]+}}(%esp)
27; i686-NEXT:    movl %eax, (%esp)
28; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
29; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
30; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
31; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
32; i686-NEXT:    movl %ecx, %eax
33; i686-NEXT:    shrb $3, %al
34; i686-NEXT:    andb $12, %al
35; i686-NEXT:    movzbl %al, %edi
36; i686-NEXT:    movl 8(%esp,%edi), %eax
37; i686-NEXT:    movl 4(%esp,%edi), %ebx
38; i686-NEXT:    movl %ebx, %edx
39; i686-NEXT:    shrdl %cl, %eax, %edx
40; i686-NEXT:    movl (%esp,%edi), %esi
41; i686-NEXT:    movl 12(%esp,%edi), %edi
42; i686-NEXT:    shrdl %cl, %edi, %eax
43; i686-NEXT:    shrdl %cl, %ebx, %esi
44; i686-NEXT:    movl 40(%ebp), %ebx
45; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
46; i686-NEXT:    shrl %cl, %edi
47; i686-NEXT:    movl %edi, 12(%ebx)
48; i686-NEXT:    movl %eax, 8(%ebx)
49; i686-NEXT:    movl %edx, 4(%ebx)
50; i686-NEXT:    movl %esi, (%ebx)
51; i686-NEXT:    leal -12(%ebp), %esp
52; i686-NEXT:    popl %esi
53; i686-NEXT:    popl %edi
54; i686-NEXT:    popl %ebx
55; i686-NEXT:    popl %ebp
56; i686-NEXT:    retl
57;
58; x86_64-LABEL: test_lshr_i128:
59; x86_64:       # %bb.0: # %entry
60; x86_64-NEXT:    movq %rdx, %rcx
61; x86_64-NEXT:    shrdq %cl, %rsi, %rdi
62; x86_64-NEXT:    shrq %cl, %rsi
63; x86_64-NEXT:    xorl %eax, %eax
64; x86_64-NEXT:    testb $64, %cl
65; x86_64-NEXT:    cmovneq %rsi, %rdi
66; x86_64-NEXT:    cmoveq %rsi, %rax
67; x86_64-NEXT:    movq %rax, 8(%r8)
68; x86_64-NEXT:    movq %rdi, (%r8)
69; x86_64-NEXT:    retq
70entry:
71	%0 = lshr i128 %x, %a
72	store i128 %0, ptr %r, align 16
73	ret void
74}
75
76define void @test_ashr_i128(i128 %x, i128 %a, ptr nocapture %r) nounwind {
77; i686-LABEL: test_ashr_i128:
78; i686:       # %bb.0: # %entry
79; i686-NEXT:    pushl %ebp
80; i686-NEXT:    movl %esp, %ebp
81; i686-NEXT:    pushl %ebx
82; i686-NEXT:    pushl %edi
83; i686-NEXT:    pushl %esi
84; i686-NEXT:    andl $-16, %esp
85; i686-NEXT:    subl $48, %esp
86; i686-NEXT:    movl 24(%ebp), %ecx
87; i686-NEXT:    movl 8(%ebp), %eax
88; i686-NEXT:    movl 12(%ebp), %edx
89; i686-NEXT:    movl 16(%ebp), %esi
90; i686-NEXT:    movl 20(%ebp), %edi
91; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
92; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
93; i686-NEXT:    movl %edx, {{[0-9]+}}(%esp)
94; i686-NEXT:    movl %eax, (%esp)
95; i686-NEXT:    sarl $31, %edi
96; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
97; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
98; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
99; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
100; i686-NEXT:    movl %ecx, %eax
101; i686-NEXT:    shrb $3, %al
102; i686-NEXT:    andb $12, %al
103; i686-NEXT:    movzbl %al, %edi
104; i686-NEXT:    movl 8(%esp,%edi), %eax
105; i686-NEXT:    movl 4(%esp,%edi), %ebx
106; i686-NEXT:    movl %ebx, %edx
107; i686-NEXT:    shrdl %cl, %eax, %edx
108; i686-NEXT:    movl (%esp,%edi), %esi
109; i686-NEXT:    movl 12(%esp,%edi), %edi
110; i686-NEXT:    shrdl %cl, %edi, %eax
111; i686-NEXT:    shrdl %cl, %ebx, %esi
112; i686-NEXT:    movl 40(%ebp), %ebx
113; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
114; i686-NEXT:    sarl %cl, %edi
115; i686-NEXT:    movl %edi, 12(%ebx)
116; i686-NEXT:    movl %eax, 8(%ebx)
117; i686-NEXT:    movl %edx, 4(%ebx)
118; i686-NEXT:    movl %esi, (%ebx)
119; i686-NEXT:    leal -12(%ebp), %esp
120; i686-NEXT:    popl %esi
121; i686-NEXT:    popl %edi
122; i686-NEXT:    popl %ebx
123; i686-NEXT:    popl %ebp
124; i686-NEXT:    retl
125;
126; x86_64-LABEL: test_ashr_i128:
127; x86_64:       # %bb.0: # %entry
128; x86_64-NEXT:    movq %rdx, %rcx
129; x86_64-NEXT:    shrdq %cl, %rsi, %rdi
130; x86_64-NEXT:    movq %rsi, %rax
131; x86_64-NEXT:    sarq %cl, %rax
132; x86_64-NEXT:    sarq $63, %rsi
133; x86_64-NEXT:    testb $64, %cl
134; x86_64-NEXT:    cmovneq %rax, %rdi
135; x86_64-NEXT:    cmoveq %rax, %rsi
136; x86_64-NEXT:    movq %rsi, 8(%r8)
137; x86_64-NEXT:    movq %rdi, (%r8)
138; x86_64-NEXT:    retq
139entry:
140	%0 = ashr i128 %x, %a
141	store i128 %0, ptr %r, align 16
142	ret void
143}
144
145define void @test_shl_i128(i128 %x, i128 %a, ptr nocapture %r) nounwind {
146; i686-LABEL: test_shl_i128:
147; i686:       # %bb.0: # %entry
148; i686-NEXT:    pushl %ebp
149; i686-NEXT:    movl %esp, %ebp
150; i686-NEXT:    pushl %ebx
151; i686-NEXT:    pushl %edi
152; i686-NEXT:    pushl %esi
153; i686-NEXT:    andl $-16, %esp
154; i686-NEXT:    subl $48, %esp
155; i686-NEXT:    movl 24(%ebp), %ecx
156; i686-NEXT:    movl 8(%ebp), %eax
157; i686-NEXT:    movl 12(%ebp), %edx
158; i686-NEXT:    movl 16(%ebp), %esi
159; i686-NEXT:    movl 20(%ebp), %edi
160; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
161; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
162; i686-NEXT:    movl %edx, {{[0-9]+}}(%esp)
163; i686-NEXT:    movl %eax, {{[0-9]+}}(%esp)
164; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
165; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
166; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
167; i686-NEXT:    movl $0, (%esp)
168; i686-NEXT:    movl %ecx, %eax
169; i686-NEXT:    shrb $3, %al
170; i686-NEXT:    andb $12, %al
171; i686-NEXT:    negb %al
172; i686-NEXT:    movsbl %al, %edi
173; i686-NEXT:    movl 20(%esp,%edi), %eax
174; i686-NEXT:    movl 24(%esp,%edi), %ebx
175; i686-NEXT:    movl %ebx, %esi
176; i686-NEXT:    shldl %cl, %eax, %esi
177; i686-NEXT:    movl 16(%esp,%edi), %edx
178; i686-NEXT:    movl 28(%esp,%edi), %edi
179; i686-NEXT:    shldl %cl, %ebx, %edi
180; i686-NEXT:    movl 40(%ebp), %ebx
181; i686-NEXT:    movl %edi, 12(%ebx)
182; i686-NEXT:    movl %esi, 8(%ebx)
183; i686-NEXT:    movl %edx, %esi
184; i686-NEXT:    shll %cl, %esi
185; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
186; i686-NEXT:    shldl %cl, %edx, %eax
187; i686-NEXT:    movl %eax, 4(%ebx)
188; i686-NEXT:    movl %esi, (%ebx)
189; i686-NEXT:    leal -12(%ebp), %esp
190; i686-NEXT:    popl %esi
191; i686-NEXT:    popl %edi
192; i686-NEXT:    popl %ebx
193; i686-NEXT:    popl %ebp
194; i686-NEXT:    retl
195;
196; x86_64-LABEL: test_shl_i128:
197; x86_64:       # %bb.0: # %entry
198; x86_64-NEXT:    movq %rdx, %rcx
199; x86_64-NEXT:    shldq %cl, %rdi, %rsi
200; x86_64-NEXT:    shlq %cl, %rdi
201; x86_64-NEXT:    xorl %eax, %eax
202; x86_64-NEXT:    testb $64, %cl
203; x86_64-NEXT:    cmovneq %rdi, %rsi
204; x86_64-NEXT:    cmoveq %rdi, %rax
205; x86_64-NEXT:    movq %rsi, 8(%r8)
206; x86_64-NEXT:    movq %rax, (%r8)
207; x86_64-NEXT:    retq
208entry:
209	%0 = shl i128 %x, %a
210	store i128 %0, ptr %r, align 16
211	ret void
212}
213
214define void @test_lshr_i128_outofrange(i128 %x, ptr nocapture %r) nounwind {
215; ALL-LABEL: test_lshr_i128_outofrange:
216; ALL:       # %bb.0: # %entry
217; ALL-NEXT:    ret{{[l|q]}}
218entry:
219	%0 = lshr i128 %x, -1
220	store i128 %0, ptr %r, align 16
221	ret void
222}
223
224define void @test_ashr_i128_outofrange(i128 %x, ptr nocapture %r) nounwind {
225; ALL-LABEL: test_ashr_i128_outofrange:
226; ALL:       # %bb.0: # %entry
227; ALL-NEXT:    ret{{[l|q]}}
228entry:
229	%0 = ashr i128 %x, -1
230	store i128 %0, ptr %r, align 16
231	ret void
232}
233
234define void @test_shl_i128_outofrange(i128 %x, ptr nocapture %r) nounwind {
235; ALL-LABEL: test_shl_i128_outofrange:
236; ALL:       # %bb.0: # %entry
237; ALL-NEXT:    ret{{[l|q]}}
238entry:
239	%0 = shl i128 %x, -1
240	store i128 %0, ptr %r, align 16
241	ret void
242}
243
244;
245; Vectors
246;
247
248define void @test_lshr_v2i128(<2 x i128> %x, <2 x i128> %a, ptr nocapture %r) nounwind {
249; i686-LABEL: test_lshr_v2i128:
250; i686:       # %bb.0: # %entry
251; i686-NEXT:    pushl %ebp
252; i686-NEXT:    movl %esp, %ebp
253; i686-NEXT:    pushl %ebx
254; i686-NEXT:    pushl %edi
255; i686-NEXT:    pushl %esi
256; i686-NEXT:    andl $-16, %esp
257; i686-NEXT:    subl $112, %esp
258; i686-NEXT:    movl 40(%ebp), %edx
259; i686-NEXT:    movl 24(%ebp), %eax
260; i686-NEXT:    movl 28(%ebp), %ecx
261; i686-NEXT:    movl 32(%ebp), %esi
262; i686-NEXT:    movl 20(%ebp), %edi
263; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
264; i686-NEXT:    movl 16(%ebp), %edi
265; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
266; i686-NEXT:    movl 12(%ebp), %edi
267; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
268; i686-NEXT:    movl 8(%ebp), %edi
269; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
270; i686-NEXT:    movl 36(%ebp), %edi
271; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
272; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
273; i686-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
274; i686-NEXT:    movl %eax, {{[0-9]+}}(%esp)
275; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
276; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
277; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
278; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
279; i686-NEXT:    movl %edx, %ebx
280; i686-NEXT:    andl $31, %ebx
281; i686-NEXT:    shrl $3, %edx
282; i686-NEXT:    andl $12, %edx
283; i686-NEXT:    movl 40(%esp,%edx), %eax
284; i686-NEXT:    movl 36(%esp,%edx), %esi
285; i686-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
286; i686-NEXT:    movl %ebx, %ecx
287; i686-NEXT:    shrdl %cl, %eax, %esi
288; i686-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
289; i686-NEXT:    movl 32(%esp,%edx), %ecx
290; i686-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
291; i686-NEXT:    movl 44(%esp,%edx), %edx
292; i686-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
293; i686-NEXT:    movl %ebx, %ecx
294; i686-NEXT:    movl %ebx, %esi
295; i686-NEXT:    shrdl %cl, %edx, %eax
296; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
297; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
298; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
299; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
300; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
301; i686-NEXT:    movl 56(%ebp), %edx
302; i686-NEXT:    movl %edx, %eax
303; i686-NEXT:    andl $31, %eax
304; i686-NEXT:    shrl $3, %edx
305; i686-NEXT:    andl $12, %edx
306; i686-NEXT:    movl 72(%esp,%edx), %ebx
307; i686-NEXT:    movl 68(%esp,%edx), %edi
308; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
309; i686-NEXT:    movl %eax, %ecx
310; i686-NEXT:    shrdl %cl, %ebx, %edi
311; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
312; i686-NEXT:    movl 64(%esp,%edx), %edi
313; i686-NEXT:    movl 76(%esp,%edx), %edx
314; i686-NEXT:    shrdl %cl, %edx, %ebx
315; i686-NEXT:    movl %esi, %ecx
316; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
317; i686-NEXT:    shrdl %cl, %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
318; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
319; i686-NEXT:    shrl %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
320; i686-NEXT:    movl %eax, %ecx
321; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
322; i686-NEXT:    shrdl %cl, %esi, %edi
323; i686-NEXT:    shrl %cl, %edx
324; i686-NEXT:    movl 72(%ebp), %eax
325; i686-NEXT:    movl %edx, 28(%eax)
326; i686-NEXT:    movl %ebx, 24(%eax)
327; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
328; i686-NEXT:    movl %ecx, 20(%eax)
329; i686-NEXT:    movl %edi, 16(%eax)
330; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
331; i686-NEXT:    movl %ecx, 12(%eax)
332; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
333; i686-NEXT:    movl %ecx, 8(%eax)
334; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
335; i686-NEXT:    movl %ecx, 4(%eax)
336; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
337; i686-NEXT:    movl %ecx, (%eax)
338; i686-NEXT:    leal -12(%ebp), %esp
339; i686-NEXT:    popl %esi
340; i686-NEXT:    popl %edi
341; i686-NEXT:    popl %ebx
342; i686-NEXT:    popl %ebp
343; i686-NEXT:    retl
344;
345; x86_64-LABEL: test_lshr_v2i128:
346; x86_64:       # %bb.0: # %entry
347; x86_64-NEXT:    movq %rcx, %rax
348; x86_64-NEXT:    movq {{[0-9]+}}(%rsp), %r10
349; x86_64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r9d
350; x86_64-NEXT:    movl %r9d, %ecx
351; x86_64-NEXT:    shrdq %cl, %rax, %rdx
352; x86_64-NEXT:    movl %r8d, %ecx
353; x86_64-NEXT:    shrdq %cl, %rsi, %rdi
354; x86_64-NEXT:    shrq %cl, %rsi
355; x86_64-NEXT:    xorl %r11d, %r11d
356; x86_64-NEXT:    testb $64, %r8b
357; x86_64-NEXT:    cmovneq %rsi, %rdi
358; x86_64-NEXT:    cmovneq %r11, %rsi
359; x86_64-NEXT:    movl %r9d, %ecx
360; x86_64-NEXT:    shrq %cl, %rax
361; x86_64-NEXT:    testb $64, %r9b
362; x86_64-NEXT:    cmovneq %rax, %rdx
363; x86_64-NEXT:    cmovneq %r11, %rax
364; x86_64-NEXT:    movq %rax, 24(%r10)
365; x86_64-NEXT:    movq %rdx, 16(%r10)
366; x86_64-NEXT:    movq %rsi, 8(%r10)
367; x86_64-NEXT:    movq %rdi, (%r10)
368; x86_64-NEXT:    retq
369entry:
370	%0 = lshr <2 x i128> %x, %a
371	store <2 x i128> %0, ptr %r, align 16
372	ret void
373}
374
375define void @test_ashr_v2i128(<2 x i128> %x, <2 x i128> %a, ptr nocapture %r) nounwind {
376; i686-LABEL: test_ashr_v2i128:
377; i686:       # %bb.0: # %entry
378; i686-NEXT:    pushl %ebp
379; i686-NEXT:    movl %esp, %ebp
380; i686-NEXT:    pushl %ebx
381; i686-NEXT:    pushl %edi
382; i686-NEXT:    pushl %esi
383; i686-NEXT:    andl $-16, %esp
384; i686-NEXT:    subl $112, %esp
385; i686-NEXT:    movl 40(%ebp), %edx
386; i686-NEXT:    movl 24(%ebp), %eax
387; i686-NEXT:    movl 28(%ebp), %ecx
388; i686-NEXT:    movl 32(%ebp), %esi
389; i686-NEXT:    movl 16(%ebp), %edi
390; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
391; i686-NEXT:    movl 12(%ebp), %edi
392; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
393; i686-NEXT:    movl 8(%ebp), %edi
394; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
395; i686-NEXT:    movl 20(%ebp), %edi
396; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
397; i686-NEXT:    sarl $31, %edi
398; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
399; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
400; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
401; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
402; i686-NEXT:    movl 36(%ebp), %edi
403; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
404; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
405; i686-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
406; i686-NEXT:    movl %eax, {{[0-9]+}}(%esp)
407; i686-NEXT:    sarl $31, %edi
408; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
409; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
410; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
411; i686-NEXT:    movl %edi, {{[0-9]+}}(%esp)
412; i686-NEXT:    movl %edx, %eax
413; i686-NEXT:    andl $31, %eax
414; i686-NEXT:    shrl $3, %edx
415; i686-NEXT:    andl $12, %edx
416; i686-NEXT:    movl 40(%esp,%edx), %esi
417; i686-NEXT:    movl 36(%esp,%edx), %edi
418; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
419; i686-NEXT:    movl %eax, %ecx
420; i686-NEXT:    shrdl %cl, %esi, %edi
421; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
422; i686-NEXT:    movl 32(%esp,%edx), %ecx
423; i686-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
424; i686-NEXT:    movl 44(%esp,%edx), %edx
425; i686-NEXT:    movl %edx, (%esp) # 4-byte Spill
426; i686-NEXT:    movl %eax, %ecx
427; i686-NEXT:    shrdl %cl, %edx, %esi
428; i686-NEXT:    movl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
429; i686-NEXT:    movl 56(%ebp), %edx
430; i686-NEXT:    movl %edx, %ebx
431; i686-NEXT:    andl $31, %ebx
432; i686-NEXT:    shrl $3, %edx
433; i686-NEXT:    andl $12, %edx
434; i686-NEXT:    movl 72(%esp,%edx), %esi
435; i686-NEXT:    movl 68(%esp,%edx), %edi
436; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
437; i686-NEXT:    movl %ebx, %ecx
438; i686-NEXT:    shrdl %cl, %esi, %edi
439; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
440; i686-NEXT:    movl 64(%esp,%edx), %ecx
441; i686-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
442; i686-NEXT:    movl 76(%esp,%edx), %edx
443; i686-NEXT:    movl %ebx, %ecx
444; i686-NEXT:    shrdl %cl, %edx, %esi
445; i686-NEXT:    movl %eax, %ecx
446; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
447; i686-NEXT:    shrdl %cl, %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
448; i686-NEXT:    sarl %cl, (%esp) # 4-byte Folded Spill
449; i686-NEXT:    movl %ebx, %ecx
450; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
451; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
452; i686-NEXT:    shrdl %cl, %eax, %edi
453; i686-NEXT:    sarl %cl, %edx
454; i686-NEXT:    movl 72(%ebp), %eax
455; i686-NEXT:    movl %edx, 28(%eax)
456; i686-NEXT:    movl %esi, 24(%eax)
457; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
458; i686-NEXT:    movl %ecx, 20(%eax)
459; i686-NEXT:    movl %edi, 16(%eax)
460; i686-NEXT:    movl (%esp), %ecx # 4-byte Reload
461; i686-NEXT:    movl %ecx, 12(%eax)
462; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
463; i686-NEXT:    movl %ecx, 8(%eax)
464; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
465; i686-NEXT:    movl %ecx, 4(%eax)
466; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
467; i686-NEXT:    movl %ecx, (%eax)
468; i686-NEXT:    leal -12(%ebp), %esp
469; i686-NEXT:    popl %esi
470; i686-NEXT:    popl %edi
471; i686-NEXT:    popl %ebx
472; i686-NEXT:    popl %ebp
473; i686-NEXT:    retl
474;
475; x86_64-LABEL: test_ashr_v2i128:
476; x86_64:       # %bb.0: # %entry
477; x86_64-NEXT:    movq %rcx, %rax
478; x86_64-NEXT:    movq {{[0-9]+}}(%rsp), %r10
479; x86_64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r9d
480; x86_64-NEXT:    movl %r9d, %ecx
481; x86_64-NEXT:    shrdq %cl, %rax, %rdx
482; x86_64-NEXT:    movl %r8d, %ecx
483; x86_64-NEXT:    shrdq %cl, %rsi, %rdi
484; x86_64-NEXT:    movq %rsi, %r11
485; x86_64-NEXT:    sarq %cl, %r11
486; x86_64-NEXT:    sarq $63, %rsi
487; x86_64-NEXT:    testb $64, %r8b
488; x86_64-NEXT:    cmovneq %r11, %rdi
489; x86_64-NEXT:    cmoveq %r11, %rsi
490; x86_64-NEXT:    movq %rax, %r8
491; x86_64-NEXT:    movl %r9d, %ecx
492; x86_64-NEXT:    sarq %cl, %r8
493; x86_64-NEXT:    sarq $63, %rax
494; x86_64-NEXT:    testb $64, %r9b
495; x86_64-NEXT:    cmovneq %r8, %rdx
496; x86_64-NEXT:    cmoveq %r8, %rax
497; x86_64-NEXT:    movq %rax, 24(%r10)
498; x86_64-NEXT:    movq %rdx, 16(%r10)
499; x86_64-NEXT:    movq %rsi, 8(%r10)
500; x86_64-NEXT:    movq %rdi, (%r10)
501; x86_64-NEXT:    retq
502entry:
503	%0 = ashr <2 x i128> %x, %a
504	store <2 x i128> %0, ptr %r, align 16
505	ret void
506}
507
508define void @test_shl_v2i128(<2 x i128> %x, <2 x i128> %a, ptr nocapture %r) nounwind {
509; i686-LABEL: test_shl_v2i128:
510; i686:       # %bb.0: # %entry
511; i686-NEXT:    pushl %ebp
512; i686-NEXT:    movl %esp, %ebp
513; i686-NEXT:    pushl %ebx
514; i686-NEXT:    pushl %edi
515; i686-NEXT:    pushl %esi
516; i686-NEXT:    andl $-16, %esp
517; i686-NEXT:    subl $128, %esp
518; i686-NEXT:    movl 40(%ebp), %edi
519; i686-NEXT:    movl 24(%ebp), %eax
520; i686-NEXT:    movl 28(%ebp), %ecx
521; i686-NEXT:    movl 32(%ebp), %edx
522; i686-NEXT:    movl 20(%ebp), %esi
523; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
524; i686-NEXT:    movl 16(%ebp), %esi
525; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
526; i686-NEXT:    movl 12(%ebp), %esi
527; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
528; i686-NEXT:    movl 8(%ebp), %esi
529; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
530; i686-NEXT:    movl 36(%ebp), %esi
531; i686-NEXT:    movl %esi, {{[0-9]+}}(%esp)
532; i686-NEXT:    movl %edx, {{[0-9]+}}(%esp)
533; i686-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
534; i686-NEXT:    movl %eax, {{[0-9]+}}(%esp)
535; i686-NEXT:    movl %edi, %ebx
536; i686-NEXT:    shrl $3, %ebx
537; i686-NEXT:    andl $12, %ebx
538; i686-NEXT:    leal {{[0-9]+}}(%esp), %eax
539; i686-NEXT:    subl %ebx, %eax
540; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
541; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
542; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
543; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
544; i686-NEXT:    movl (%eax), %esi
545; i686-NEXT:    movl 4(%eax), %edx
546; i686-NEXT:    movl %edx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
547; i686-NEXT:    movl 8(%eax), %eax
548; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
549; i686-NEXT:    movl %edi, %ecx
550; i686-NEXT:    andl $31, %ecx
551; i686-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
552; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
553; i686-NEXT:    shldl %cl, %edx, %eax
554; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
555; i686-NEXT:    movl 56(%ebp), %eax
556; i686-NEXT:    movl %eax, %edx
557; i686-NEXT:    shrl $3, %edx
558; i686-NEXT:    andl $12, %edx
559; i686-NEXT:    leal {{[0-9]+}}(%esp), %ecx
560; i686-NEXT:    subl %edx, %ecx
561; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
562; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
563; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
564; i686-NEXT:    movl $0, {{[0-9]+}}(%esp)
565; i686-NEXT:    movl (%ecx), %edi
566; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
567; i686-NEXT:    movl 4(%ecx), %edi
568; i686-NEXT:    movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
569; i686-NEXT:    movl 8(%ecx), %ecx
570; i686-NEXT:    movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
571; i686-NEXT:    andl $31, %eax
572; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
573; i686-NEXT:    movl %ecx, %eax
574; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
575; i686-NEXT:    # kill: def $cl killed $cl killed $ecx
576; i686-NEXT:    shldl %cl, %edi, %eax
577; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
578; i686-NEXT:    movl %esi, %eax
579; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
580; i686-NEXT:    shll %cl, %eax
581; i686-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
582; i686-NEXT:    shldl %cl, %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
583; i686-NEXT:    negl %ebx
584; i686-NEXT:    movl 76(%esp,%ebx), %ebx
585; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
586; i686-NEXT:    shldl %cl, %esi, %ebx
587; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %edi # 4-byte Reload
588; i686-NEXT:    movl %edi, %esi
589; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
590; i686-NEXT:    movl %eax, %ecx
591; i686-NEXT:    shll %cl, %esi
592; i686-NEXT:    shldl %cl, %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
593; i686-NEXT:    negl %edx
594; i686-NEXT:    movl 108(%esp,%edx), %edx
595; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Reload
596; i686-NEXT:    shldl %cl, %eax, %edx
597; i686-NEXT:    movl 72(%ebp), %eax
598; i686-NEXT:    movl %edx, 28(%eax)
599; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
600; i686-NEXT:    movl %ecx, 24(%eax)
601; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
602; i686-NEXT:    movl %ecx, 20(%eax)
603; i686-NEXT:    movl %esi, 16(%eax)
604; i686-NEXT:    movl %ebx, 12(%eax)
605; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
606; i686-NEXT:    movl %ecx, 8(%eax)
607; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
608; i686-NEXT:    movl %ecx, 4(%eax)
609; i686-NEXT:    movl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 4-byte Reload
610; i686-NEXT:    movl %ecx, (%eax)
611; i686-NEXT:    leal -12(%ebp), %esp
612; i686-NEXT:    popl %esi
613; i686-NEXT:    popl %edi
614; i686-NEXT:    popl %ebx
615; i686-NEXT:    popl %ebp
616; i686-NEXT:    retl
617;
618; x86_64-LABEL: test_shl_v2i128:
619; x86_64:       # %bb.0: # %entry
620; x86_64-NEXT:    movq %rcx, %rax
621; x86_64-NEXT:    movq {{[0-9]+}}(%rsp), %r10
622; x86_64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r9d
623; x86_64-NEXT:    movl %r9d, %ecx
624; x86_64-NEXT:    shldq %cl, %rdx, %rax
625; x86_64-NEXT:    movl %r8d, %ecx
626; x86_64-NEXT:    shldq %cl, %rdi, %rsi
627; x86_64-NEXT:    shlq %cl, %rdi
628; x86_64-NEXT:    xorl %r11d, %r11d
629; x86_64-NEXT:    testb $64, %r8b
630; x86_64-NEXT:    cmovneq %rdi, %rsi
631; x86_64-NEXT:    cmovneq %r11, %rdi
632; x86_64-NEXT:    movl %r9d, %ecx
633; x86_64-NEXT:    shlq %cl, %rdx
634; x86_64-NEXT:    testb $64, %r9b
635; x86_64-NEXT:    cmovneq %rdx, %rax
636; x86_64-NEXT:    cmovneq %r11, %rdx
637; x86_64-NEXT:    movq %rax, 24(%r10)
638; x86_64-NEXT:    movq %rdx, 16(%r10)
639; x86_64-NEXT:    movq %rsi, 8(%r10)
640; x86_64-NEXT:    movq %rdi, (%r10)
641; x86_64-NEXT:    retq
642entry:
643	%0 = shl <2 x i128> %x, %a
644	store <2 x i128> %0, ptr %r, align 16
645	ret void
646}
647
648define void @test_lshr_v2i128_outofrange(<2 x i128> %x, ptr nocapture %r) nounwind {
649; ALL-LABEL: test_lshr_v2i128_outofrange:
650; ALL:       # %bb.0: # %entry
651; ALL-NEXT:    ret{{[l|q]}}
652entry:
653	%0 = lshr <2 x i128> %x, <i128 -1, i128 -1>
654	store <2 x i128> %0, ptr %r, align 16
655	ret void
656}
657
658define void @test_ashr_v2i128_outofrange(<2 x i128> %x, ptr nocapture %r) nounwind {
659; ALL-LABEL: test_ashr_v2i128_outofrange:
660; ALL:       # %bb.0: # %entry
661; ALL-NEXT:    ret{{[l|q]}}
662entry:
663	%0 = ashr <2 x i128> %x, <i128 -1, i128 -1>
664	store <2 x i128> %0, ptr %r, align 16
665	ret void
666}
667
668define void @test_shl_v2i128_outofrange(<2 x i128> %x, ptr nocapture %r) nounwind {
669; ALL-LABEL: test_shl_v2i128_outofrange:
670; ALL:       # %bb.0: # %entry
671; ALL-NEXT:    ret{{[l|q]}}
672entry:
673	%0 = shl <2 x i128> %x, <i128 -1, i128 -1>
674	store <2 x i128> %0, ptr %r, align 16
675	ret void
676}
677
678define void @test_lshr_v2i128_outofrange_sum(<2 x i128> %x, ptr nocapture %r) nounwind {
679; i686-LABEL: test_lshr_v2i128_outofrange_sum:
680; i686:       # %bb.0: # %entry
681; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
682; i686-NEXT:    movl $0, 28(%eax)
683; i686-NEXT:    movl $0, 24(%eax)
684; i686-NEXT:    movl $0, 20(%eax)
685; i686-NEXT:    movl $0, 16(%eax)
686; i686-NEXT:    movl $0, 12(%eax)
687; i686-NEXT:    movl $0, 8(%eax)
688; i686-NEXT:    movl $0, 4(%eax)
689; i686-NEXT:    movl $0, (%eax)
690; i686-NEXT:    retl
691;
692; x86_64-LABEL: test_lshr_v2i128_outofrange_sum:
693; x86_64:       # %bb.0: # %entry
694; x86_64-NEXT:    xorps %xmm0, %xmm0
695; x86_64-NEXT:    movaps %xmm0, 16(%r8)
696; x86_64-NEXT:    movaps %xmm0, (%r8)
697; x86_64-NEXT:    retq
698entry:
699	%0 = lshr <2 x i128> %x, <i128 -1, i128 -1>
700	%1 = lshr <2 x i128> %0, <i128  1, i128  1>
701	store <2 x i128> %1, ptr %r, align 16
702	ret void
703}
704
705define void @test_ashr_v2i128_outofrange_sum(<2 x i128> %x, ptr nocapture %r) nounwind {
706; i686-LABEL: test_ashr_v2i128_outofrange_sum:
707; i686:       # %bb.0: # %entry
708; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
709; i686-NEXT:    movl $0, 28(%eax)
710; i686-NEXT:    movl $0, 24(%eax)
711; i686-NEXT:    movl $0, 20(%eax)
712; i686-NEXT:    movl $0, 16(%eax)
713; i686-NEXT:    movl $0, 12(%eax)
714; i686-NEXT:    movl $0, 8(%eax)
715; i686-NEXT:    movl $0, 4(%eax)
716; i686-NEXT:    movl $0, (%eax)
717; i686-NEXT:    retl
718;
719; x86_64-LABEL: test_ashr_v2i128_outofrange_sum:
720; x86_64:       # %bb.0: # %entry
721; x86_64-NEXT:    xorps %xmm0, %xmm0
722; x86_64-NEXT:    movaps %xmm0, 16(%r8)
723; x86_64-NEXT:    movaps %xmm0, (%r8)
724; x86_64-NEXT:    retq
725entry:
726	%0 = ashr <2 x i128> %x, <i128 -1, i128 -1>
727	%1 = ashr <2 x i128> %0, <i128  1, i128  1>
728	store <2 x i128> %1, ptr %r, align 16
729	ret void
730}
731
732define void @test_shl_v2i128_outofrange_sum(<2 x i128> %x, ptr nocapture %r) nounwind {
733; i686-LABEL: test_shl_v2i128_outofrange_sum:
734; i686:       # %bb.0: # %entry
735; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
736; i686-NEXT:    movl $0, 28(%eax)
737; i686-NEXT:    movl $0, 24(%eax)
738; i686-NEXT:    movl $0, 20(%eax)
739; i686-NEXT:    movl $0, 16(%eax)
740; i686-NEXT:    movl $0, 12(%eax)
741; i686-NEXT:    movl $0, 8(%eax)
742; i686-NEXT:    movl $0, 4(%eax)
743; i686-NEXT:    movl $0, (%eax)
744; i686-NEXT:    retl
745;
746; x86_64-LABEL: test_shl_v2i128_outofrange_sum:
747; x86_64:       # %bb.0: # %entry
748; x86_64-NEXT:    xorps %xmm0, %xmm0
749; x86_64-NEXT:    movaps %xmm0, 16(%r8)
750; x86_64-NEXT:    movaps %xmm0, (%r8)
751; x86_64-NEXT:    retq
752entry:
753	%0 = shl <2 x i128> %x, <i128 -1, i128 -1>
754	%1 = shl <2 x i128> %0, <i128  1, i128  1>
755	store <2 x i128> %1, ptr %r, align 16
756	ret void
757}
758
759;
760; Combines
761;
762
763define <2 x i256> @shl_sext_shl_outofrange(<2 x i128> %a0) {
764; i686-LABEL: shl_sext_shl_outofrange:
765; i686:       # %bb.0:
766; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
767; i686-NEXT:    movl $0, 60(%eax)
768; i686-NEXT:    movl $0, 56(%eax)
769; i686-NEXT:    movl $0, 52(%eax)
770; i686-NEXT:    movl $0, 48(%eax)
771; i686-NEXT:    movl $0, 44(%eax)
772; i686-NEXT:    movl $0, 40(%eax)
773; i686-NEXT:    movl $0, 36(%eax)
774; i686-NEXT:    movl $0, 32(%eax)
775; i686-NEXT:    movl $0, 28(%eax)
776; i686-NEXT:    movl $0, 24(%eax)
777; i686-NEXT:    movl $0, 20(%eax)
778; i686-NEXT:    movl $0, 16(%eax)
779; i686-NEXT:    movl $0, 12(%eax)
780; i686-NEXT:    movl $0, 8(%eax)
781; i686-NEXT:    movl $0, 4(%eax)
782; i686-NEXT:    movl $0, (%eax)
783; i686-NEXT:    retl $4
784;
785; x86_64-LABEL: shl_sext_shl_outofrange:
786; x86_64:       # %bb.0:
787; x86_64-NEXT:    movq %rdi, %rax
788; x86_64-NEXT:    xorps %xmm0, %xmm0
789; x86_64-NEXT:    movaps %xmm0, 48(%rdi)
790; x86_64-NEXT:    movaps %xmm0, 32(%rdi)
791; x86_64-NEXT:    movaps %xmm0, 16(%rdi)
792; x86_64-NEXT:    movaps %xmm0, (%rdi)
793; x86_64-NEXT:    retq
794  %1 = shl <2 x i128> %a0, <i128 -1, i128 -1>
795  %2 = sext <2 x i128> %1 to <2 x i256>
796  %3 = shl <2 x i256> %2, <i256 128, i256 128>
797  ret <2 x i256> %3
798}
799
800define <2 x i256> @shl_zext_shl_outofrange(<2 x i128> %a0) {
801; i686-LABEL: shl_zext_shl_outofrange:
802; i686:       # %bb.0:
803; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
804; i686-NEXT:    movl $0, 60(%eax)
805; i686-NEXT:    movl $0, 56(%eax)
806; i686-NEXT:    movl $0, 52(%eax)
807; i686-NEXT:    movl $0, 48(%eax)
808; i686-NEXT:    movl $0, 44(%eax)
809; i686-NEXT:    movl $0, 40(%eax)
810; i686-NEXT:    movl $0, 36(%eax)
811; i686-NEXT:    movl $0, 32(%eax)
812; i686-NEXT:    movl $0, 28(%eax)
813; i686-NEXT:    movl $0, 24(%eax)
814; i686-NEXT:    movl $0, 20(%eax)
815; i686-NEXT:    movl $0, 16(%eax)
816; i686-NEXT:    movl $0, 12(%eax)
817; i686-NEXT:    movl $0, 8(%eax)
818; i686-NEXT:    movl $0, 4(%eax)
819; i686-NEXT:    movl $0, (%eax)
820; i686-NEXT:    retl $4
821;
822; x86_64-LABEL: shl_zext_shl_outofrange:
823; x86_64:       # %bb.0:
824; x86_64-NEXT:    movq %rdi, %rax
825; x86_64-NEXT:    xorps %xmm0, %xmm0
826; x86_64-NEXT:    movaps %xmm0, 48(%rdi)
827; x86_64-NEXT:    movaps %xmm0, 32(%rdi)
828; x86_64-NEXT:    movaps %xmm0, 16(%rdi)
829; x86_64-NEXT:    movaps %xmm0, (%rdi)
830; x86_64-NEXT:    retq
831  %1 = shl <2 x i128> %a0, <i128 -1, i128 -1>
832  %2 = zext <2 x i128> %1 to <2 x i256>
833  %3 = shl <2 x i256> %2, <i256 128, i256 128>
834  ret <2 x i256> %3
835}
836
837define <2 x i256> @shl_zext_lshr_outofrange(<2 x i128> %a0) {
838; i686-LABEL: shl_zext_lshr_outofrange:
839; i686:       # %bb.0:
840; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
841; i686-NEXT:    movl $0, 60(%eax)
842; i686-NEXT:    movl $0, 56(%eax)
843; i686-NEXT:    movl $0, 52(%eax)
844; i686-NEXT:    movl $0, 48(%eax)
845; i686-NEXT:    movl $0, 44(%eax)
846; i686-NEXT:    movl $0, 40(%eax)
847; i686-NEXT:    movl $0, 36(%eax)
848; i686-NEXT:    movl $0, 32(%eax)
849; i686-NEXT:    movl $0, 28(%eax)
850; i686-NEXT:    movl $0, 24(%eax)
851; i686-NEXT:    movl $0, 20(%eax)
852; i686-NEXT:    movl $0, 16(%eax)
853; i686-NEXT:    movl $0, 12(%eax)
854; i686-NEXT:    movl $0, 8(%eax)
855; i686-NEXT:    movl $0, 4(%eax)
856; i686-NEXT:    movl $0, (%eax)
857; i686-NEXT:    retl $4
858;
859; x86_64-LABEL: shl_zext_lshr_outofrange:
860; x86_64:       # %bb.0:
861; x86_64-NEXT:    movq %rdi, %rax
862; x86_64-NEXT:    xorps %xmm0, %xmm0
863; x86_64-NEXT:    movaps %xmm0, 48(%rdi)
864; x86_64-NEXT:    movaps %xmm0, 32(%rdi)
865; x86_64-NEXT:    movaps %xmm0, 16(%rdi)
866; x86_64-NEXT:    movaps %xmm0, (%rdi)
867; x86_64-NEXT:    retq
868  %1 = lshr <2 x i128> %a0, <i128 -1, i128 -1>
869  %2 = zext <2 x i128> %1 to <2 x i256>
870  %3 = shl <2 x i256> %2, <i256 128, i256 128>
871  ret <2 x i256> %3
872}
873
874define i128 @lshr_shl_mask(i128 %a0) {
875; i686-LABEL: lshr_shl_mask:
876; i686:       # %bb.0:
877; i686-NEXT:    pushl %edi
878; i686-NEXT:    .cfi_def_cfa_offset 8
879; i686-NEXT:    pushl %esi
880; i686-NEXT:    .cfi_def_cfa_offset 12
881; i686-NEXT:    .cfi_offset %esi, -12
882; i686-NEXT:    .cfi_offset %edi, -8
883; i686-NEXT:    movl {{[0-9]+}}(%esp), %eax
884; i686-NEXT:    movl {{[0-9]+}}(%esp), %ecx
885; i686-NEXT:    movl {{[0-9]+}}(%esp), %edx
886; i686-NEXT:    movl {{[0-9]+}}(%esp), %esi
887; i686-NEXT:    movl $2147483647, %edi # imm = 0x7FFFFFFF
888; i686-NEXT:    andl {{[0-9]+}}(%esp), %edi
889; i686-NEXT:    movl %edi, 12(%eax)
890; i686-NEXT:    movl %esi, 8(%eax)
891; i686-NEXT:    movl %edx, 4(%eax)
892; i686-NEXT:    movl %ecx, (%eax)
893; i686-NEXT:    popl %esi
894; i686-NEXT:    .cfi_def_cfa_offset 8
895; i686-NEXT:    popl %edi
896; i686-NEXT:    .cfi_def_cfa_offset 4
897; i686-NEXT:    retl $4
898;
899; x86_64-LABEL: lshr_shl_mask:
900; x86_64:       # %bb.0:
901; x86_64-NEXT:    movq %rdi, %rax
902; x86_64-NEXT:    movabsq $9223372036854775807, %rdx # imm = 0x7FFFFFFFFFFFFFFF
903; x86_64-NEXT:    andq %rsi, %rdx
904; x86_64-NEXT:    retq
905  %1 = shl i128 %a0, 1
906  %2 = lshr i128 %1, 1
907  ret i128 %2
908}
909