[PATCH] D68203: Add support for (expressing) vscale.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 18:09:35 PST 2020


efriedma added a comment.

Does it make sense to have a special case for vscale * 1 or vscale * -1?  Not that it's likely to come up in most cases, but it would look pretty silly to generate a madd that multiplies by 1.



================
Comment at: llvm/docs/LangRef.rst:17753
+execution, but is unknown at compile time. The ``scaling`` immediate is
+multiplied at runtime with ``vscale``.
+
----------------
What happens if the multiply overflows?


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:2019
+          VectorType::get(Type::getInt8Ty(II->getContext()), 1, true);
+      if (DL->getTypeAllocSize(ScalableVectorTy).getKnownMinSize() == 8) {
+        auto Null = Constant::getNullValue(ScalableVectorTy->getPointerTo());
----------------
This should do the right thing, as far as I know.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5139
+      int64_t MulImm = cast<ConstantSDNode>(N1->getOperand(0))->getSExtValue();
+      return getVScale(DL, VT, MulImm * N2C->getSExtValue());
+    }
----------------
This multiply can overflow.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5180
+      int64_t MulImm = cast<ConstantSDNode>(N1->getOperand(0))->getSExtValue();
+      return getVScale(DL, VT, MulImm << N2C->getSExtValue());
+    }
----------------
This shift can overflow.


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

https://reviews.llvm.org/D68203





More information about the llvm-commits mailing list