[PATCH] D129626: [AArch64] Add patterns to fold zext(cmpeq(x, splat(0)))

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 16:26:13 PDT 2022


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td:451-452
+  // zext(cmpeq(x, splat(0))) -> cnot(x)
+  def : Pat<(nxv16i8 (zext (nxv16i1 (AArch64setcc_z nxv16i1:$Op1, nxv16i8:$Op2, (SVEDup0), SETEQ)))),
+            (CNOT_ZPmZ_B $Op2, $Op1, $Op2)>;
+  def : Pat<(nxv8i16 (zext (nxv8i1 (AArch64setcc_z nxv8i1:$Op1, nxv8i16:$Op2, (SVEDup0), SETEQ)))),
----------------
Are you sure these produce the same result?  It looks like the input pattern sets the result of inactive lanes to zero but `CNOT_ZPmZ_B` will set them to whatever is in `$Op2`. Perhaps the pattern should be restricted to all active predicates.

Is it possible to add these patterns to the PatFrags used to define `AArch64cnot_mt`?


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

https://reviews.llvm.org/D129626



More information about the llvm-commits mailing list