Fix SCEV denormalization of expressions where the exit value from
[oota-llvm.git] / test / CodeGen / X86 / widen_shuffle-1.ll
1 ; RUN: llc < %s -march=x86 -mattr=+sse42 -disable-mmx | FileCheck %s
2
3 ; widening shuffle v3float and then a add
4 define void @shuf(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind {
5 entry:
6 ; CHECK: insertps
7 ; CHECK: extractps
8         %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 1, i32 2>
9         %val = fadd <3 x float> %x, %src2
10         store <3 x float> %val, <3 x float>* %dst.addr
11         ret void
12 }
13
14
15 ; widening shuffle v3float with a different mask and then a add
16 define void @shuf2(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind {
17 entry:
18 ; CHECK: insertps
19 ; CHECK: extractps
20         %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 4, i32 2>
21         %val = fadd <3 x float> %x, %src2
22         store <3 x float> %val, <3 x float>* %dst.addr
23         ret void
24 }
25
26 ; Example of when widening a v3float operation causes the DAG to replace a node
27 ; with the operation that we are currently widening, i.e. when replacing
28 ; opA with opB, the DAG will produce new operations with opA.
29 define void @shuf3(<4 x float> %tmp10, <4 x float> %vecinit15, <4 x float>* %dst) {
30 entry:
31 ; CHECK: pshufd
32   %shuffle.i.i.i12 = shufflevector <4 x float> %tmp10, <4 x float> %vecinit15, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
33   %tmp25.i.i = shufflevector <4 x float> %shuffle.i.i.i12, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> 
34   %tmp1.i.i = shufflevector <3 x float> %tmp25.i.i, <3 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
35   %tmp3.i13 = shufflevector <4 x float> %tmp1.i.i, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> ; <<3 x float>>
36   %tmp6.i14 = shufflevector <3 x float> %tmp3.i13, <3 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
37   %tmp97.i = shufflevector <4 x float> %tmp6.i14, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2>
38   %tmp2.i18 = shufflevector <3 x float> %tmp97.i, <3 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
39   %t5 = bitcast <4 x float> %tmp2.i18 to <4 x i32>
40   %shr.i.i19 = lshr <4 x i32> %t5, <i32 19, i32 19, i32 19, i32 19>
41   %and.i.i20 = and <4 x i32> %shr.i.i19, <i32 4080, i32 4080, i32 4080, i32 4080> 
42   %shuffle.i.i.i21 = shufflevector <4 x float> %tmp2.i18, <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
43   store <4 x float> %shuffle.i.i.i21, <4 x float>* %dst
44   ret void
45 }
46