[PATCH] D88890: [AMDGPU] Add patterns for mad/mac legacy f32 instructions

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 09:12:26 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIInstructions.td:886-887
+def : GCNPat <
+      (f32 (fadd (AMDGPUfmul_legacy (VOP3NoMods f32:$src0),
+                                    (VOP3NoMods f32:$src1)),
+                 (VOP3NoMods f32:$src2))),
----------------
arsenm wrote:
> foad wrote:
> > arsenm wrote:
> > > But these do have modifiers?
> > Sure, but that's covered by the TODO at line 869. I could repeat the comment here. I assume there was some reason it wasn't totally straightforward (maybe something to do with the tied operands?) else it would've been done already.
> I think it is straightforward, and just n/nobody bothered to do it
Having looked into this some more, I think there is no point selecting v_mac with modifiers, because that would force VOP3 encoding, at which point there is no downside to using v_mad instead:
- it's always available (there are subtargets with only v_mad but none with only v_mac)
- it's no bigger
- it lets you use different registers for dst and src2
- it lets you ave modifiers on all three inputs

If this sounds reasonable I'll update the comments but leave the implementation as-is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88890



More information about the llvm-commits mailing list