1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s 2 ; XFAIL: * 3 4 ; xfail this file for now because of PR8156, when it gets solved merge this with avx-splat.ll 5 6 ; CHECK: vbroadcastsd (% 7 define <4 x i64> @A(i64* %ptr) nounwind uwtable readnone ssp { 8 entry: 9 %q = load i64* %ptr, align 8 10 %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0 11 %vecinit2.i = insertelement <4 x i64> %vecinit.i, i64 %q, i32 1 12 %vecinit4.i = insertelement <4 x i64> %vecinit2.i, i64 %q, i32 2 13 %vecinit6.i = insertelement <4 x i64> %vecinit4.i, i64 %q, i32 3 14 ret <4 x i64> %vecinit6.i 15 } 16 17 ; CHECK: vbroadcastss (% 18 define <8 x i32> @B(i32* %ptr) nounwind uwtable readnone ssp { 19 entry: 20 %q = load i32* %ptr, align 4 21 %vecinit.i = insertelement <8 x i32> undef, i32 %q, i32 0 22 %vecinit2.i = insertelement <8 x i32> %vecinit.i, i32 %q, i32 1 23 %vecinit4.i = insertelement <8 x i32> %vecinit2.i, i32 %q, i32 2 24 %vecinit6.i = insertelement <8 x i32> %vecinit4.i, i32 %q, i32 3 25 ret <8 x i32> %vecinit6.i 26 } 27 28 ; CHECK: vbroadcastsd (% 29 define <4 x double> @C(double* %ptr) nounwind uwtable readnone ssp { 30 entry: 31 %q = load double* %ptr, align 8 32 %vecinit.i = insertelement <4 x double> undef, double %q, i32 0 33 %vecinit2.i = insertelement <4 x double> %vecinit.i, double %q, i32 1 34 %vecinit4.i = insertelement <4 x double> %vecinit2.i, double %q, i32 2 35 %vecinit6.i = insertelement <4 x double> %vecinit4.i, double %q, i32 3 36 ret <4 x double> %vecinit6.i 37 } 38 39 ; CHECK: vbroadcastss (% 40 define <8 x float> @D(float* %ptr) nounwind uwtable readnone ssp { 41 entry: 42 %q = load float* %ptr, align 4 43 %vecinit.i = insertelement <8 x float> undef, float %q, i32 0 44 %vecinit2.i = insertelement <8 x float> %vecinit.i, float %q, i32 1 45 %vecinit4.i = insertelement <8 x float> %vecinit2.i, float %q, i32 2 46 %vecinit6.i = insertelement <8 x float> %vecinit4.i, float %q, i32 3 47 ret <8 x float> %vecinit6.i 48 } 49 50 ;;;; 128-bit versions 51 52 ; CHECK: vbroadcastss (% 53 define <4 x float> @E(float* %ptr) nounwind uwtable readnone ssp { 54 entry: 55 %q = load float* %ptr, align 4 56 %vecinit.i = insertelement <4 x float> undef, float %q, i32 0 57 %vecinit2.i = insertelement <4 x float> %vecinit.i, float %q, i32 1 58 %vecinit4.i = insertelement <4 x float> %vecinit2.i, float %q, i32 2 59 %vecinit6.i = insertelement <4 x float> %vecinit4.i, float %q, i32 3 60 ret <4 x float> %vecinit6.i 61 } 62 63 ; CHECK: vbroadcastss (% 64 define <4 x i32> @F(i32* %ptr) nounwind uwtable readnone ssp { 65 entry: 66 %q = load i32* %ptr, align 4 67 %vecinit.i = insertelement <4 x i32> undef, i32 %q, i32 0 68 %vecinit2.i = insertelement <4 x i32> %vecinit.i, i32 %q, i32 1 69 %vecinit4.i = insertelement <4 x i32> %vecinit2.i, i32 %q, i32 2 70 %vecinit6.i = insertelement <4 x i32> %vecinit4.i, i32 %q, i32 3 71 ret <4 x i32> %vecinit6.i 72 } 73 74 ; Unsupported vbroadcasts 75 76 ; CHECK: _G 77 ; CHECK-NOT: vbroadcastsd (% 78 ; CHECK: ret 79 define <2 x i64> @G(i64* %ptr) nounwind uwtable readnone ssp { 80 entry: 81 %q = load i64* %ptr, align 8 82 %vecinit.i = insertelement <2 x i64> undef, i64 %q, i32 0 83 %vecinit2.i = insertelement <2 x i64> %vecinit.i, i64 %q, i32 1 84 ret <2 x i64> %vecinit2.i 85 } 86 87 ; CHECK: _H 88 ; CHECK-NOT: vbroadcastss 89 ; CHECK: ret 90 define <4 x i32> @H(<4 x i32> %a) { 91 %x = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> 92 ret <4 x i32> %x 93 } 94 95