[clang][RISCV] Add RequiredFeatures for zvknha and zvknhb (#186993)
zvknhb now implies zvknha so we dont need to check extensions manually in SemaRISCV, we can just use RequiredFeatures instead.
This commit is contained in:
parent
3a1d5b5b8c
commit
c61d11df40
@ -2080,11 +2080,19 @@ let UnMaskedPolicyScheme = HasPolicyOperand, HasMasked = false in {
|
||||
defm vaesz : RVVOutBuiltinSetZvk<HasVV=0>;
|
||||
}
|
||||
|
||||
// zvknha and zvknhb has duplicated intrinsic but they don't imply each other,
|
||||
// so we need to handle it manually in SemaRISCV.cpp.
|
||||
defm vsha2ch : RVVOutOp2BuiltinSetVVZvk<"il">;
|
||||
defm vsha2cl : RVVOutOp2BuiltinSetVVZvk<"il">;
|
||||
defm vsha2ms : RVVOutOp2BuiltinSetVVZvk<"il">;
|
||||
// zvknha
|
||||
let RequiredFeatures = ["zvknha"] in {
|
||||
defm vsha2ch : RVVOutOp2BuiltinSetVVZvk<"i">;
|
||||
defm vsha2cl : RVVOutOp2BuiltinSetVVZvk<"i">;
|
||||
defm vsha2ms : RVVOutOp2BuiltinSetVVZvk<"i">;
|
||||
}
|
||||
|
||||
// zvknhb
|
||||
let RequiredFeatures = ["zvknhb"] in {
|
||||
defm vsha2ch : RVVOutOp2BuiltinSetVVZvk<"l">;
|
||||
defm vsha2cl : RVVOutOp2BuiltinSetVVZvk<"l">;
|
||||
defm vsha2ms : RVVOutOp2BuiltinSetVVZvk<"l">;
|
||||
}
|
||||
|
||||
// zvksed
|
||||
let RequiredFeatures = ["zvksed"] in {
|
||||
|
||||
@ -839,18 +839,6 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
|
||||
ASTContext::BuiltinVectorTypeInfo Info =
|
||||
Context.getBuiltinVectorTypeInfo(Arg0Type->castAs<BuiltinType>());
|
||||
uint64_t ElemSize = Context.getTypeSize(Info.ElementType);
|
||||
if (ElemSize == 64 && !TI.hasFeature("zvknhb") &&
|
||||
!FunctionFeatureMap.lookup("zvknhb"))
|
||||
return Diag(TheCall->getBeginLoc(),
|
||||
diag::err_riscv_builtin_requires_extension)
|
||||
<< /* IsExtension */ true << TheCall->getSourceRange() << "zvknhb";
|
||||
// If ElemSize is 32, check at least zvknha or zvknhb is enabled.
|
||||
if (!TI.hasFeature("zvknha") && !FunctionFeatureMap.lookup("zvknha") &&
|
||||
!TI.hasFeature("zvknhb") && !FunctionFeatureMap.lookup("zvknhb"))
|
||||
return Diag(TheCall->getBeginLoc(),
|
||||
diag::err_riscv_builtin_requires_extension)
|
||||
<< /* IsExtension */ true << TheCall->getSourceRange()
|
||||
<< "zvknha or zvknhb";
|
||||
|
||||
return CheckInvalidVLENandLMUL(TI, FunctionFeatureMap, TheCall, SemaRef,
|
||||
Arg0Type, ElemSize * 4) ||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include <riscv_vector.h>
|
||||
|
||||
void test_zvk_features(vuint32m4_t vd, vuint32m4_t vs2, vuint32m4_t vs1, vuint64m1_t vs2_64, vuint64m1_t vs1_64, size_t vl) {
|
||||
void test_zvk_features(vuint32m4_t vd, vuint32m4_t vs2, vuint32m4_t vs1, vuint64m1_t vd_64, vuint64m1_t vs2_64, vuint64m1_t vs1_64, size_t vl) {
|
||||
// zvbb
|
||||
__riscv_vbrev(vs2, vl); // expected-error {{builtin requires at least one of the following extensions: zvbb}}
|
||||
__riscv_vclz(vs2, vl); // expected-error {{builtin requires at least one of the following extensions: zvbb}}
|
||||
@ -35,10 +35,15 @@ void test_zvk_features(vuint32m4_t vd, vuint32m4_t vs2, vuint32m4_t vs1, vuint64
|
||||
__riscv_vaeskf2(vd, vs2, 0, vl); // expected-error {{builtin requires at least one of the following extensions: zvkned}}
|
||||
__riscv_vaesz(vd, vs2, vl); // expected-error {{builtin requires at least one of the following extensions: zvkned}}
|
||||
|
||||
// zvknha or zvknhb
|
||||
__riscv_vsha2ch(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha or zvknhb}}
|
||||
__riscv_vsha2cl(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha or zvknhb}}
|
||||
__riscv_vsha2ms(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha or zvknhb}}
|
||||
// zvknha
|
||||
__riscv_vsha2ch(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha}}
|
||||
__riscv_vsha2cl(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha}}
|
||||
__riscv_vsha2ms(vd, vs2, vs1, vl); // expected-error {{builtin requires at least one of the following extensions: zvknha}}
|
||||
|
||||
// zvknhb
|
||||
__riscv_vsha2ch(vd_64, vs2_64, vs1_64, vl); // expected-error {{builtin requires at least one of the following extensions: zvknhb}}
|
||||
__riscv_vsha2cl(vd_64, vs2_64, vs1_64, vl); // expected-error {{builtin requires at least one of the following extensions: zvknhb}}
|
||||
__riscv_vsha2ms(vd_64, vs2_64, vs1_64, vl); // expected-error {{builtin requires at least one of the following extensions: zvknhb}}
|
||||
|
||||
//zvksed
|
||||
__riscv_vsm4k(vs2, 0, vl); // expected-error {{builtin requires at least one of the following extensions: zvksed}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user