1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2,-sse4.1 | FileCheck %s --check-prefix=X64
5 define void @test1(<4 x float>* %F, float* %f) nounwind {
7 ; X32: # %bb.0: # %entry
8 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
10 ; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
11 ; X32-NEXT: addss %xmm0, %xmm0
12 ; X32-NEXT: movss %xmm0, (%eax)
16 ; X64: # %bb.0: # %entry
17 ; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
18 ; X64-NEXT: addss %xmm0, %xmm0
19 ; X64-NEXT: movss %xmm0, (%rsi)
22 %tmp = load <4 x float>, <4 x float>* %F
23 %tmp7 = fadd <4 x float> %tmp, %tmp
24 %tmp2 = extractelement <4 x float> %tmp7, i32 0
25 store float %tmp2, float* %f
29 define float @test2(<4 x float>* %F, float* %f) nounwind {
31 ; X32: # %bb.0: # %entry
32 ; X32-NEXT: pushl %eax
33 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
34 ; X32-NEXT: movaps (%eax), %xmm0
35 ; X32-NEXT: addps %xmm0, %xmm0
36 ; X32-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
37 ; X32-NEXT: movss %xmm0, (%esp)
38 ; X32-NEXT: flds (%esp)
43 ; X64: # %bb.0: # %entry
44 ; X64-NEXT: movaps (%rdi), %xmm0
45 ; X64-NEXT: addps %xmm0, %xmm0
46 ; X64-NEXT: movhlps {{.*#+}} xmm0 = xmm0[1,1]
49 %tmp = load <4 x float>, <4 x float>* %F
50 %tmp7 = fadd <4 x float> %tmp, %tmp
51 %tmp2 = extractelement <4 x float> %tmp7, i32 2
55 define void @test3(float* %R, <4 x float>* %P1) nounwind {
57 ; X32: # %bb.0: # %entry
58 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
59 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
60 ; X32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
61 ; X32-NEXT: movss %xmm0, (%eax)
65 ; X64: # %bb.0: # %entry
66 ; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
67 ; X64-NEXT: movss %xmm0, (%rdi)
70 %X = load <4 x float>, <4 x float>* %P1
71 %tmp = extractelement <4 x float> %X, i32 3
72 store float %tmp, float* %R
76 define double @test4(double %A) nounwind {
78 ; X32: # %bb.0: # %entry
79 ; X32-NEXT: subl $12, %esp
81 ; X32-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
82 ; X32-NEXT: addsd {{[0-9]+}}(%esp), %xmm0
83 ; X32-NEXT: movsd %xmm0, (%esp)
84 ; X32-NEXT: fldl (%esp)
85 ; X32-NEXT: addl $12, %esp
89 ; X64: # %bb.0: # %entry
90 ; X64-NEXT: pushq %rax
91 ; X64-NEXT: movsd %xmm0, (%rsp) # 8-byte Spill
93 ; X64-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
94 ; X64-NEXT: addsd (%rsp), %xmm0 # 8-byte Folded Reload
98 %tmp1 = call <2 x double> @foo( )
99 %tmp2 = extractelement <2 x double> %tmp1, i32 1
100 %tmp3 = fadd double %tmp2, %A
103 declare <2 x double> @foo()
106 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15662
107 define <4 x i32> @ossfuzz15662(<4 x i32*>* %in) {
108 ; X32-LABEL: ossfuzz15662:
110 ; X32-NEXT: xorps %xmm0, %xmm0
111 ; X32-NEXT: movaps %xmm0, (%eax)
112 ; X32-NEXT: xorps %xmm0, %xmm0
115 ; X64-LABEL: ossfuzz15662:
117 ; X64-NEXT: xorps %xmm0, %xmm0
118 ; X64-NEXT: movaps %xmm0, (%rax)
119 ; X64-NEXT: xorps %xmm0, %xmm0
121 %C10 = icmp ule i1 false, false
122 %C3 = icmp ule i1 true, undef
123 %B = sdiv i1 %C10, %C3
124 %I = insertelement <4 x i32> zeroinitializer, i32 0, i1 %B
125 store <4 x i32> %I, <4 x i32>* undef
126 ret <4 x i32> zeroinitializer