Skip to content

Commit 98bdcfd

Browse files
committed
[RISCV] Add Andes A25/AX25 processor definition
Andes A25/AX25 are 32/64bit, 5-stage pipeline, linux-capable CPUs that implement the RV[32|64]IMAFDC_Zba_Zbb_Zbc_Zbs ISA extensions. They are developed by Andes Technology https://www.andestech.com, a RISC-V IP provider. The overviews for A25/AX25: https://www.andestech.com/en/products-solutions/andescore-processors/riscv-a25/ https://www.andestech.com/en/products-solutions/andescore-processors/riscv-ax25/ Scheduling model will be implemented in a later PR.
1 parent 23e8480 commit 98bdcfd

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

clang/test/Driver/riscv-cpus.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,42 @@
699699
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=syntacore-scr7 | FileCheck -check-prefix=MTUNE-SYNTACORE-SCR7 %s
700700
// MTUNE-SYNTACORE-SCR7: "-tune-cpu" "syntacore-scr7"
701701

702+
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mcpu=andes-a25 | FileCheck -check-prefix=MCPU-ANDES-A25 %s
703+
// MCPU-ANDES-A25: "-target-cpu" "andes-a25"
704+
// MCPU-ANDES-A25-SAME: "-target-feature" "+m"
705+
// MCPU-ANDES-A25-SAME: "-target-feature" "+a"
706+
// MCPU-ANDES-A25-SAME: "-target-feature" "+f"
707+
// MCPU-ANDES-A25-SAME: "-target-feature" "+d"
708+
// MCPU-ANDES-A25-SAME: "-target-feature" "+c"
709+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zicsr"
710+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zifencei"
711+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zba"
712+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zbb"
713+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zbc"
714+
// MCPU-ANDES-A25-SAME: "-target-feature" "+zbs"
715+
// MCPU-ANDES-A25-SAME: "-target-abi" "ilp32d"
716+
717+
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mtune=andes-a25 | FileCheck -check-prefix=MTUNE-ANDES-A25 %s
718+
// MTUNE-ANDES-A25: "-tune-cpu" "andes-a25"
719+
720+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=andes-ax25 | FileCheck -check-prefix=MCPU-ANDES-AX25 %s
721+
// MCPU-ANDES-AX25: "-target-cpu" "andes-ax25"
722+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+m"
723+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+a"
724+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+f"
725+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+d"
726+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+c"
727+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zicsr"
728+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zifencei"
729+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zba"
730+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zbb"
731+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zbc"
732+
// MCPU-ANDES-AX25-SAME: "-target-feature" "+zbs"
733+
// MCPU-ANDES-AX25-SAME: "-target-abi" "lp64d"
734+
735+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=andes-ax25 | FileCheck -check-prefix=MTUNE-ANDES-AX25 %s
736+
// MTUNE-ANDES-AX25: "-tune-cpu" "andes-ax25"
737+
702738
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mcpu=andes-n45 | FileCheck -check-prefix=MCPU-ANDES-N45 %s
703739
// MCPU-ANDES-N45: "-target-cpu" "andes-n45"
704740
// MCPU-ANDES-N45-SAME: "-target-feature" "+m"

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-a45
8+
// RISCV32-SAME: {{^}} andes-a25
9+
// RISCV32-SAME: {{^}}, andes-a45
910
// RISCV32-SAME: {{^}}, andes-n45
1011
// RISCV32-SAME: {{^}}, generic-rv32
1112
// RISCV32-SAME: {{^}}, rocket-rv32
@@ -26,7 +27,8 @@
2627
// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64
2728
// RISCV64: error: unknown target CPU 'not-a-cpu'
2829
// RISCV64-NEXT: note: valid target CPU values are:
29-
// RISCV64-SAME: {{^}} andes-ax45
30+
// RISCV64-SAME: {{^}} andes-ax25
31+
// RISCV64-SAME: {{^}}, andes-ax45
3032
// RISCV64-SAME: {{^}}, andes-nx45
3133
// RISCV64-SAME: {{^}}, generic-rv64
3234
// RISCV64-SAME: {{^}}, mips-p8700
@@ -57,7 +59,8 @@
5759
// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
5860
// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
5961
// TUNE-RISCV32-NEXT: note: valid target CPU values are:
60-
// TUNE-RISCV32-SAME: {{^}} andes-a45
62+
// TUNE-RISCV32-SAME: {{^}} andes-a25
63+
// TUNE-RISCV32-SAME: {{^}}, andes-a45
6164
// TUNE-RISCV32-SAME: {{^}}, andes-n45
6265
// TUNE-RISCV32-SAME: {{^}}, generic-rv32
6366
// TUNE-RISCV32-SAME: {{^}}, rocket-rv32
@@ -82,7 +85,8 @@
8285
// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
8386
// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
8487
// TUNE-RISCV64-NEXT: note: valid target CPU values are:
85-
// TUNE-RISCV64-SAME: {{^}} andes-ax45
88+
// TUNE-RISCV64-SAME: {{^}} andes-ax25
89+
// TUNE-RISCV64-SAME: {{^}}, andes-ax45
8690
// TUNE-RISCV64-SAME: {{^}}, andes-nx45
8791
// TUNE-RISCV64-SAME: {{^}}, generic-rv64
8892
// TUNE-RISCV64-SAME: {{^}}, mips-p8700

llvm/docs/ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ Changes to the RISC-V Backend
189189
* Adds assembler support for the Andes `XAndesvdot` (Andes Vector Dot Product extension).
190190
* Adds assembler support for the standard `Q` (Quad-Precision Floating Point)
191191
extension.
192+
* `-mcpu=andes-a25` and `-mcpu=andes-ax25` were added.
192193

193194
Changes to the WebAssembly Backend
194195
----------------------------------

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,38 @@ def RP2350_HAZARD3 : RISCVProcessorModel<"rp2350-hazard3",
648648
FeatureStdExtZcb,
649649
FeatureStdExtZcmp]>;
650650

651+
def ANDES_A25 : RISCVProcessorModel<"andes-a25",
652+
NoSchedModel,
653+
[Feature32Bit,
654+
FeatureStdExtI,
655+
FeatureStdExtZicsr,
656+
FeatureStdExtZifencei,
657+
FeatureStdExtM,
658+
FeatureStdExtA,
659+
FeatureStdExtF,
660+
FeatureStdExtD,
661+
FeatureStdExtC,
662+
FeatureStdExtZba,
663+
FeatureStdExtZbb,
664+
FeatureStdExtZbc,
665+
FeatureStdExtZbs]>;
666+
667+
def ANDES_AX25 : RISCVProcessorModel<"andes-ax25",
668+
NoSchedModel,
669+
[Feature64Bit,
670+
FeatureStdExtI,
671+
FeatureStdExtZicsr,
672+
FeatureStdExtZifencei,
673+
FeatureStdExtM,
674+
FeatureStdExtA,
675+
FeatureStdExtF,
676+
FeatureStdExtD,
677+
FeatureStdExtC,
678+
FeatureStdExtZba,
679+
FeatureStdExtZbb,
680+
FeatureStdExtZbc,
681+
FeatureStdExtZbs]>;
682+
651683
def ANDES_N45 : RISCVProcessorModel<"andes-n45",
652684
NoSchedModel,
653685
[Feature32Bit,

0 commit comments

Comments
 (0)