1 ; RUN: llc < %s -march=x86 -mcpu=core2 -mattr=+ssse3 | FileCheck %s 2 ; RUN: llc < %s -march=x86 -mcpu=yonah | FileCheck --check-prefix=YONAH %s 3 4 define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind { 5 ; CHECK: test1: 6 ; CHECK: pshufd 7 ; CHECK-YONAH: pshufd 8 %C = shufflevector <4 x i32> %A, <4 x i32> undef, <4 x i32> < i32 1, i32 2, i32 3, i32 0 > 9 ret <4 x i32> %C 10 } 11 12 define <4 x i32> @test2(<4 x i32> %A, <4 x i32> %B) nounwind { 13 ; CHECK: test2: 14 ; CHECK: palignr 15 ; CHECK-YONAH: shufps 16 %C = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> < i32 1, i32 2, i32 3, i32 4 > 17 ret <4 x i32> %C 18 } 19 20 define <4 x i32> @test3(<4 x i32> %A, <4 x i32> %B) nounwind { 21 ; CHECK: test3: 22 ; CHECK: palignr 23 %C = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> < i32 1, i32 2, i32 undef, i32 4 > 24 ret <4 x i32> %C 25 } 26 27 define <4 x i32> @test4(<4 x i32> %A, <4 x i32> %B) nounwind { 28 ; CHECK: test4: 29 ; CHECK: palignr 30 %C = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> < i32 6, i32 7, i32 undef, i32 1 > 31 ret <4 x i32> %C 32 } 33 34 define <4 x float> @test5(<4 x float> %A, <4 x float> %B) nounwind { 35 ; CHECK: test5: 36 ; CHECK: palignr 37 %C = shufflevector <4 x float> %A, <4 x float> %B, <4 x i32> < i32 6, i32 7, i32 undef, i32 1 > 38 ret <4 x float> %C 39 } 40 41 define <8 x i16> @test6(<8 x i16> %A, <8 x i16> %B) nounwind { 42 ; CHECK: test6: 43 ; CHECK: palignr 44 %C = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 3, i32 4, i32 undef, i32 6, i32 7, i32 8, i32 9, i32 10 > 45 ret <8 x i16> %C 46 } 47 48 define <8 x i16> @test7(<8 x i16> %A, <8 x i16> %B) nounwind { 49 ; CHECK: test7: 50 ; CHECK: palignr 51 %C = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 undef, i32 6, i32 undef, i32 8, i32 9, i32 10, i32 11, i32 12 > 52 ret <8 x i16> %C 53 } 54 55 define <16 x i8> @test8(<16 x i8> %A, <16 x i8> %B) nounwind { 56 ; CHECK: test8: 57 ; CHECK: palignr 58 %C = shufflevector <16 x i8> %A, <16 x i8> %B, <16 x i32> < i32 5, i32 6, i32 7, i32 undef, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20 > 59 ret <16 x i8> %C 60 } 61 62 ; Check that we don't do unary (circular on single operand) palignr incorrectly. 63 ; (It is possible, but before this testcase was committed, it was being done 64 ; incorrectly. In particular, one of the operands of the palignr node 65 ; was an UNDEF.) 66 define <8 x i16> @test9(<8 x i16> %A, <8 x i16> %B) nounwind { 67 ; CHECK: test9: 68 ; CHECK-NOT: palignr 69 ; CHECK: pshufb 70 %C = shufflevector <8 x i16> %B, <8 x i16> %A, <8 x i32> < i32 undef, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0 > 71 ret <8 x i16> %C 72 } 73 74