• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
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.
7
8declare void @sink(<2 x double>)
9
10define void @test1(i1 %cmp) align 2 {
11; CHECK-LABEL: test1:
12; CHECK:       ## %bb.0:
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
22; CHECK-NEXT:    retq
23  %1 = alloca  <2 x double>, align 16
24  %2 = alloca  <2 x double>, align 8
25
26  %val = load <2 x double>, <2 x double>* %1, align 16
27  %val2 = load <2 x double>, <2 x double>* %2, align 8
28  %val3 = select i1 %cmp, <2 x double> %val, <2 x double> %val2
29  call void @sink(<2 x double> %val3)
30  ret void
31}
32
33define void @test2(i1 %cmp) align 2 {
34; CHECK-LABEL: test2:
35; CHECK:       ## %bb.0:
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
45; CHECK-NEXT:    retq
46  %1 = alloca  <2 x double>, align 16
47  %2 = alloca  <2 x double>, align 8
48
49  %val = load <2 x double>, <2 x double>* %1, align 16
50  %val2 = load <2 x double>, <2 x double>* %2, align 16
51  %val3 = select i1 %cmp, <2 x double> %val, <2 x double> %val2
52  call void @sink(<2 x double> %val3)
53  ret void
54}
55