[clang] [hexagon] Add {con, de}structive interference size defn (PR #94877)

Brian Cain via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 16:16:53 PDT 2024


https://github.com/androm3da updated https://github.com/llvm/llvm-project/pull/94877

>From 537cda866200e636cf679fa24f6b857ce6b36339 Mon Sep 17 00:00:00 2001
From: Brian Cain <bcain at quicinc.com>
Date: Sat, 8 Jun 2024 16:25:11 -0700
Subject: [PATCH] [hexagon] Add {con,de}structive interference size defn

This support was originally added in 72c373bfdc98 ([C++17] Support
__GCC_[CON|DE]STRUCTIVE_SIZE (#89446), 2024-04-26).  We're overriding
the values for Hexagon here.

Signed-off-by: Brian Cain <bcain at quicinc.com>
---
 clang/lib/Basic/Targets/Hexagon.h            | 4 ++++
 clang/test/Preprocessor/hexagon-predefines.c | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/clang/lib/Basic/Targets/Hexagon.h b/clang/lib/Basic/Targets/Hexagon.h
index cdb47dbae7999..f5e7a8878f01b 100644
--- a/clang/lib/Basic/Targets/Hexagon.h
+++ b/clang/lib/Basic/Targets/Hexagon.h
@@ -139,6 +139,10 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo {
   }
 
   bool hasBitIntType() const override { return true; }
+
+  std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
+    return std::make_pair(32, 32);
+  }
 };
 } // namespace targets
 } // namespace clang
diff --git a/clang/test/Preprocessor/hexagon-predefines.c b/clang/test/Preprocessor/hexagon-predefines.c
index bd55753a090de..0e35e974b6058 100644
--- a/clang/test/Preprocessor/hexagon-predefines.c
+++ b/clang/test/Preprocessor/hexagon-predefines.c
@@ -169,3 +169,12 @@
 // CHECK-ATOMIC: #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2
 // CHECK-ATOMIC: #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
 // CHECK-ATOMIC: #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-linux-musl \
+// RUN: -target-cpu hexagonv67 | FileCheck \
+// RUN: %s -check-prefix CHECK-INTERFERENCE
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-none-elf \
+// RUN: -target-cpu hexagonv67 | FileCheck \
+// RUN: %s -check-prefix CHECK-INTERFERENCE
+// CHECK-INTERFERENCE: #define __GCC_CONSTRUCTIVE_SIZE 32
+// CHECK-INTERFERENCE: #define __GCC_DESTRUCTIVE_SIZE 32



More information about the cfe-commits mailing list