aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPengcheng Wang <wangpengcheng.pp@bytedance.com>2025-11-11 14:16:05 +0800
committerGitHub <noreply@github.com>2025-11-11 14:16:05 +0800
commit957f929eba875e4aeb25c6d8340575a6edb8588d (patch)
tree61669a9691e24446d0bdd01cddf8109741efde0a
parent1b4f226ad951f1c163c57a37aac1c97e446b2591 (diff)
downloadllvm-957f929eba875e4aeb25c6d8340575a6edb8588d.zip
llvm-957f929eba875e4aeb25c6d8340575a6edb8588d.tar.gz
llvm-957f929eba875e4aeb25c6d8340575a6edb8588d.tar.bz2
[RISCV] Set __GCC_CONSTRUCTIVE_SIZE/__GCC_DESTRUCTIVE_SIZE to 64 (#162986)
These two macros were added in https://github.com/llvm/llvm-project/pull/89446. But the previous values may not be reasonable for RV64 systems because most of them have a cache line size 64B. So here we change them to 64.
-rw-r--r--clang/docs/ReleaseNotes.rst3
-rw-r--r--clang/lib/Basic/Targets/RISCV.h2
-rw-r--r--clang/test/Preprocessor/init-riscv.c10
3 files changed, 14 insertions, 1 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index c43f236..980dbf1 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -598,6 +598,9 @@ RISC-V Support
- Add `-march=unset` to clear any previous `-march=` value. This ISA string will
be computed from `-mcpu` or the platform default.
+- `__GCC_CONSTRUCTIVE_SIZE` and `__GCC_DESTRUCTIVE_SIZE` are changed to 64. These values are
+ unstable according to `Clang's documentation <https://clang.llvm.org/docs/LanguageExtensions.html#gcc-destructive-size-and-gcc-constructive-size>`_.
+
CUDA/HIP Language Changes
^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h
index 85fa4cc..21555b9 100644
--- a/clang/lib/Basic/Targets/RISCV.h
+++ b/clang/lib/Basic/Targets/RISCV.h
@@ -126,7 +126,7 @@ public:
llvm::APInt getFMVPriority(ArrayRef<StringRef> Features) const override;
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
- return std::make_pair(32, 32);
+ return std::make_pair(64, 64);
}
bool supportsCpuSupports() const override { return getTriple().isOSLinux(); }
diff --git a/clang/test/Preprocessor/init-riscv.c b/clang/test/Preprocessor/init-riscv.c
new file mode 100644
index 0000000..4eeecccf
--- /dev/null
+++ b/clang/test/Preprocessor/init-riscv.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -E -dM -triple=riscv32 < /dev/null | \
+// RUN: FileCheck -match-full-lines -check-prefixes=RV32 %s
+// RUN: %clang_cc1 -E -dM -triple=riscv64 < /dev/null | \
+// RUN: FileCheck -match-full-lines -check-prefixes=RV64 %s
+
+// RV32: #define __GCC_CONSTRUCTIVE_SIZE 64
+// RV32: #define __GCC_DESTRUCTIVE_SIZE 64
+
+// RV64: #define __GCC_CONSTRUCTIVE_SIZE 64
+// RV64: #define __GCC_DESTRUCTIVE_SIZE 64