[PATCH] D113986: [AMDGPU] Implement widening multiplies with v_mad_i64_i32/v_mad_u64_u32

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 06:23:41 PST 2021


foad added a comment.

In D113986#3134553 <https://reviews.llvm.org/D113986#3134553>, @arsenm wrote:

> GlobalISel version?

Yes that would be nice, but GlobalISel doesn't seem to have a GMIR opcode corresponding to [su]mul_lohi, at least not yet, so I'm not sure what the best approach would be. Anyway this patch is big enough already so I'd prefer to keep it for SelectionDAG and work on GlobalISel later.



================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1014
+
+  SDValue Zero = CurDAG->getTargetConstant(0, SL, MVT::i64);
+  SDValue Clamp = CurDAG->getTargetConstant(0, SL, MVT::i1);
----------------
arsenm wrote:
> Could this try to do better than 0 if the source is an add?
No, not if the source is an add. It would have to be if the result is used in an add, like what SITargetLowering::performAddCombine does for i64 mul. That's the further improvement I alluded to in the commit message.


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:812-813
 
+  setOperationAction(ISD::SMUL_LOHI, MVT::i32, Custom);
+  setOperationAction(ISD::UMUL_LOHI, MVT::i32, Custom);
+
----------------
arsenm wrote:
> Seems missing a subtarget check, I'm pretty sure gfx6 didn't have mad_u64_u32
Good point, will fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113986/new/

https://reviews.llvm.org/D113986



More information about the llvm-commits mailing list