1 ; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-win32 < %s | FileCheck %s
5 ; When doing vector gather-scatter index calculation with 32-bit indices,
6 ; bounce the vector off of cache rather than shuffling each individual
7 ; element out of the index vector.
9 ; CHECK: andps ([[H:%rdx|%r8]]), %xmm0
10 ; CHECK: movaps %xmm0, {{(-24)?}}(%rsp)
11 ; CHECK: movslq {{(-24)?}}(%rsp), %rax
12 ; CHECK: movsd ([[P:%rdi|%rcx]],%rax,8), %xmm0
13 ; CHECK: movslq {{-20|4}}(%rsp), %rax
14 ; CHECK: movhpd ([[P]],%rax,8), %xmm0
15 ; CHECK: movslq {{-16|8}}(%rsp), %rax
16 ; CHECK: movsd ([[P]],%rax,8), %xmm1
17 ; CHECK: movslq {{-12|12}}(%rsp), %rax
18 ; CHECK: movhpd ([[P]],%rax,8), %xmm1
20 define <4 x double> @foo(double* %p, <4 x i32>* %i, <4 x i32>* %h) nounwind {
21 %a = load <4 x i32>* %i
22 %b = load <4 x i32>* %h
23 %j = and <4 x i32> %a, %b
24 %d0 = extractelement <4 x i32> %j, i32 0
25 %d1 = extractelement <4 x i32> %j, i32 1
26 %d2 = extractelement <4 x i32> %j, i32 2
27 %d3 = extractelement <4 x i32> %j, i32 3
28 %q0 = getelementptr double* %p, i32 %d0
29 %q1 = getelementptr double* %p, i32 %d1
30 %q2 = getelementptr double* %p, i32 %d2
31 %q3 = getelementptr double* %p, i32 %d3
32 %r0 = load double* %q0
33 %r1 = load double* %q1
34 %r2 = load double* %q2
35 %r3 = load double* %q3
36 %v0 = insertelement <4 x double> undef, double %r0, i32 0
37 %v1 = insertelement <4 x double> %v0, double %r1, i32 1
38 %v2 = insertelement <4 x double> %v1, double %r2, i32 2
39 %v3 = insertelement <4 x double> %v2, double %r3, i32 3