Skip to content

Commit 5ec2f25

Browse files
committed
[RISCV] Set __GCC_CONSTRUCTIVE_SIZE/__GCC_DESTRUCTIVE_SIZE to 64 for riscv64
These two macros were added in #89446. But the values may not be reasonable for RV64 systems because most of them have a cache line size 64B.
1 parent 885d416 commit 5ec2f25

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

clang/lib/Basic/Targets/RISCV.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ class RISCVTargetInfo : public TargetInfo {
125125
ParsedTargetAttr parseTargetAttr(StringRef Str) const override;
126126
llvm::APInt getFMVPriority(ArrayRef<StringRef> Features) const override;
127127

128-
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
129-
return std::make_pair(32, 32);
130-
}
131-
132128
bool supportsCpuSupports() const override { return getTriple().isOSLinux(); }
133129
bool supportsCpuIs() const override { return getTriple().isOSLinux(); }
134130
bool supportsCpuInit() const override { return getTriple().isOSLinux(); }
@@ -178,6 +174,10 @@ class LLVM_LIBRARY_VISIBILITY RISCV32TargetInfo : public RISCVTargetInfo {
178174
resetDataLayout("e-m:e-p:32:32-i64:64-n32-S128");
179175
}
180176

177+
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
178+
return std::make_pair(32, 32);
179+
}
180+
181181
bool setABI(const std::string &Name) override {
182182
if (Name == "ilp32e") {
183183
ABI = Name;
@@ -208,6 +208,10 @@ class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : public RISCVTargetInfo {
208208
resetDataLayout("e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
209209
}
210210

211+
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
212+
return std::make_pair(64, 64);
213+
}
214+
211215
bool setABI(const std::string &Name) override {
212216
if (Name == "lp64e") {
213217
ABI = Name;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// REQUIRES: riscv-registered-target
2+
3+
// RUN: %clang_cc1 -E -dM -triple=riscv32 < /dev/null | \
4+
// RUN: FileCheck -match-full-lines -check-prefixes=RV32 %s
5+
// RUN: %clang_cc1 -E -dM -triple=riscv64 < /dev/null | \
6+
// RUN: FileCheck -match-full-lines -check-prefixes=RV64 %s
7+
8+
// RV32: #define __GCC_CONSTRUCTIVE_SIZE 32
9+
// RV32: #define __GCC_DESTRUCTIVE_SIZE 32
10+
11+
// RV64: #define __GCC_CONSTRUCTIVE_SIZE 64
12+
// RV64: #define __GCC_DESTRUCTIVE_SIZE 64

0 commit comments

Comments
 (0)