1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s
4 ; Check that x86's peephole optimization doesn't fold a 64-bit load (movsd) into
6 ; rdar://problem/18236850
8 %struct.S1 = type { double, double }
10 @g = common dso_local global %struct.S1 zeroinitializer, align 8
12 declare void @foo3(ptr)
14 define dso_local void @foo1(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) nounwind {
17 ; CHECK-NEXT: subq $24, %rsp
18 ; CHECK-NEXT: movq %rsp, %rdi
19 ; CHECK-NEXT: callq foo3@PLT
20 ; CHECK-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
21 ; CHECK-NEXT: movapd {{.*#+}} xmm1 = <1.0E+0,u>
22 ; CHECK-NEXT: movhpd {{.*#+}} xmm1 = xmm1[0],mem[0]
23 ; CHECK-NEXT: addpd %xmm0, %xmm1
24 ; CHECK-NEXT: movapd %xmm1, g(%rip)
25 ; CHECK-NEXT: addq $24, %rsp
27 %1 = alloca <2 x double>, align 16
28 call void @foo3(ptr %1) #2
29 %2 = load double, ptr %1, align 16
30 %p3 = getelementptr inbounds %struct.S1, ptr %1, i64 0, i32 1
31 %3 = load double, ptr %p3, align 8
32 %4 = insertelement <2 x double> undef, double %2, i32 0
33 %5 = insertelement <2 x double> %4, double 0.000000e+00, i32 1
34 %6 = insertelement <2 x double> undef, double %3, i32 1
35 %7 = insertelement <2 x double> %6, double 1.000000e+00, i32 0
36 %8 = fadd <2 x double> %5, %7
37 store <2 x double> %8, ptr @g, align 16