Chris Lattner | 6f948be | 2010-12-19 20:12:58 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 -mattr=+sse42 | FileCheck %s |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 2 | |
| 3 | ; widening shuffle v3float and then a add |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 4 | define void @shuf(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind { |
| 5 | entry: |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 6 | ; CHECK: shuf: |
| 7 | ; CHECK: extractps |
Mon P Wang | f62546a | 2010-06-04 01:20:10 +0000 | [diff] [blame] | 8 | ; CHECK: extractps |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 9 | %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 1, i32 2> |
Dan Gohman | aceba31 | 2010-01-05 17:55:26 +0000 | [diff] [blame] | 10 | %val = fadd <3 x float> %x, %src2 |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 11 | store <3 x float> %val, <3 x float>* %dst.addr |
| 12 | ret void |
| 13 | } |
Mon P Wang | f62546a | 2010-06-04 01:20:10 +0000 | [diff] [blame] | 14 | |
| 15 | |
| 16 | ; widening shuffle v3float with a different mask and then a add |
| 17 | define void @shuf2(<3 x float>* %dst.addr, <3 x float> %src1,<3 x float> %src2) nounwind { |
| 18 | entry: |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 19 | ; CHECK: shuf2: |
| 20 | ; CHECK: extractps |
Mon P Wang | f62546a | 2010-06-04 01:20:10 +0000 | [diff] [blame] | 21 | ; CHECK: extractps |
| 22 | %x = shufflevector <3 x float> %src1, <3 x float> %src2, <3 x i32> < i32 0, i32 4, i32 2> |
| 23 | %val = fadd <3 x float> %x, %src2 |
| 24 | store <3 x float> %val, <3 x float>* %dst.addr |
| 25 | ret void |
| 26 | } |
| 27 | |
| 28 | ; Example of when widening a v3float operation causes the DAG to replace a node |
| 29 | ; with the operation that we are currently widening, i.e. when replacing |
| 30 | ; opA with opB, the DAG will produce new operations with opA. |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 31 | define void @shuf3(<4 x float> %tmp10, <4 x float> %vecinit15, <4 x float>* %dst) nounwind { |
Mon P Wang | f62546a | 2010-06-04 01:20:10 +0000 | [diff] [blame] | 32 | entry: |
Eli Friedman | 0381c21 | 2011-07-20 18:14:33 +0000 | [diff] [blame] | 33 | ; CHECK: shuf3: |
Mon P Wang | f62546a | 2010-06-04 01:20:10 +0000 | [diff] [blame] | 34 | ; CHECK: pshufd |
| 35 | %shuffle.i.i.i12 = shufflevector <4 x float> %tmp10, <4 x float> %vecinit15, <4 x i32> <i32 0, i32 1, i32 4, i32 5> |
| 36 | %tmp25.i.i = shufflevector <4 x float> %shuffle.i.i.i12, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> |
| 37 | %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> |
| 38 | %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>> |
| 39 | %tmp6.i14 = shufflevector <3 x float> %tmp3.i13, <3 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 3> |
| 40 | %tmp97.i = shufflevector <4 x float> %tmp6.i14, <4 x float> undef, <3 x i32> <i32 0, i32 1, i32 2> |
| 41 | %tmp2.i18 = shufflevector <3 x float> %tmp97.i, <3 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 2> |
| 42 | %t5 = bitcast <4 x float> %tmp2.i18 to <4 x i32> |
| 43 | %shr.i.i19 = lshr <4 x i32> %t5, <i32 19, i32 19, i32 19, i32 19> |
| 44 | %and.i.i20 = and <4 x i32> %shr.i.i19, <i32 4080, i32 4080, i32 4080, i32 4080> |
| 45 | %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> |
| 46 | store <4 x float> %shuffle.i.i.i21, <4 x float>* %dst |
| 47 | ret void |
| 48 | } |
| 49 | |
Eli Friedman | 0381c21 | 2011-07-20 18:14:33 +0000 | [diff] [blame] | 50 | ; PR10421: make sure we correctly handle extreme widening with CONCAT_VECTORS |
| 51 | define <8 x i8> @shuf4(<4 x i8> %a, <4 x i8> %b) nounwind readnone { |
| 52 | ; CHECK: shuf4: |
| 53 | ; CHECK: punpckldq |
| 54 | %vshuf = shufflevector <4 x i8> %a, <4 x i8> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 55 | ret <8 x i8> %vshuf |
| 56 | } |