[PATCH] D149260: [AArch64] Emit FNMADD instead of FNEG(FMADD)

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 03:56:07 PDT 2023


david-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:5708
+  MachineInstr *MAD = MRI.getUniqueVRegDef(Root.getOperand(1).getReg());
+  if (!MRI.hasOneUse(MAD->getOperand(0).getReg()))
+    return nullptr;
----------------
I think we should probably be doing this check in `getFNEGPatterns` - this is similar to how it's done in `canCombineWithFMUL`, which is called from `getFMAPatterns`.

Also, I think this should be `hasOneNonDBGUse` to avoid debug info blocking your wonderful optimisation. :)


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:5718
+  else
+    return nullptr;
+
----------------
nit: Sorry I didn't pick this up before, but I expect this can just be

  else
    llvm_unreachable("Unexpected opcode");

because we only ever matched the double and single variants in getFNEGPatterns?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149260



More information about the llvm-commits mailing list