[PATCH] D44345: [X86] Add comments to the end of FMA3 instructions to make the operation clear

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 10 07:55:00 PST 2018


spatel added inline comments.


================
Comment at: lib/Target/X86/InstPrinter/X86InstComments.cpp:453
+  bool Negate = false;
+  StringRef OpStr = "+";
+
----------------
OpStr -> AccStr ?


================
Comment at: lib/Target/X86/InstPrinter/X86InstComments.cpp:465
+  CASE_FMA_SCALAR_MEM(FMADD132)
+    AccName = getRegName(MI->getOperand(NumOperands-(RegForm?2:6)).getReg());
+    Mul1Name = getRegName(MI->getOperand(1).getReg());
----------------
A comment to explain the operand array would be helpful. IIUC, we're hardcoding getOperand(1) in all cases, so can we just hardcode the rest to simplify the code?

So we'd have something like:

  CASE_FMA_SCALAR_REG(FMADD132)
    Mul2Name = getRegName(MI->getOperand(3).getReg());
    LLVM_FALLTHROUGH;
  CASE_FMA_PACKED_MEM(FMADD132)
  CASE_FMA_SCALAR_MEM(FMADD132)
    AccName = getRegName(MI->getOperand(2).getReg());
    Mul1Name = getRegName(MI->getOperand(1).getReg());
    break;


https://reviews.llvm.org/D44345





More information about the llvm-commits mailing list