[PATCH] D120570: [SVE] Add pattern to commute FMSB operands

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 28 13:17:37 PST 2022


paulwalker-arm added a comment.

In D120570#3349616 <https://reviews.llvm.org/D120570#3349616>, @cameron.mcinally wrote:

> @paulwalker-arm, I wasn't sure if the PatFrags live at the head of the file, or close to the pattern that uses them. I chose the head. Keep an eye out for that.

PatFrags placement looks perfect to me.



================
Comment at: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td:288-291
+def AArch64fmls_p : PatFrags<(ops node:$pred, node:$op1, node:$op2, node:$op3),
+                          [(AArch64fma_p node:$pred, (AArch64fneg_mt node:$pred, node:$op1, (undef)), node:$op2, node:$op3),
+                           (AArch64fma_p node:$pred, node:$op1, (AArch64fneg_mt node:$pred, node:$op2, (undef)), node:$op3)]>;
+
----------------
When creating the PatFrags you want the `ops` operands to be treated consistently. In this instance you always want `$op1` to be the negated operand because that is the operand that will be negated by the instruction you'll eventually match it to. So the first pattern is fine but the second should switch the usage of `$op1` and `$op2`.


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

https://reviews.llvm.org/D120570



More information about the llvm-commits mailing list