Skip to content

Commit 8076ee9

Browse files
committed
[RISCV] Use getBuiltinVectorTypeInfo instead of isRVVType.
I'm trying to remove all uses of isRVVType. Fix diagnostic message to report an error for the builtin instead of the type. Though I can't seem to get a test to hit it.
1 parent 5c37e71 commit 8076ee9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5388,15 +5388,17 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
53885388
QualType Op1Type = TheCall->getArg(0)->getType();
53895389
QualType Op2Type = TheCall->getArg(1)->getType();
53905390
QualType Op3Type = TheCall->getArg(2)->getType();
5391-
uint64_t ElemSize = Op1Type->isRVVType(32, false) ? 32 : 64;
5391+
ASTContext::BuiltinVectorTypeInfo Info =
5392+
Context.getBuiltinVectorTypeInfo(Op1Type->castAs<BuiltinType>());
5393+
uint64_t ElemSize = Context.getTypeSize(Info.ElementType);
53925394
if (ElemSize == 64 && !TI.hasFeature("zvknhb"))
53935395
return Diag(TheCall->getBeginLoc(),
5394-
diag::err_riscv_type_requires_extension)
5395-
<< Op1Type << "zvknhb";
5396+
diag::err_riscv_builtin_requires_extension)
5397+
<< /* IsExtension */ true << TheCall->getSourceRange() << "zvknb";
53965398

5397-
return CheckInvalidVLENandLMUL(TI, TheCall, *this, Op1Type, ElemSize << 2) ||
5398-
CheckInvalidVLENandLMUL(TI, TheCall, *this, Op2Type, ElemSize << 2) ||
5399-
CheckInvalidVLENandLMUL(TI, TheCall, *this, Op3Type, ElemSize << 2);
5399+
return CheckInvalidVLENandLMUL(TI, TheCall, *this, Op1Type, ElemSize * 4) ||
5400+
CheckInvalidVLENandLMUL(TI, TheCall, *this, Op2Type, ElemSize * 4) ||
5401+
CheckInvalidVLENandLMUL(TI, TheCall, *this, Op3Type, ElemSize * 4);
54005402
}
54015403

54025404
case RISCVVector::BI__builtin_rvv_sf_vc_i_se_u8mf8:

0 commit comments

Comments
 (0)