[llvm-branch-commits] [RISCV][MC] Warn if SEW/LMUL may not be compatible (PR #94313)

Craig Topper via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 5 10:20:17 PDT 2024


================
@@ -2211,6 +2223,18 @@ ParseStatus RISCVAsmParser::parseVTypeI(OperandVector &Operands) {
 
   if (getLexer().is(AsmToken::EndOfStatement) && State == VTypeState_Done) {
     RISCVII::VLMUL VLMUL = RISCVVType::encodeLMUL(Lmul, Fractional);
+    if (Fractional) {
+      unsigned ELEN = STI->hasFeature(RISCV::FeatureStdExtZve64x) ? 64 : 32;
+      unsigned MaxSEW = ELEN / Lmul;
+      // If MaxSEW < 8, we should have printed warning about reserved LMUL.
+      if (MaxSEW >= 8 && Sew > MaxSEW)
+        Warning(
+            SEWLoc,
+            Twine("The use of vtype encodings with SEW > ") + Twine(MaxSEW) +
----------------
topperc wrote:

I don't think you need `Twine` around the strings. https://www.llvm.org/docs/CodingStandards.html#error-and-warning-messages

You can probably drop the word "The" at the beginning.

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


More information about the llvm-branch-commits mailing list