[clang] 1366221 - [RISCV] Simplify checking whether SEW=64 multiply builtins require V. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 12:21:40 PST 2023


Author: Craig Topper
Date: 2023-12-11T12:21:09-08:00
New Revision: 13662211c32cb9034b67d7fe0fb73fdebd15471e

URL: https://github.com/llvm/llvm-project/commit/13662211c32cb9034b67d7fe0fb73fdebd15471e
DIFF: https://github.com/llvm/llvm-project/commit/13662211c32cb9034b67d7fe0fb73fdebd15471e.diff

LOG: [RISCV] Simplify checking whether SEW=64 multiply builtins require V. NFC

We only need to check the result type. Use getBuiltinVectorTypeInfo
to lookup the element size.

Added: 
    

Modified: 
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 08c03d75ec3c8..4c5187774233e 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5213,12 +5213,10 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
   case RISCVVector::BI__builtin_rvv_vsmul_vx_tum:
   case RISCVVector::BI__builtin_rvv_vsmul_vv_tumu:
   case RISCVVector::BI__builtin_rvv_vsmul_vx_tumu: {
-    bool RequireV = false;
-    for (unsigned ArgNum = 0; ArgNum < TheCall->getNumArgs(); ++ArgNum)
-      RequireV |= TheCall->getArg(ArgNum)->getType()->isRVVType(
-          /* Bitwidth */ 64, /* IsFloat */ false);
+    ASTContext::BuiltinVectorTypeInfo Info = Context.getBuiltinVectorTypeInfo(
+        TheCall->getType()->castAs<BuiltinType>());
 
-    if (RequireV && !TI.hasFeature("v"))
+    if (Context.getTypeSize(Info.ElementType) == 64 && !TI.hasFeature("v"))
       return Diag(TheCall->getBeginLoc(),
                   diag::err_riscv_builtin_requires_extension)
              << /* IsExtension */ false << TheCall->getSourceRange() << "v";


        


More information about the cfe-commits mailing list