[PATCH] D117703: [RISCV] Enable CGP to sink splat operands of VP intrinsics

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 07:54:03 PST 2022


frasercrmck added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1263
+        // it on the RHS, because TableGen doesn't recognize our VP operations
+        // as commutative.
+        case Intrinsic::vp_add:
----------------
Ah hah, I see what's going on here. Our VL patterns //are// commutative, but only the unmasked ones. The masked ones use `V0` which is a subclass of `Register` and so is skipped during the commutative `NC` calculation in `CodeGenDAGPatterns`'s `GenerateVariantsOf`. Then, since `NC != N->getNumChildren()`, the commutative variants aren't generated.

I don't fully understand this part about `Register` leaves but isn't it sufficient to check whether the //first// 2 or 3 operands aren't `Register`s (the actual commutable operands) and let the tail operands do as they wish?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117703



More information about the llvm-commits mailing list