1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-apple-macosx10.9.0 -mcpu=core2 -mattr=+64bit,+sse2 < %s | FileCheck %s
4 ; DAGCombine may choose to rewrite 2 loads feeding a select as a select of
5 ; addresses feeding a load. This test ensures that when it does that it creates
6 ; a load with alignment equivalent to the most restrictive source load.
8 declare void @sink(<2 x double>)
10 define void @test1(i1 %cmp) align 2 {
13 ; CHECK-NEXT: subq $40, %rsp
14 ; CHECK-NEXT: .cfi_def_cfa_offset 48
15 ; CHECK-NEXT: testb $1, %dil
16 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
17 ; CHECK-NEXT: movq %rsp, %rcx
18 ; CHECK-NEXT: cmovneq %rax, %rcx
19 ; CHECK-NEXT: movups (%rcx), %xmm0
20 ; CHECK-NEXT: callq _sink
21 ; CHECK-NEXT: addq $40, %rsp
23 %1 = alloca <2 x double>, align 16
24 %2 = alloca <2 x double>, align 8
26 %val = load <2 x double>, ptr %1, align 16
27 %val2 = load <2 x double>, ptr %2, align 8
28 %val3 = select i1 %cmp, <2 x double> %val, <2 x double> %val2
29 call void @sink(<2 x double> %val3)
33 define void @test2(i1 %cmp) align 2 {
36 ; CHECK-NEXT: subq $40, %rsp
37 ; CHECK-NEXT: .cfi_def_cfa_offset 48
38 ; CHECK-NEXT: testb $1, %dil
39 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
40 ; CHECK-NEXT: movq %rsp, %rcx
41 ; CHECK-NEXT: cmovneq %rax, %rcx
42 ; CHECK-NEXT: movaps (%rcx), %xmm0
43 ; CHECK-NEXT: callq _sink
44 ; CHECK-NEXT: addq $40, %rsp
46 %1 = alloca <2 x double>, align 16
47 %2 = alloca <2 x double>, align 8
49 %val = load <2 x double>, ptr %1, align 16
50 %val2 = load <2 x double>, ptr %2, align 16
51 %val3 = select i1 %cmp, <2 x double> %val, <2 x double> %val2
52 call void @sink(<2 x double> %val3)