[llvm] [AMDGPU] Fix lowerFCOPYSIGN dropping the sign bit when narrowing the sign operand (PR #203492)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 06:14:09 PDT 2026
================
@@ -8873,11 +8873,15 @@ SDValue SITargetLowering::lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const {
return Op;
// fcopysign v2f16:mag, v2f32:sign ->
- // fcopysign v2f16:mag, bitcast (trunc (bitcast sign to v2i32) to v2i16)
+ // fcopysign v2f16:mag,
+ // bitcast (trunc (srl (bitcast sign to v2i32), 16) to v2i16)
SDLoc SL(Op);
SDValue SignAsInt32 = DAG.getNode(ISD::BITCAST, SL, MVT::v2i32, Sign);
- SDValue SignAsInt16 = DAG.getNode(ISD::TRUNCATE, SL, MVT::v2i16, SignAsInt32);
+ SDValue ShiftAmt = DAG.getShiftAmountConstant(16, MVT::v2i32, SL);
----------------
aobolensk wrote:
Shall we modify it?
https://github.com/llvm/llvm-project/pull/203492
More information about the llvm-commits
mailing list