[DAGCombiner] Eliminate dead stores to stack.
[llvm-complete.git] / test / CodeGen / X86 / 2011-10-19-widen_vselect.ll
blob44d9569bc57ff55705e08fe6383aa5bbb3fe2a86
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mcpu=corei7   | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 | FileCheck %s --check-prefix=X64
5 ; Make sure that we don't crash when legalizing vselect and vsetcc and that
6 ; we are able to generate vector blend instructions.
8 define void @simple_widen(<2 x float> %a, <2 x float> %b) {
9 ; X32-LABEL: simple_widen:
10 ; X32:       # %bb.0: # %entry
11 ; X32-NEXT:    movlps %xmm1, (%eax)
12 ; X32-NEXT:    retl
14 ; X64-LABEL: simple_widen:
15 ; X64:       # %bb.0: # %entry
16 ; X64-NEXT:    movlps %xmm1, (%rax)
17 ; X64-NEXT:    retq
18 entry:
19   %0 = select <2 x i1> undef, <2 x float> %a, <2 x float> %b
20   store <2 x float> %0, <2 x float>* undef
21   ret void
24 define void @complex_inreg_work(<2 x float> %a, <2 x float> %b) {
25 ; X32-LABEL: complex_inreg_work:
26 ; X32:       # %bb.0: # %entry
27 ; X32-NEXT:    movaps %xmm0, %xmm2
28 ; X32-NEXT:    cmpordps %xmm0, %xmm0
29 ; X32-NEXT:    blendvps %xmm0, %xmm2, %xmm1
30 ; X32-NEXT:    movlps %xmm1, (%eax)
31 ; X32-NEXT:    retl
33 ; X64-LABEL: complex_inreg_work:
34 ; X64:       # %bb.0: # %entry
35 ; X64-NEXT:    movaps %xmm0, %xmm2
36 ; X64-NEXT:    cmpordps %xmm0, %xmm0
37 ; X64-NEXT:    blendvps %xmm0, %xmm2, %xmm1
38 ; X64-NEXT:    movlps %xmm1, (%rax)
39 ; X64-NEXT:    retq
40 entry:
41   %0 = fcmp oeq <2 x float> undef, undef
42   %1 = select <2 x i1> %0, <2 x float> %a, <2 x float> %b
43   store <2 x float> %1, <2 x float>* undef
44   ret void
47 define void @zero_test() {
48 ; X32-LABEL: zero_test:
49 ; X32:       # %bb.0: # %entry
50 ; X32-NEXT:    xorps %xmm0, %xmm0
51 ; X32-NEXT:    movlps %xmm0, (%eax)
52 ; X32-NEXT:    retl
54 ; X64-LABEL: zero_test:
55 ; X64:       # %bb.0: # %entry
56 ; X64-NEXT:    xorps %xmm0, %xmm0
57 ; X64-NEXT:    movlps %xmm0, (%rax)
58 ; X64-NEXT:    retq
59 entry:
60   %0 = select <2 x i1> undef, <2 x float> undef, <2 x float> zeroinitializer
61   store <2 x float> %0, <2 x float>* undef
62   ret void
65 define void @full_test() {
66 ; X32-LABEL: full_test:
67 ; X32:       # %bb.0: # %entry
68 ; X32-NEXT:    subl $60, %esp
69 ; X32-NEXT:    .cfi_def_cfa_offset 64
70 ; X32-NEXT:    movsd {{.*#+}} xmm2 = mem[0],zero
71 ; X32-NEXT:    cvttps2dq %xmm2, %xmm0
72 ; X32-NEXT:    cvtdq2ps %xmm0, %xmm1
73 ; X32-NEXT:    xorps %xmm0, %xmm0
74 ; X32-NEXT:    cmpltps %xmm2, %xmm0
75 ; X32-NEXT:    movaps {{.*#+}} xmm3 = <1.0E+0,1.0E+0,u,u>
76 ; X32-NEXT:    addps %xmm1, %xmm3
77 ; X32-NEXT:    movaps %xmm1, %xmm4
78 ; X32-NEXT:    blendvps %xmm0, %xmm3, %xmm4
79 ; X32-NEXT:    cmpeqps %xmm2, %xmm1
80 ; X32-NEXT:    movaps %xmm1, %xmm0
81 ; X32-NEXT:    blendvps %xmm0, %xmm2, %xmm4
82 ; X32-NEXT:    movlps %xmm4, {{[0-9]+}}(%esp)
83 ; X32-NEXT:    movlps %xmm4, {{[0-9]+}}(%esp)
84 ; X32-NEXT:    addl $60, %esp
85 ; X32-NEXT:    .cfi_def_cfa_offset 4
86 ; X32-NEXT:    retl
88 ; X64-LABEL: full_test:
89 ; X64:       # %bb.0: # %entry
90 ; X64-NEXT:    movsd {{.*#+}} xmm2 = mem[0],zero
91 ; X64-NEXT:    cvttps2dq %xmm2, %xmm0
92 ; X64-NEXT:    cvtdq2ps %xmm0, %xmm1
93 ; X64-NEXT:    xorps %xmm0, %xmm0
94 ; X64-NEXT:    cmpltps %xmm2, %xmm0
95 ; X64-NEXT:    movaps {{.*#+}} xmm3 = <1.0E+0,1.0E+0,u,u>
96 ; X64-NEXT:    addps %xmm1, %xmm3
97 ; X64-NEXT:    movaps %xmm1, %xmm4
98 ; X64-NEXT:    blendvps %xmm0, %xmm3, %xmm4
99 ; X64-NEXT:    cmpeqps %xmm2, %xmm1
100 ; X64-NEXT:    movaps %xmm1, %xmm0
101 ; X64-NEXT:    blendvps %xmm0, %xmm2, %xmm4
102 ; X64-NEXT:    movlps %xmm4, -{{[0-9]+}}(%rsp)
103 ; X64-NEXT:    movlps %xmm4, -{{[0-9]+}}(%rsp)
104 ; X64-NEXT:    retq
105  entry:
106    %Cy300 = alloca <4 x float>
107    %Cy11a = alloca <2 x float>
108    %Cy118 = alloca <2 x float>
109    %Cy119 = alloca <2 x float>
110    br label %B1
112  B1:                                               ; preds = %entry
113    %0 = load <2 x float>, <2 x float>* %Cy119
114    %1 = fptosi <2 x float> %0 to <2 x i32>
115    %2 = sitofp <2 x i32> %1 to <2 x float>
116    %3 = fcmp ogt <2 x float> %0, zeroinitializer
117    %4 = fadd <2 x float> %2, <float 1.000000e+00, float 1.000000e+00>
118    %5 = select <2 x i1> %3, <2 x float> %4, <2 x float> %2
119    %6 = fcmp oeq <2 x float> %2, %0
120    %7 = select <2 x i1> %6, <2 x float> %0, <2 x float> %5
121    store <2 x float> %7, <2 x float>* %Cy118
122    %8 = load <2 x float>, <2 x float>* %Cy118
123    store <2 x float> %8, <2 x float>* %Cy11a
124    ret void