xref: /llvm-project/clang/test/CodeGen/RISCV/riscv-func-attr-target-err.c (revision 31480b0cc8fe2bb1e080ffd38e38780ba7e8dec6)
1 // REQUIRES: riscv-registered-target
2 // RUN: not %clang_cc1 -triple riscv64 -target-feature +zifencei -target-feature +m -target-feature +a \
3 // RUN:  -emit-llvm-only %s 2>&1 | FileCheck %s
4 
5 #include <riscv_vector.h>
6 
test_builtin()7 void test_builtin() {
8 // CHECK: error: '__builtin_rvv_vsetvli' needs target feature zve32x
9   __riscv_vsetvl_e8m8(1);
10 }
11 
test_rvv_i32_type()12 void test_rvv_i32_type() {
13 // CHECK: error: RISC-V type 'vint32m1_t' (aka '__rvv_int32m1_t') requires the 'zve32x' extension
14   vint32m1_t v;
15 }
16 
test_rvv_f32_type()17 void test_rvv_f32_type() {
18 // CHECK: error: RISC-V type 'vfloat32m1_t' (aka '__rvv_float32m1_t') requires the 'zve32f' extension
19   vfloat32m1_t v;
20 }
21 
test_rvv_f64_type()22 void test_rvv_f64_type() {
23 // CHECK: error: RISC-V type 'vfloat64m1_t' (aka '__rvv_float64m1_t') requires the 'zve64d' extension
24   vfloat64m1_t v;
25 }
26 
27 // CHECK: error: duplicate 'arch=' in the 'target' attribute string;
testMultiArchSelectLast()28 __attribute__((target("arch=rv64gc;arch=rv64gc_zbb"))) void testMultiArchSelectLast() {}
29 // CHECK: error: duplicate 'cpu=' in the 'target' attribute string;
testMultiCpuSelectLast()30 __attribute__((target("cpu=sifive-u74;cpu=sifive-u54"))) void testMultiCpuSelectLast() {}
31 // CHECK: error: duplicate 'tune=' in the 'target' attribute string;
testMultiTuneSelectLast()32 __attribute__((target("tune=sifive-u74;tune=sifive-u54"))) void testMultiTuneSelectLast() {}
33