[PATCH] D100030: [RISCV] Support OR/XOR/AND reductions on vector masks

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 11:19:32 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3032
+  case ISD::VECREDUCE_AND:
+    // vpopc !x == 0
+    Vec = DAG.getNode(RISCVISD::VMXOR_VL, DL, ContainerVT, Vec, Mask, VL);
----------------
Should this be ~x rather than !x


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3041
+  case ISD::VECREDUCE_XOR: {
+    // vpopc != 0 && vpopc != vl
+    Vec = DAG.getNode(RISCVISD::VPOPC_VL, DL, XLenVT, Vec, Mask, VL);
----------------
This doesn't make sense to me. I was thinking xor should be (vpopc & 1) != 0. Meaning it's 1 when there is an odd number of set bits.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100030



More information about the llvm-commits mailing list