Skip to content

Commit f613801

Browse files
4vtomatjaidTw
andauthored
[RISCV][llvm] Support Smpmpmt version 0.6 (#166322)
spec: https://github.com/riscv/riscv-isa-manual/blob/smpmpmt/src/smpmpmt.adoc Co-Authored-by: Jesse Huang <[email protected]>
1 parent d10a851 commit f613801

File tree

8 files changed

+25
-0
lines changed

8 files changed

+25
-0
lines changed

clang/test/Driver/print-supported-extensions-riscv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
// CHECK-NEXT: zvfofp8min 0.2 'Zvfofp8min' (Vector OFP8 Converts)
228228
// CHECK-NEXT: zvkgs 0.7 'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)
229229
// CHECK-NEXT: zvqdotq 0.0 'Zvqdotq' (Vector quad widening 4D Dot Product)
230+
// CHECK-NEXT: smpmpmt 0.6 'Smpmpmt' (PMP-based Memory Types Extension)
230231
// CHECK-NEXT: svukte 0.3 'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)
231232
// CHECK-NEXT: xqccmp 0.3 'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)
232233
// CHECK-NEXT: xqcia 0.7 'Xqcia' (Qualcomm uC Arithmetic Extension)

clang/test/Preprocessor/riscv-target-features.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
// CHECK-NOT: __riscv_smepmp {{.*$}}
4141
// CHECK-NOT: __riscv_smmpm{{.*$}}
4242
// CHECK-NOT: __riscv_smnpm{{.*$}}
43+
// CHECK-NOT: __riscv_smpmpmt {{.*$}}
4344
// CHECK-NOT: __riscv_smrnmi {{.*$}}
4445
// CHECK-NOT: __riscv_smstateen {{.*$}}
4546
// CHECK-NOT: __riscv_ssaia {{.*$}}
@@ -1333,6 +1334,14 @@
13331334
// RUN: -o - | FileCheck --check-prefix=CHECK-SMEPMP-EXT %s
13341335
// CHECK-SMEPMP-EXT: __riscv_smepmp 1000000{{$}}
13351336

1337+
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
1338+
// RUN: -march=rv32ismpmpmt0p6 -x c -E -dM %s \
1339+
// RUN: -o - | FileCheck --check-prefix=CHECK-SMPMPMT %s
1340+
// RUN: %clang --target=riscv64 -menable-experimental-extensions \
1341+
// RUN: -march=rv64ismpmpmt0p6 -x c -E -dM %s \
1342+
// RUN: -o - | FileCheck --check-prefix=CHECK-SMPMPMT %s
1343+
// CHECK-SMPMPMT: __riscv_smpmpmt 6000{{$}}
1344+
13361345
// RUN: %clang --target=riscv32 \
13371346
// RUN: -march=rv32ismrnmi1p0 -E -dM %s \
13381347
// RUN: -o - | FileCheck --check-prefix=CHECK-SMRNMI-EXT %s

llvm/docs/RISCVUsage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ The primary goal of experimental support is to assist in the process of ratifica
351351
``experimental-zvqdotq``
352352
LLVM implements the `0.0.1 draft specification <https://github.com/riscv/riscv-dot-product/releases/tag/v0.0.1>`__.
353353

354+
``experimental-smpmpmt``
355+
LLVM implements the `0.6 draft specification <https://github.com/riscv/riscv-isa-manual/blob/smpmpmt/src/smpmpmt.adoc>`__.
356+
354357
To use an experimental extension from `clang`, you must add `-menable-experimental-extensions` to the command line, and specify the exact version of the experimental extension you are using. To use an experimental extension with LLVM's internal developer tools (e.g. `llc`, `llvm-objdump`, `llvm-mc`), you must prefix the extension name with `experimental-`. Note that you don't need to specify the version with internal tools, and shouldn't include the `experimental-` prefix with `clang`.
355358

356359
Vendor Extensions

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,9 @@ def FeatureStdExtSsdbltrp
956956
def FeatureStdExtSmepmp
957957
: RISCVExtension<1, 0, "Enhanced Physical Memory Protection">;
958958

959+
def FeatureStdExtSmpmpmt
960+
: RISCVExperimentalExtension<0, 6, "PMP-based Memory Types Extension">;
961+
959962
def FeatureStdExtSmrnmi
960963
: RISCVExtension<1, 0, "Resumable Non-Maskable Interrupts">;
961964
def HasStdExtSmrnmi : Predicate<"Subtarget->hasStdExtSmrnmi()">,

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
; RUN: llc -mtriple=riscv32 -mattr=+smcdeleg %s -o - | FileCheck --check-prefixes=CHECK,RV32SMCDELEG %s
126126
; RUN: llc -mtriple=riscv32 -mattr=+smcntrpmf %s -o - | FileCheck --check-prefixes=CHECK,RV32SMCNTRPMF %s
127127
; RUN: llc -mtriple=riscv32 -mattr=+smepmp %s -o - | FileCheck --check-prefixes=CHECK,RV32SMEPMP %s
128+
; RUN: llc -mtriple=riscv32 -mattr=+experimental-smpmpmt %s -o - | FileCheck --check-prefixes=CHECK,RV32SMPMPMT %s
128129
; RUN: llc -mtriple=riscv32 -mattr=+smrnmi %s -o - | FileCheck --check-prefixes=CHECK,RV32SMRNMI %s
129130
; RUN: llc -mtriple=riscv32 -mattr=+zfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV32ZFBFMIN %s
130131
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zvfbfa %s -o - | FileCheck --check-prefixes=CHECK,RV32ZVFBFA %s
@@ -275,6 +276,7 @@
275276
; RUN: llc -mtriple=riscv64 -mattr=+smcdeleg %s -o - | FileCheck --check-prefixes=CHECK,RV64SMCDELEG %s
276277
; RUN: llc -mtriple=riscv64 -mattr=+smcntrpmf %s -o - | FileCheck --check-prefixes=CHECK,RV64SMCNTRPMF %s
277278
; RUN: llc -mtriple=riscv64 -mattr=+smepmp %s -o - | FileCheck --check-prefixes=CHECK,RV64SMEPMP %s
279+
; RUN: llc -mtriple=riscv64 -mattr=+experimental-smpmpmt %s -o - | FileCheck --check-prefixes=CHECK,RV64SMPMPMT %s
278280
; RUN: llc -mtriple=riscv64 -mattr=+smrnmi %s -o - | FileCheck --check-prefixes=CHECK,RV64SMRNMI %s
279281
; RUN: llc -mtriple=riscv64 -mattr=+zfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV64ZFBFMIN %s
280282
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zvfbfa %s -o - | FileCheck --check-prefixes=CHECK,RV64ZVFBFA %s
@@ -439,6 +441,7 @@
439441
; RV32SMCDELEG: .attribute 5, "rv32i2p1_smcdeleg1p0"
440442
; RV32SMCNTRPMF: .attribute 5, "rv32i2p1_smcntrpmf1p0"
441443
; RV32SMEPMP: .attribute 5, "rv32i2p1_smepmp1p0"
444+
; RV32SMPMPMT: .attribute 5, "rv32i2p1_smpmpmt0p6"
442445
; RV32SMRNMI: .attribute 5, "rv32i2p1_smrnmi1p0"
443446
; RV32ZFBFMIN: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zfbfmin1p0"
444447
; RV32ZVFBFA: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zfbfmin1p0_zve32f1p0_zve32x1p0_zvfbfa0p1_zvl32b1p0"
@@ -587,6 +590,7 @@
587590
; RV64SMCDELEG: .attribute 5, "rv64i2p1_smcdeleg1p0"
588591
; RV64SMCNTRPMF: .attribute 5, "rv64i2p1_smcntrpmf1p0"
589592
; RV64SMEPMP: .attribute 5, "rv64i2p1_smepmp1p0"
593+
; RV64SMPMPMT: .attribute 5, "rv64i2p1_smpmpmt0p6"
590594
; RV64SMRNMI: .attribute 5, "rv64i2p1_smrnmi1p0"
591595
; RV64ZFBFMIN: .attribute 5, "rv64i2p1_f2p2_zicsr2p0_zfbfmin1p0"
592596
; RV64ZVFBFA: .attribute 5, "rv64i2p1_f2p2_zicsr2p0_zfbfmin1p0_zve32f1p0_zve32x1p0_zvfbfa0p1_zvl32b1p0"

llvm/test/CodeGen/RISCV/features-info.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
; CHECK-NEXT: experimental - Experimental intrinsics.
2828
; CHECK-NEXT: experimental-p - 'P' ('Base P' (Packed SIMD)).
2929
; CHECK-NEXT: experimental-rvm23u32 - RISC-V experimental-rvm23u32 profile.
30+
; CHECK-NEXT: experimental-smpmpmt - 'Smpmpmt' (PMP-based Memory Types Extension).
3031
; CHECK-NEXT: experimental-svukte - 'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses).
3132
; CHECK-NEXT: experimental-xqccmp - 'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves).
3233
; CHECK-NEXT: experimental-xqcia - 'Xqcia' (Qualcomm uC Arithmetic Extension).

llvm/test/MC/RISCV/attribute-arch.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@
348348
.attribute arch, "rv32i_smepmp1p0"
349349
# CHECK: attribute 5, "rv32i2p1_smepmp1p0"
350350

351+
.attribute arch, "rv32i_smpmpmt0p6"
352+
# CHECK: attribute 5, "rv32i2p1_smpmpmt0p6"
353+
351354
.attribute arch, "rv32i_smrnmi1p0"
352355
# CHECK: attribute 5, "rv32i2p1_smrnmi1p0"
353356

llvm/unittests/TargetParser/RISCVISAInfoTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ Experimental extensions
12041204
zvfofp8min 0.2
12051205
zvkgs 0.7
12061206
zvqdotq 0.0
1207+
smpmpmt 0.6
12071208
svukte 0.3
12081209
xqccmp 0.3
12091210
xqcia 0.7

0 commit comments

Comments
 (0)