Skip to content

Commit 2604329

Browse files
committed
Make test for bitwise src mods more stringent and correct fneg-fabs order
1 parent 000ddc8 commit 2604329

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4876,17 +4876,20 @@ static SDValue getBitwiseToSrcModifierOp(SDValue N,
48764876

48774877
switch (Opc) {
48784878
case ISD::XOR:
4879-
if (Mask == 0x80000000u || Mask == 0x8000000000000000u)
4879+
if ((Mask == 0x80000000u && VT.getFixedSizeInBits() == 32) ||
4880+
(Mask == 0x8000000000000000u && VT.getFixedSizeInBits() == 64))
48804881
return DAG.getNode(ISD::FNEG, SL, FVT, BC);
48814882
break;
48824883
case ISD::OR:
4883-
if (Mask == 0x80000000u || Mask == 0x8000000000000000u) {
4884-
SDValue Neg = DAG.getNode(ISD::FNEG, SDLoc(N), FVT, BC);
4885-
return DAG.getNode(ISD::FABS, SL, FVT, Neg);
4884+
if ((Mask == 0x80000000u && VT.getFixedSizeInBits() == 32) ||
4885+
(Mask == 0x8000000000000000u && VT.getFixedSizeInBits() == 64)) {
4886+
SDValue Abs = DAG.getNode(ISD::ABS, SDLoc(N), FVT, BC);
4887+
return DAG.getNode(ISD::FNEG, SL, FVT, Abs);
48864888
}
48874889
break;
48884890
case ISD::AND:
4889-
if (Mask == 0x7fffffffu || Mask == 0x7fffffffffffffffu)
4891+
if ((Mask == 0x7fffffffu && VT.getFixedSizeInBits() == 32) ||
4892+
(Mask == 0x7fffffffffffffffu && VT.getFixedSizeInBits() == 64))
48904893
return DAG.getNode(ISD::FABS, SL, FVT, BC);
48914894
break;
48924895
default:

0 commit comments

Comments
 (0)