diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index dfd41b717f4..55b1f012252 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -5481,7 +5481,7 @@ X86TargetLowering::LowerVectorBroadcast(SDValue Op, SelectionDAG &DAG) const { return SDValue(); // Use the register form of the broadcast instruction available on AVX2. - if (VT.is256BitVector()) + if (VT.getSizeInBits() >= 256) Sc = Extract128BitVector(Sc, 0, DAG, dl); return DAG.getNode(X86ISD::VBROADCAST, dl, VT, Sc); } diff --git a/test/CodeGen/X86/avx512-vbroadcast.ll b/test/CodeGen/X86/avx512-vbroadcast.ll index d4ba6bd2b8f..6f89d6ce234 100644 --- a/test/CodeGen/X86/avx512-vbroadcast.ll +++ b/test/CodeGen/X86/avx512-vbroadcast.ll @@ -35,3 +35,19 @@ define <8 x double> @_inreg8xdouble(double %a) { %c = shufflevector <8 x double> %b, <8 x double> undef, <8 x i32> zeroinitializer ret <8 x double> %c } + +;CHECK-LABEL: _xmm16xi32 +;CHECK: vpbroadcastd +;CHECK: ret +define <16 x i32> @_xmm16xi32(<16 x i32> %a) { + %b = shufflevector <16 x i32> %a, <16 x i32> undef, <16 x i32> zeroinitializer + ret <16 x i32> %b +} + +;CHECK-LABEL: _xmm16xfloat +;CHECK: vbroadcastssz +;CHECK: ret +define <16 x float> @_xmm16xfloat(<16 x float> %a) { + %b = shufflevector <16 x float> %a, <16 x float> undef, <16 x i32> zeroinitializer + ret <16 x float> %b +}