[clang] [clang][RISCV] Support function attribute __attribute__((target("+attr"))) (PR #83674)

Piyou Chen via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 3 23:19:38 PST 2024


================
@@ -0,0 +1,41 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple riscv64 -S -verify %s
+
+// REQUIRES: riscv-registered-target
+#include <riscv_vector.h>
+
+void test_builtin() {
+  __riscv_vsetvl_e8m8(1); // expected-error {{'__builtin_rvv_vsetvli' needs target feature zve32x}}
+}
+
+__attribute__((target("+zve32x")))
----------------
BeMg wrote:

Base on [spec](https://github.com/riscv-non-isa/riscv-c-api-doc/blob/master/riscv-c-api.md#__attribute__targetattr-string), this target attribute should update as `__attribute__((target("arch=+zve32x")))`

https://github.com/llvm/llvm-project/pull/83674


More information about the cfe-commits mailing list