Skip to content

Commit 5981be7

Browse files
authored
[RISCV] Add Andes A45/AX45 processor definition (#136832)
Andes A45/AX45 are 32/64bit in-order dual-issue 8-stage pipeline linux-capable CPU implementing the RV[32|64]IMAFDC_Zba_Zbb_Zbs ISA extensions. They are developed by Andes Technology https://www.andestech.com, a RISC-V IP provider. The overviews for A45/AX45: https://www.andestech.com/en/products-solutions/andescore-processors/riscv-a45/ https://www.andestech.com/en/products-solutions/andescore-processors/riscv-ax45/ Scheduling model will be implemented in a later PR.
1 parent b45225f commit 5981be7

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

clang/test/Driver/riscv-cpus.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,3 +726,37 @@
726726

727727
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=andes-nx45 | FileCheck -check-prefix=MTUNE-ANDES-NX45 %s
728728
// MTUNE-ANDES-NX45: "-tune-cpu" "andes-nx45"
729+
730+
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mcpu=andes-a45 | FileCheck -check-prefix=MCPU-ANDES-A45 %s
731+
// MCPU-ANDES-A45: "-target-cpu" "andes-a45"
732+
// MCPU-ANDES-A45-SAME: "-target-feature" "+m"
733+
// MCPU-ANDES-A45-SAME: "-target-feature" "+a"
734+
// MCPU-ANDES-A45-SAME: "-target-feature" "+f"
735+
// MCPU-ANDES-A45-SAME: "-target-feature" "+d"
736+
// MCPU-ANDES-A45-SAME: "-target-feature" "+c"
737+
// MCPU-ANDES-A45-SAME: "-target-feature" "+zicsr"
738+
// MCPU-ANDES-A45-SAME: "-target-feature" "+zifencei"
739+
// MCPU-ANDES-A45-SAME: "-target-feature" "+zba"
740+
// MCPU-ANDES-A45-SAME: "-target-feature" "+zbb"
741+
// MCPU-ANDES-A45-SAME: "-target-feature" "+zbs"
742+
// MCPU-ANDES-A45-SAME: "-target-abi" "ilp32d"
743+
744+
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mtune=andes-a45 | FileCheck -check-prefix=MTUNE-ANDES-A45 %s
745+
// MTUNE-ANDES-A45: "-tune-cpu" "andes-a45"
746+
747+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=andes-ax45 | FileCheck -check-prefix=MCPU-ANDES-AX45 %s
748+
// MCPU-ANDES-AX45: "-target-cpu" "andes-ax45"
749+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+m"
750+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+a"
751+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+f"
752+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+d"
753+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+c"
754+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+zicsr"
755+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+zifencei"
756+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+zba"
757+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+zbb"
758+
// MCPU-ANDES-AX45-SAME: "-target-feature" "+zbs"
759+
// MCPU-ANDES-AX45-SAME: "-target-abi" "lp64d"
760+
761+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=andes-ax45 | FileCheck -check-prefix=MTUNE-ANDES-AX45 %s
762+
// MTUNE-ANDES-AX45: "-tune-cpu" "andes-ax45"

clang/test/Misc/target-invalid-cpu-note/riscv.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV32
66
// RISCV32: error: unknown target CPU 'not-a-cpu'
77
// RISCV32-NEXT: note: valid target CPU values are:
8-
// RISCV32-SAME: {{^}} andes-n45
8+
// RISCV32-SAME: {{^}} andes-a45
9+
// RISCV32-SAME: {{^}}, andes-n45
910
// RISCV32-SAME: {{^}}, generic-rv32
1011
// RISCV32-SAME: {{^}}, rocket-rv32
1112
// RISCV32-SAME: {{^}}, rp2350-hazard3
@@ -25,7 +26,8 @@
2526
// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64
2627
// RISCV64: error: unknown target CPU 'not-a-cpu'
2728
// RISCV64-NEXT: note: valid target CPU values are:
28-
// RISCV64-SAME: {{^}} andes-nx45
29+
// RISCV64-SAME: {{^}} andes-ax45
30+
// RISCV64-SAME: {{^}}, andes-nx45
2931
// RISCV64-SAME: {{^}}, generic-rv64
3032
// RISCV64-SAME: {{^}}, mips-p8700
3133
// RISCV64-SAME: {{^}}, rocket-rv64
@@ -54,7 +56,8 @@
5456
// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
5557
// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
5658
// TUNE-RISCV32-NEXT: note: valid target CPU values are:
57-
// TUNE-RISCV32-SAME: {{^}} andes-n45
59+
// TUNE-RISCV32-SAME: {{^}} andes-a45
60+
// TUNE-RISCV32-SAME: {{^}}, andes-n45
5861
// TUNE-RISCV32-SAME: {{^}}, generic-rv32
5962
// TUNE-RISCV32-SAME: {{^}}, rocket-rv32
6063
// TUNE-RISCV32-SAME: {{^}}, rp2350-hazard3
@@ -78,7 +81,8 @@
7881
// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
7982
// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
8083
// TUNE-RISCV64-NEXT: note: valid target CPU values are:
81-
// TUNE-RISCV64-SAME: {{^}} andes-nx45
84+
// TUNE-RISCV64-SAME: {{^}} andes-ax45
85+
// TUNE-RISCV64-SAME: {{^}}, andes-nx45
8286
// TUNE-RISCV64-SAME: {{^}}, generic-rv64
8387
// TUNE-RISCV64-SAME: {{^}}, mips-p8700
8488
// TUNE-RISCV64-SAME: {{^}}, rocket-rv64

llvm/docs/ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ Changes to the RISC-V Backend
169169
which is also the default.
170170
* `-mcpu=xiangshan-kunminghu` was added.
171171
* `-mcpu=andes-n45` and `-mcpu=andes-nx45` were added.
172+
* `-mcpu=andes-a45` and `-mcpu=andes-ax45` were added.
172173

173174
Changes to the WebAssembly Backend
174175
----------------------------------

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,3 +651,29 @@ def ANDES_NX45 : RISCVProcessorModel<"andes-nx45",
651651
FeatureStdExtD,
652652
FeatureStdExtC,
653653
FeatureStdExtB]>;
654+
655+
def ANDES_A45 : RISCVProcessorModel<"andes-a45",
656+
NoSchedModel,
657+
[Feature32Bit,
658+
FeatureStdExtI,
659+
FeatureStdExtZicsr,
660+
FeatureStdExtZifencei,
661+
FeatureStdExtM,
662+
FeatureStdExtA,
663+
FeatureStdExtF,
664+
FeatureStdExtD,
665+
FeatureStdExtC,
666+
FeatureStdExtB]>;
667+
668+
def ANDES_AX45 : RISCVProcessorModel<"andes-ax45",
669+
NoSchedModel,
670+
[Feature64Bit,
671+
FeatureStdExtI,
672+
FeatureStdExtZicsr,
673+
FeatureStdExtZifencei,
674+
FeatureStdExtM,
675+
FeatureStdExtA,
676+
FeatureStdExtF,
677+
FeatureStdExtD,
678+
FeatureStdExtC,
679+
FeatureStdExtB]>;

0 commit comments

Comments
 (0)