1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s 2 3 ; CHECK: _A 4 ; CHECK: vperm2f128 $1 5 define <8 x float> @A(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 6 entry: 7 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3> 8 ret <8 x float> %shuffle 9 } 10 11 ; CHECK: _B 12 ; CHECK: vblendps $240 13 define <8 x float> @B(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 14 entry: 15 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15> 16 ret <8 x float> %shuffle 17 } 18 19 ; CHECK: _C 20 ; CHECK: vperm2f128 $0 21 define <8 x float> @C(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 22 entry: 23 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3> 24 ret <8 x float> %shuffle 25 } 26 27 ; CHECK: _D 28 ; CHECK: vperm2f128 $17 29 define <8 x float> @D(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 30 entry: 31 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 4, i32 5, i32 6, i32 7> 32 ret <8 x float> %shuffle 33 } 34 35 ; CHECK: _E 36 ; CHECK: vperm2f128 $17 37 define <32 x i8> @E(<32 x i8> %a, <32 x i8> %b) nounwind uwtable readnone ssp { 38 entry: 39 %shuffle = shufflevector <32 x i8> %a, <32 x i8> %b, <32 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31> 40 ret <32 x i8> %shuffle 41 } 42 43 ; CHECK: _E2 44 ; CHECK: vperm2f128 $3 45 define <4 x i64> @E2(<4 x i64> %a, <4 x i64> %b) nounwind uwtable readnone ssp { 46 entry: 47 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 6, i32 7, i32 0, i32 1> 48 ret <4 x i64> %shuffle 49 } 50 51 ;;;; Cases with undef indicies mixed in the mask 52 53 ; CHECK: _F 54 ; CHECK: vperm2f128 $33 55 define <8 x float> @F(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 56 entry: 57 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 undef, i32 undef, i32 6, i32 7, i32 undef, i32 9, i32 undef, i32 11> 58 ret <8 x float> %shuffle 59 } 60 61 ;;;; Cases we must not select vperm2f128 62 63 ; CHECK: _G 64 ; CHECK-NOT: vperm2f128 65 define <8 x float> @G(<8 x float> %a, <8 x float> %b) nounwind uwtable readnone ssp { 66 entry: 67 %shuffle = shufflevector <8 x float> %a, <8 x float> %b, <8 x i32> <i32 undef, i32 undef, i32 6, i32 7, i32 undef, i32 12, i32 undef, i32 15> 68 ret <8 x float> %shuffle 69 } 70