Skip to content

Commit 564392d

Browse files
committed
[X86] lowerShuffleAsBitMask - ensure float bit masks are the correct width (PR41203)
llvm-svn: 356784
1 parent bfc779e commit 564392d

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10385,11 +10385,11 @@ static SDValue lowerShuffleAsBitMask(const SDLoc &DL, MVT VT, SDValue V1,
1038510385

1038610386
MVT LogicVT = VT;
1038710387
if (EltVT == MVT::f32 || EltVT == MVT::f64) {
10388-
Zero = DAG.getConstantFP(0.0, DL, MVT::f64);
10389-
AllOnes = DAG.getConstantFP(APInt::getAllOnesValue(64).bitsToDouble(), DL,
10390-
EltVT);
10391-
LogicVT = MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32,
10392-
Mask.size());
10388+
Zero = DAG.getConstantFP(0.0, DL, EltVT);
10389+
AllOnes = DAG.getConstantFP(
10390+
APFloat::getAllOnesValue(EltVT.getSizeInBits(), true), DL, EltVT);
10391+
LogicVT =
10392+
MVT::getVectorVT(EltVT == MVT::f64 ? MVT::i64 : MVT::i32, Mask.size());
1039310393
} else {
1039410394
Zero = DAG.getConstant(0, DL, EltVT);
1039510395
AllOnes = DAG.getAllOnesConstant(DL, EltVT);

llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
156156
ret <16 x float> %shuffle
157157
}
158158

159+
; PR41203
160+
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) {
161+
; ALL-LABEL: shuffle_v16f32_00_17_02_19_04_21_06_23_08_25_10_27_12_29_14_31:
162+
; ALL: # %bb.0:
163+
; ALL-NEXT: vandps {{.*}}(%rip), %zmm0, %zmm0
164+
; ALL-NEXT: retq
165+
%tmp1 = shufflevector <16 x float> %a, <16 x float> undef, <16 x i32> <i32 undef, i32 17, i32 undef, i32 19, i32 undef, i32 5, i32 undef, i32 7, i32 undef, i32 9, i32 undef, i32 11, i32 undef, i32 13, i32 undef, i32 15>
166+
%tmp2 = shufflevector <16 x float> %tmp1, <16 x float> <float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef, float 0.000000e+00, float undef>, <16 x i32> <i32 16, i32 1, i32 18, i32 3, i32 20, i32 5, i32 22, i32 7, i32 24, i32 9, i32 26, i32 11, i32 28, i32 13, i32 30, i32 15>
167+
ret <16 x float> %tmp2
168+
}
169+
159170
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) {
160171
; ALL-LABEL: shuffle_v16i32_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00:
161172
; ALL: # %bb.0:

0 commit comments

Comments
 (0)