Skip to content

Commit 63b14b3

Browse files
authored
[RISCV] Add missing required features for Zvfbfmin intrinsics (llvm#145646)
Although `checkRVVTypeSupport` can prevent the use of bf16 vector types without Zvfbfmin, the required features for Zvfbfmin intrinsics may still be needed if bf16 vector types can someday be enabled by other extensions.
1 parent 09b5265 commit 63b14b3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

clang/include/clang/Basic/riscv_vector.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
20132013
}
20142014

20152015
// Zvfbfmin - Vector convert BF16 to FP32
2016-
let Log2LMUL = [-2, -1, 0, 1, 2] in
2016+
let RequiredFeatures = ["zvfbfmin"], Log2LMUL = [-2, -1, 0, 1, 2] in
20172017
def vfwcvtbf16_f_f_v : RVVConvBuiltin<"Fw", "Fwv", "y", "vfwcvtbf16_f">;
20182018

20192019
let ManualCodegen = [{
@@ -2121,7 +2121,8 @@ let ManualCodegen = [{
21212121
}
21222122

21232123
// Zvfbfmin - Vector convert FP32 to BF16
2124-
let Log2LMUL = [-2, -1, 0, 1, 2],
2124+
let RequiredFeatures = ["zvfbfmin"],
2125+
Log2LMUL = [-2, -1, 0, 1, 2],
21252126
OverloadedName = "vfncvtbf16_f" in
21262127
defm : RVVConvBuiltinSet<"vfncvtbf16_f_f_w", "y", [["v", "vFwu"]]>;
21272128
}

clang/test/Sema/rvv-required-features-invalid.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ void test_zvfbfwma_vfwmaccbf16(vfloat32m4_t vd, __bf16 vs1, vbfloat16m2_t vs2, s
4848
// expected-error@-1 {{RISC-V type '__rvv_bfloat16m2_t' requires the 'zvfbfmin' extension}}
4949
// expected-error@-2 {{builtin requires at least one of the following extensions: zvfbfwma}}
5050
}
51+
52+
void test_zvfbfmin_vfwcvtbf16(vbfloat16m2_t vs2, size_t vl) {
53+
// expected-error@-1 {{RISC-V type 'vbfloat16m2_t' (aka '__rvv_bfloat16m2_t') requires the 'zvfbfmin' extension}}
54+
__riscv_vfwcvtbf16_f_f_v_f32m4(vs2, vl);; // expected-error {{RISC-V type 'vbfloat16m2_t' (aka '__rvv_bfloat16m2_t') requires the 'zvfbfmin' extension}}
55+
// expected-error@-1 {{RISC-V type '__rvv_bfloat16m2_t' requires the 'zvfbfmin' extension}}
56+
// expected-error@-2 {{builtin requires at least one of the following extensions: zvfbfmin}}
57+
}

0 commit comments

Comments
 (0)