[clang] [llvm] [RISCV] Add Hazard3 Core as taped out for RP2350 (PR #102452)

Luke Wren via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 17 12:37:00 PDT 2024


================
@@ -402,6 +402,21 @@
 // MCPU-SIFIVE-P670-SAME: "-target-feature" "+zvkt"
 // MCPU-SIFIVE-P670-SAME: "-target-abi" "lp64d"
 
+// RUN: %clang -target riscv32 -### -c %s 2>&1 -mcpu=rp2350-hazard3 | FileCheck -check-prefix=MCPU-HAZARD3 %s
+// MCPU-HAZARD3: "-target-cpu" "rp2350-hazard3"
+// MCPU-HAZARD3-SAME: "-target-feature" "+m"
+// MCPU-HAZARD3-SAME: "-target-feature" "+a"
+// MCPU-HAZARD3-SAME: "-target-feature" "+c"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zicsr"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zifencei"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zcb"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zcmp"
+// MCPU-HAZARD3-SAME: "-target-feature" "+zba"
----------------
Wren6991 wrote:

Understood, thanks. Conversely, does specifying B on its own still allow feature test via the `__riscv_zba` etc macros?  If not, what is the preferred way to detect the presence of e.g. Zba? The context is that I want to avoid mis-detection of the core not having ZbaZbbZbs due to future code only checking the B alias for those extensions, and vice versa.

If the preferred construct is something like `#if defined(__riscv_b) || defined(__riscv_zba)` then the extensions specified in this PR look correct to me. However that sort of code is liable to break next time RISC-V introduces yet another extension alias  (see also A vs Zalrsc/Zaamo, C vs Zca/Zcf/Zcd).

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


More information about the llvm-commits mailing list