[llvm] [llubi] Implement experimental vector intrinsics (PR #206899)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 01:14:37 PDT 2026


================
@@ -1629,6 +1725,150 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
     case Intrinsic::experimental_noalias_scope_decl:
       // FIXME: Not implemented yet. Currently it acts as a noop.
       return AnyValue();
+    case Intrinsic::experimental_cttz_elts: {
+      auto *IsZeroPoisonC = cast<ConstantInt>(CB.getArgOperand(1));
+      const bool IsZeroPoison = IsZeroPoisonC->isOne();
+
+      const auto &Vec = Args[0].asAggregate();
+      const unsigned RetBW = RetTy->getIntegerBitWidth();
+
+      if (APInt::getMaxValue(RetBW).ult(Vec.size())) {
+        reportImmediateUB() << "experimental.cttz.elts return type too narrow.";
----------------
nikic wrote:

This needs to be fixed in LangRef. The intrinsic is marked as speculatable, so obviously this needs to be poison, not UB.

https://github.com/llvm/llvm-project/pull/206899


More information about the llvm-commits mailing list