[PATCH] D159283: Add intrinsic to count trailing zero elements in a vector

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 08:27:19 PDT 2023


kmclaughlin added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:7548
+          DAG.getSelectCC(DL, Sub, VL, DAG.getUNDEF(NewEltTy), Sub, ISD::SETEQ);
+    }
+
----------------
nikic wrote:
> I don't think this bit makes sense. The zero-is-poison flag *allows* you to return poison if this input is zero, but you don't have to return it. Setting this kind of flag should never result in more complex code, as you are generating here.
Thanks @nikic, I misunderstood what the zero-is-poison flag was used for. I've removed the getSelectCC here and instead only use the flag above when computing the smallest vector element type that can be chosen for the expansion.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:5343
+    assert(cast<ConstantSDNode>(getValue(I.getOperand(1)))->getZExtValue() !=
+           0);
+
----------------
nikic wrote:
> I don't get what guarantees this assertion (or why it would make sense to assert this at all).
Removed - there was nothing to guarantee that the flag would be zero here and we would want to lower the intrinsic for both possible values.


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

https://reviews.llvm.org/D159283



More information about the llvm-commits mailing list