From 3fbbdcdfa1908def095d5d12b449df0f60be905b Mon Sep 17 00:00:00 2001 From: imkiva Date: Fri, 30 Aug 2024 11:38:30 +0800 Subject: [PATCH] [Clang][XTHeadVector] define `__riscv_vector` (#128) --- clang/lib/Basic/Targets/RISCV.cpp | 2 ++ clang/test/Preprocessor/riscv-target-features.c | 1 + 2 files changed, 3 insertions(+) diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 4feac2151327ba..7bf845ce27ca03 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -206,6 +206,8 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasXTHeadVector) { // https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/298/files Builder.defineMacro("__riscv_th_v_intrinsic", Twine(getVersionValue(0, 11))); + // https://github.com/ruyisdk/llvm-project/issues/128 + Builder.defineMacro("__riscv_vector"); } auto VScale = getVScaleRange(Opts); diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index f19b319b2ba507..d211fdee3e0e43 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -230,6 +230,7 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-V0P7-EXT %s // CHECK-V0P7-EXT: __riscv_th_v_intrinsic 11000{{$}} // CHECK-V0P7-EXT: __riscv_xtheadvector 1000000{{$}} +// CHECK-V0P7-EXT: __riscv_vector 1 // RUN: %clang -target riscv32-unknown-linux-gnu \ // RUN: -march=rv32i_xtheadvector -x c -E -dM %s \