Skip to content

Commit 802878a

Browse files
committed
Check print-enabled-extensions instead of checking -target-feature
1 parent 98bdcfd commit 802878a

File tree

3 files changed

+59
-22
lines changed

3 files changed

+59
-22
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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-EMPTY:
27+
// CHECK-NEXT: Experimental extensions
28+
// CHECK-EMPTY:
29+
// CHECK-NEXT: ISA String: rv32i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zcf1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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-EMPTY:
26+
// CHECK-NEXT: Experimental extensions
27+
// CHECK-EMPTY:
28+
// CHECK-NEXT: ISA String: rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zca1p0_zcd1p0_zba1p0_zbb1p0_zbc1p0_zbs1p0

clang/test/Driver/riscv-cpus.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -701,35 +701,15 @@
701701

702702
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mcpu=andes-a25 | FileCheck -check-prefix=MCPU-ANDES-A25 %s
703703
// 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"
704+
// COM: The list of extensions are tested in `test/Driver/print-enabled-extensions/riscv-andes-a25.c`
715705
// MCPU-ANDES-A25-SAME: "-target-abi" "ilp32d"
716706

717707
// RUN: %clang --target=riscv32 -### -c %s 2>&1 -mtune=andes-a25 | FileCheck -check-prefix=MTUNE-ANDES-A25 %s
718708
// MTUNE-ANDES-A25: "-tune-cpu" "andes-a25"
719709

720710
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=andes-ax25 | FileCheck -check-prefix=MCPU-ANDES-AX25 %s
721711
// 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"
712+
// COM: The list of extensions are tested in `test/Driver/print-enabled-extensions/riscv-andes-ax25.c`
733713
// MCPU-ANDES-AX25-SAME: "-target-abi" "lp64d"
734714

735715
// RUN: %clang --target=riscv64 -### -c %s 2>&1 -mtune=andes-ax25 | FileCheck -check-prefix=MTUNE-ANDES-AX25 %s

0 commit comments

Comments
 (0)