Skip to content

Commit e4c1fa7

Browse files
committed
[RISCV] Add test cases to show that rvv_vector_bits attribute is not accepted for vbool or LMUL!=1 RVV types. NFC
The error message isn't great, but it's temporary until we support these. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D152415
1 parent 167f2fa commit e4c1fa7

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

clang/test/Sema/attr-riscv-rvv-vector-bits.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@
66

77
#include <stdint.h>
88

9+
typedef __rvv_bool64_t vbool64_t;
10+
typedef __rvv_bool32_t vbool32_t;
11+
typedef __rvv_bool16_t vbool16_t;
12+
typedef __rvv_bool8_t vbool8_t;
13+
typedef __rvv_bool4_t vbool4_t;
14+
typedef __rvv_bool2_t vbool2_t;
15+
typedef __rvv_bool1_t vbool1_t;
16+
17+
typedef __rvv_int8mf8_t vint8mf8_t;
18+
typedef __rvv_uint8mf8_t vuint8mf8_t;
19+
20+
typedef __rvv_int8mf4_t vint8mf4_t;
21+
typedef __rvv_uint8mf4_t vuint8mf4_t;
22+
typedef __rvv_int16mf4_t vint16mf4_t;
23+
typedef __rvv_uint16mf4_t vuint16mf4_t;
24+
25+
typedef __rvv_int8mf2_t vint8mf2_t;
26+
typedef __rvv_uint8mf2_t vuint8mf2_t;
27+
typedef __rvv_int16mf2_t vint16mf2_t;
28+
typedef __rvv_uint16mf2_t vuint16mf2_t;
29+
typedef __rvv_int32mf2_t vint32mf2_t;
30+
typedef __rvv_uint32mf2_t vuint32mf2_t;
31+
typedef __rvv_float32mf2_t vfloat32mf2_t;
32+
933
typedef __rvv_int8m1_t vint8m1_t;
1034
typedef __rvv_uint8m1_t vuint8m1_t;
1135
typedef __rvv_int16m1_t vint16m1_t;
@@ -17,7 +41,38 @@ typedef __rvv_uint64m1_t vuint64m1_t;
1741
typedef __rvv_float32m1_t vfloat32m1_t;
1842
typedef __rvv_float64m1_t vfloat64m1_t;
1943

44+
typedef __rvv_int8m2_t vint8m2_t;
45+
typedef __rvv_uint8m2_t vuint8m2_t;
46+
typedef __rvv_int16m2_t vint16m2_t;
47+
typedef __rvv_uint16m2_t vuint16m2_t;
2048
typedef __rvv_int32m2_t vint32m2_t;
49+
typedef __rvv_uint32m2_t vuint32m2_t;
50+
typedef __rvv_int64m2_t vint64m2_t;
51+
typedef __rvv_uint64m2_t vuint64m2_t;
52+
typedef __rvv_float32m2_t vfloat32m2_t;
53+
typedef __rvv_float64m2_t vfloat64m2_t;
54+
55+
typedef __rvv_int8m4_t vint8m4_t;
56+
typedef __rvv_uint8m4_t vuint8m4_t;
57+
typedef __rvv_int16m4_t vint16m4_t;
58+
typedef __rvv_uint16m4_t vuint16m4_t;
59+
typedef __rvv_int32m4_t vint32m4_t;
60+
typedef __rvv_uint32m4_t vuint32m4_t;
61+
typedef __rvv_int64m4_t vint64m4_t;
62+
typedef __rvv_uint64m4_t vuint64m4_t;
63+
typedef __rvv_float32m4_t vfloat32m4_t;
64+
typedef __rvv_float64m4_t vfloat64m4_t;
65+
66+
typedef __rvv_int8m8_t vint8m8_t;
67+
typedef __rvv_uint8m8_t vuint8m8_t;
68+
typedef __rvv_int16m8_t vint16m8_t;
69+
typedef __rvv_uint16m8_t vuint16m8_t;
70+
typedef __rvv_int32m8_t vint32m8_t;
71+
typedef __rvv_uint32m8_t vuint32m8_t;
72+
typedef __rvv_int64m8_t vint64m8_t;
73+
typedef __rvv_uint64m8_t vuint64m8_t;
74+
typedef __rvv_float32m8_t vfloat32m8_t;
75+
typedef __rvv_float64m8_t vfloat64m8_t;
2176

2277
// Define valid fixed-width RVV types
2378
typedef vint8m1_t fixed_int8m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));
@@ -57,6 +112,15 @@ typedef vint8m1_t two_arguments __attribute__((riscv_rvv_vector_bits(2, 4))); //
57112
typedef vint8m1_t non_int_size1 __attribute__((riscv_rvv_vector_bits(2.0))); // expected-error {{'riscv_rvv_vector_bits' attribute requires an integer constant}}
58113
typedef vint8m1_t non_int_size2 __attribute__((riscv_rvv_vector_bits("256"))); // expected-error {{'riscv_rvv_vector_bits' attribute requires an integer constant}}
59114

115+
// bool types and LMUL != 1 are not supported.
116+
typedef vbool1_t fixed_vbool1_t_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vbool1_t'}}
117+
typedef vint8mf8_t fixed_int8mf8_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen / 8))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8mf8_t'}}
118+
typedef vint8mf4_t fixed_int8mf4_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen / 4))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8mf4_t'}}
119+
typedef vint8mf2_t fixed_int8mf2_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen / 2))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8mf2_t'}}
120+
typedef vint8m2_t fixed_int8m2_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen * 2))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8m2_t'}}
121+
typedef vint8m4_t fixed_int8m4_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen * 4))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8m4_t'}}
122+
typedef vint8m8_t fixed_int8m8_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen * 8))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'vint8m8_t'}}
123+
60124
// Attribute must be attached to a single RVV vector or predicate type.
61125
typedef void *badtype1 __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'void *'}}
62126
typedef int badtype2 __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); // expected-error {{'riscv_rvv_vector_bits' attribute applied to non-RVV type 'int'}}

0 commit comments

Comments
 (0)