From: Simon Pilgrim Date: Fri, 22 Mar 2019 17:23:55 +0000 (+0000) Subject: [X86] lowerShuffleAsBitMask - ensure float bit masks are the correct width (PR41203) X-Git-Tag: llvmorg-10-init~9367 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=564392d752d2b9b2018e401a17145d604c1cb3cc;p=platform%2Fupstream%2Fllvm.git [X86] lowerShuffleAsBitMask - ensure float bit masks are the correct width (PR41203) llvm-svn: 356784 --- diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9f02d2f..5de8ea9 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -10385,11 +10385,11 @@ static SDValue lowerShuffleAsBitMask(const SDLoc &DL, MVT VT, SDValue V1, MVT LogicVT = VT; if (EltVT == MVT::f32 || EltVT == MVT::f64) { - Zero = DAG.getConstantFP(0.0, DL, MVT::f64); - AllOnes = DAG.getConstantFP(APInt::getAllOnesValue(64).bitsToDouble(), DL, - EltVT); - LogicVT = MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, - Mask.size()); + Zero = DAG.getConstantFP(0.0, DL, EltVT); + AllOnes = DAG.getConstantFP( + APFloat::getAllOnesValue(EltVT.getSizeInBits(), true), DL, EltVT); + LogicVT = + MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, Mask.size()); } else { Zero = DAG.getConstant(0, DL, EltVT); AllOnes = DAG.getAllOnesConstant(DL, EltVT); diff --git a/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll b/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll index 18aa932..458d670 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll @@ -156,6 +156,17 @@ define <16 x float> @shuffle_v16f32_03_uu_uu_uu_uu_04_uu_uu_uu_uu_11_uu_uu_uu_uu ret <16 x float> %shuffle } +; PR41203 +define <16 x float> @shuffle_v16f32_00_17_02_19_04_21_06_23_08_25_10_27_12_29_14_31(<16 x float> %a) { +; ALL-LABEL: shuffle_v16f32_00_17_02_19_04_21_06_23_08_25_10_27_12_29_14_31: +; ALL: # %bb.0: +; ALL-NEXT: vandps {{.*}}(%rip), %zmm0, %zmm0 +; ALL-NEXT: retq + %tmp1 = shufflevector <16 x float> %a, <16 x float> undef, <16 x i32> + %tmp2 = shufflevector <16 x float> %tmp1, <16 x float> , <16 x i32> + ret <16 x float> %tmp2 +} + define <16 x i32> @shuffle_v16i32_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00(<16 x i32> %a, <16 x i32> %b) { ; ALL-LABEL: shuffle_v16i32_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00: ; ALL: # %bb.0: