Skip to content

Commit 699d636

Browse files
committed
Make test for bitwise src mods more stringent and correct fneg-fabs order
1 parent 3fc4536 commit 699d636

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
@@ -4864,17 +4864,20 @@ static SDValue getBitwiseToSrcModifierOp(SDValue N,
48644864

48654865
switch (Opc) {
48664866
case ISD::XOR:
4867-
if (Mask == 0x80000000u || Mask == 0x8000000000000000u)
4867+
if ((Mask == 0x80000000u && VT.getFixedSizeInBits() == 32) ||
4868+
(Mask == 0x8000000000000000u && VT.getFixedSizeInBits() == 64))
48684869
return DAG.getNode(ISD::FNEG, SL, FVT, BC);
48694870
break;
48704871
case ISD::OR:
4871-
if (Mask == 0x80000000u || Mask == 0x8000000000000000u) {
4872-
SDValue Neg = DAG.getNode(ISD::FNEG, SDLoc(N), FVT, BC);
4873-
return DAG.getNode(ISD::FABS, SL, FVT, Neg);
4872+
if ((Mask == 0x80000000u && VT.getFixedSizeInBits() == 32) ||
4873+
(Mask == 0x8000000000000000u && VT.getFixedSizeInBits() == 64)) {
4874+
SDValue Abs = DAG.getNode(ISD::ABS, SDLoc(N), FVT, BC);
4875+
return DAG.getNode(ISD::FNEG, SL, FVT, Abs);
48744876
}
48754877
break;
48764878
case ISD::AND:
4877-
if (Mask == 0x7fffffffu || Mask == 0x7fffffffffffffffu)
4879+
if ((Mask == 0x7fffffffu && VT.getFixedSizeInBits() == 32) ||
4880+
(Mask == 0x7fffffffffffffffu && VT.getFixedSizeInBits() == 64))
48784881
return DAG.getNode(ISD::FABS, SL, FVT, BC);
48794882
break;
48804883
default:

0 commit comments

Comments
 (0)