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(ptr %F, ptr %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>, ptr %F
23 %tmp7 = fadd <4 x float> %tmp, %tmp
24 %tmp2 = extractelement <4 x float> %tmp7, i32 0
25 store float %tmp2, ptr %f
29 define float @test2(ptr %F, ptr %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>, ptr %F
50 %tmp7 = fadd <4 x float> %tmp, %tmp
51 %tmp2 = extractelement <4 x float> %tmp7, i32 2
55 define void @test3(ptr %R, ptr %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: movaps (%ecx), %xmm0
61 ; X32-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]
62 ; X32-NEXT: movss %xmm0, (%eax)
66 ; X64: # %bb.0: # %entry
67 ; X64-NEXT: movaps (%rsi), %xmm0
68 ; X64-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]
69 ; X64-NEXT: movss %xmm0, (%rdi)
72 %X = load <4 x float>, ptr %P1
73 %tmp = extractelement <4 x float> %X, i32 3
74 store float %tmp, ptr %R
78 define double @test4(double %A) nounwind {
80 ; X32: # %bb.0: # %entry
81 ; X32-NEXT: subl $12, %esp
82 ; X32-NEXT: calll foo@PLT
83 ; X32-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
84 ; X32-NEXT: addsd {{[0-9]+}}(%esp), %xmm0
85 ; X32-NEXT: movsd %xmm0, (%esp)
86 ; X32-NEXT: fldl (%esp)
87 ; X32-NEXT: addl $12, %esp
91 ; X64: # %bb.0: # %entry
92 ; X64-NEXT: pushq %rax
93 ; X64-NEXT: movsd %xmm0, (%rsp) # 8-byte Spill
94 ; X64-NEXT: callq foo@PLT
95 ; X64-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1,1]
96 ; X64-NEXT: addsd (%rsp), %xmm0 # 8-byte Folded Reload
100 %tmp1 = call <2 x double> @foo( )
101 %tmp2 = extractelement <2 x double> %tmp1, i32 1
102 %tmp3 = fadd double %tmp2, %A
105 declare <2 x double> @foo()
108 ; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15662
109 define <4 x i32> @ossfuzz15662(ptr %in) {
110 ; X32-LABEL: ossfuzz15662:
112 ; X32-NEXT: xorps %xmm0, %xmm0
113 ; X32-NEXT: movaps %xmm0, (%eax)
116 ; X64-LABEL: ossfuzz15662:
118 ; X64-NEXT: xorps %xmm0, %xmm0
119 ; X64-NEXT: movaps %xmm0, (%rax)
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, ptr undef
126 ret <4 x i32> zeroinitializer