Skip to content

Commit

Permalink
[RISCV] Check if v extension is enabled by the function features for …
Browse files Browse the repository at this point in the history
…the builtins not in Zve64*. (#112827)

Fixes: #109694
  • Loading branch information
tclin914 authored Oct 18, 2024
1 parent eb446eb commit e8509a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clang/lib/Sema/SemaRISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,12 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
ASTContext::BuiltinVectorTypeInfo Info = Context.getBuiltinVectorTypeInfo(
TheCall->getType()->castAs<BuiltinType>());

if (Context.getTypeSize(Info.ElementType) == 64 && !TI.hasFeature("v"))
const FunctionDecl *FD = SemaRef.getCurFunctionDecl();
llvm::StringMap<bool> FunctionFeatureMap;
Context.getFunctionFeatureMap(FunctionFeatureMap, FD);

if (Context.getTypeSize(Info.ElementType) == 64 && !TI.hasFeature("v") &&
!FunctionFeatureMap.lookup("v"))
return Diag(TheCall->getBeginLoc(),
diag::err_riscv_builtin_requires_extension)
<< /* IsExtension */ true << TheCall->getSourceRange() << "v";
Expand Down

0 comments on commit e8509a4

Please sign in to comment.