Skip to content

Commit 569b6f6

Browse files
authored
[RISCV] Add Andes A25/AX25 processor definition (#140681)
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 0a42db6 commit 569b6f6

File tree

6 files changed

+114
-4
lines changed

6 files changed

+114
-4
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %clang --target=riscv32 -mcpu=andes-a25 --print-enabled-extensions | FileCheck %s
2+
// REQUIRES: riscv-registered-target
3+
4+
// CHECK: Extensions enabled for the given RISC-V target
5+
// CHECK-EMPTY:
6+
// CHECK-NEXT: Name Version Description
7+
// CHECK-NEXT: i 2.1 'I' (Base Integer Instruction Set)
8+
// CHECK-NEXT: m 2.0 'M' (Integer Multiplication and Division)
9+
// CHECK-NEXT: a 2.1 'A' (Atomic Instructions)
10+
// CHECK-NEXT: f 2.2 'F' (Single-Precision Floating-Point)
11+
// CHECK-NEXT: d 2.2 'D' (Double-Precision Floating-Point)
12+
// CHECK-NEXT: c 2.0 'C' (Compressed Instructions)
13+
// CHECK-NEXT: b 1.0 'B' (the collection of the Zba, Zbb, Zbs extensions)
14+
// CHECK-NEXT: zicsr 2.0 'Zicsr' (CSRs)
15+
// CHECK-NEXT: zifencei 2.0 'Zifencei' (fence.i)
16+
// CHECK-NEXT: zmmul 1.0 'Zmmul' (Integer Multiplication)
17+
// CHECK-NEXT: zaamo 1.0 'Zaamo' (Atomic Memory Operations)
18+
// CHECK-NEXT: zalrsc 1.0 'Zalrsc' (Load-Reserved/Store-Conditional)
19+
// CHECK-NEXT: zca 1.0 'Zca' (part of the C extension, excluding compressed floating point loads/stores)
20+
// CHECK-NEXT: zcd 1.0 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
21+
// CHECK-NEXT: zcf 1.0 'Zcf' (Compressed Single-Precision Floating-Point Instructions)
22+
// CHECK-NEXT: zba 1.0 'Zba' (Address Generation Instructions)
23+
// CHECK-NEXT: zbb 1.0 'Zbb' (Basic Bit-Manipulation)
24+
// CHECK-NEXT: zbc 1.0 'Zbc' (Carry-Less Multiplication)
25+
// CHECK-NEXT: zbs 1.0 'Zbs' (Single-Bit Instructions)
26+
// CHECK-NEXT: xandesperf 5.0 'XAndesPerf' (Andes Performance Extension)
27+
// CHECK-EMPTY:
28+
// CHECK-NEXT: Experimental extensions
29+
// CHECK-EMPTY:
30+
// CHECK-NEXT: ISA String: rv32i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zcf1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0_xandesperf5p0
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %clang --target=riscv64 -mcpu=andes-ax25 --print-enabled-extensions | FileCheck %s
2+
// REQUIRES: riscv-registered-target
3+
4+
// CHECK: Extensions enabled for the given RISC-V target
5+
// CHECK-EMPTY:
6+
// CHECK-NEXT: Name Version Description
7+
// CHECK-NEXT: i 2.1 'I' (Base Integer Instruction Set)
8+
// CHECK-NEXT: m 2.0 'M' (Integer Multiplication and Division)
9+
// CHECK-NEXT: a 2.1 'A' (Atomic Instructions)
10+
// CHECK-NEXT: f 2.2 'F' (Single-Precision Floating-Point)
11+
// CHECK-NEXT: d 2.2 'D' (Double-Precision Floating-Point)
12+
// CHECK-NEXT: c 2.0 'C' (Compressed Instructions)
13+
// CHECK-NEXT: b 1.0 'B' (the collection of the Zba, Zbb, Zbs extensions)
14+
// CHECK-NEXT: zicsr 2.0 'Zicsr' (CSRs)
15+
// CHECK-NEXT: zifencei 2.0 'Zifencei' (fence.i)
16+
// CHECK-NEXT: zmmul 1.0 'Zmmul' (Integer Multiplication)
17+
// CHECK-NEXT: zaamo 1.0 'Zaamo' (Atomic Memory Operations)
18+
// CHECK-NEXT: zalrsc 1.0 'Zalrsc' (Load-Reserved/Store-Conditional)
19+
// CHECK-NEXT: zca 1.0 'Zca' (part of the C extension, excluding compressed floating point loads/stores)
20+
// CHECK-NEXT: zcd 1.0 'Zcd' (Compressed Double-Precision Floating-Point Instructions)
21+
// CHECK-NEXT: zba 1.0 'Zba' (Address Generation Instructions)
22+
// CHECK-NEXT: zbb 1.0 'Zbb' (Basic Bit-Manipulation)
23+
// CHECK-NEXT: zbc 1.0 'Zbc' (Carry-Less Multiplication)
24+
// CHECK-NEXT: zbs 1.0 'Zbs' (Single-Bit Instructions)
25+
// CHECK-NEXT: xandesperf 5.0 'XAndesPerf' (Andes Performance Extension)
26+
// CHECK-EMPTY:
27+
// CHECK-NEXT: Experimental extensions
28+
// CHECK-EMPTY:
29+
// CHECK-NEXT: ISA String: rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0_xandesperf5p0

clang/test/Driver/riscv-cpus.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,22 @@
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+
// COM: The list of extensions are tested in `test/Driver/print-enabled-extensions/riscv-andes-a25.c`
705+
// MCPU-ANDES-A25-SAME: "-target-abi" "ilp32d"
706+
707+
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mtune=andes-a25 | FileCheck -check-prefix=MTUNE-ANDES-A25 %s
708+
// MTUNE-ANDES-A25: "-tune-cpu" "andes-a25"
709+
710+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=andes-ax25 | FileCheck -check-prefix=MCPU-ANDES-AX25 %s
711+
// MCPU-ANDES-AX25: "-target-cpu" "andes-ax25"
712+
// COM: The list of extensions are tested in `test/Driver/print-enabled-extensions/riscv-andes-ax25.c`
713+
// MCPU-ANDES-AX25-SAME: "-target-abi" "lp64d"
714+
715+
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=andes-ax25 | FileCheck -check-prefix=MTUNE-ANDES-AX25 %s
716+
// MTUNE-ANDES-AX25: "-tune-cpu" "andes-ax25"
717+
702718
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mcpu=andes-n45 | FileCheck -check-prefix=MCPU-ANDES-N45 %s
703719
// MCPU-ANDES-N45: "-target-cpu" "andes-n45"
704720
// 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
@@ -199,6 +199,7 @@ Changes to the RISC-V Backend
199199
extension.
200200
* Adds experimental assembler support for the SiFive Xsfmm* Attached Matrix
201201
Extensions.
202+
* `-mcpu=andes-a25` and `-mcpu=andes-ax25` were added.
202203

203204
Changes to the WebAssembly Backend
204205
----------------------------------

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,36 @@ 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+
FeatureStdExtB,
663+
FeatureStdExtZbc,
664+
FeatureVendorXAndesPerf]>;
665+
666+
def ANDES_AX25 : RISCVProcessorModel<"andes-ax25",
667+
NoSchedModel,
668+
[Feature64Bit,
669+
FeatureStdExtI,
670+
FeatureStdExtZicsr,
671+
FeatureStdExtZifencei,
672+
FeatureStdExtM,
673+
FeatureStdExtA,
674+
FeatureStdExtF,
675+
FeatureStdExtD,
676+
FeatureStdExtC,
677+
FeatureStdExtB,
678+
FeatureStdExtZbc,
679+
FeatureVendorXAndesPerf]>;
680+
651681
def ANDES_N45 : RISCVProcessorModel<"andes-n45",
652682
NoSchedModel,
653683
[Feature32Bit,

0 commit comments

Comments
 (0)