Skip to content

Commit 0c95051

Browse files
committed
[RISCV] Support svukte extension
This is the extension for "Address-Independent Latency of User-Mode Faults to Supervisor Addresses". Spec: riscv/riscv-isa-manual#1564 The spec states that the `svukte` depends on `sv39`, but we don't have `sv39` yet, so I didn't add it to the implied list.
1 parent 2c10664 commit 0c95051

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-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
@@ -187,6 +187,7 @@
187187
// CHECK-NEXT: zvkgs 0.7 'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)
188188
// CHECK-NEXT: smctr 1.0 'Smctr' (Control Transfer Records Machine Level)
189189
// CHECK-NEXT: ssctr 1.0 'Ssctr' (Control Transfer Records Supervisor Level)
190+
// CHECK-NEXT: svukte 0.3 'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)
190191
// CHECK-EMPTY:
191192
// CHECK-NEXT: Supported Profiles
192193
// CHECK-NEXT: rva20s64

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,14 @@
18111811
// RUN: -o - | FileCheck --check-prefix=CHECK-SSCTR-EXT %s
18121812
// CHECK-SSCTR-EXT: __riscv_ssctr 1000000{{$}}
18131813

1814+
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
1815+
// RUN: -march=rv32i_svukte0p3 -E -dM %s \
1816+
// RUN: -o - | FileCheck --check-prefix=CHECK-SVUKTE-EXT %s
1817+
// RUN: %clang --target=riscv64 -menable-experimental-extensions \
1818+
// RUN: -march=rv64i_svukte0p3 -E -dM %s \
1819+
// RUN: -o - | FileCheck --check-prefix=CHECK-SVUKTE-EXT %s
1820+
// CHECK-SVUKTE-EXT: __riscv_svukte 3000{{$}}
1821+
18141822
// Misaligned
18151823

18161824
// RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,10 @@ def FeatureStdExtSha
10561056
FeatureStdExtShvstvala, FeatureStdExtShtvala, FeatureStdExtShvstvecd,
10571057
FeatureStdExtShvsatpa, FeatureStdExtShgatpa]>;
10581058

1059+
def FeatureStdExtSvukte
1060+
: RISCVExperimentalExtension<"svukte", 0, 3,
1061+
"'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)">;
1062+
10591063
// Pointer Masking extensions
10601064

10611065
// A supervisor-level extension that provides pointer masking for the next lower

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
; RUN: llc -mtriple=riscv32 -mattr=+svbare %s -o - | FileCheck --check-prefixes=CHECK,RV32SVBARE %s
6363
; RUN: llc -mtriple=riscv32 -mattr=+svnapot %s -o - | FileCheck --check-prefixes=CHECK,RV32SVNAPOT %s
6464
; RUN: llc -mtriple=riscv32 -mattr=+svpbmt %s -o - | FileCheck --check-prefixes=CHECK,RV32SVPBMT %s
65+
; RUN: llc -mtriple=riscv32 -mattr=+experimental-svukte %s -o - | FileCheck --check-prefixes=CHECK,RV32SVUKTE %s
6566
; RUN: llc -mtriple=riscv32 -mattr=+svvptc %s -o - | FileCheck --check-prefixes=CHECK,RV32SVVPTC %s
6667
; RUN: llc -mtriple=riscv32 -mattr=+svinval %s -o - | FileCheck --check-prefixes=CHECK,RV32SVINVAL %s
6768
; RUN: llc -mtriple=riscv32 -mattr=+xcvalu %s -o - | FileCheck --check-prefix=RV32XCVALU %s
@@ -205,6 +206,7 @@
205206
; RUN: llc -mtriple=riscv64 -mattr=+svbare %s -o - | FileCheck --check-prefixes=CHECK,RV64SVBARE %s
206207
; RUN: llc -mtriple=riscv64 -mattr=+svnapot %s -o - | FileCheck --check-prefixes=CHECK,RV64SVNAPOT %s
207208
; RUN: llc -mtriple=riscv64 -mattr=+svpbmt %s -o - | FileCheck --check-prefixes=CHECK,RV64SVPBMT %s
209+
; RUN: llc -mtriple=riscv64 -mattr=+experimental-svukte %s -o - | FileCheck --check-prefixes=CHECK,RV64SVUKTE %s
208210
; RUN: llc -mtriple=riscv64 -mattr=+svvptc %s -o - | FileCheck --check-prefixes=CHECK,RV64SVVPTC %s
209211
; RUN: llc -mtriple=riscv64 -mattr=+svinval %s -o - | FileCheck --check-prefixes=CHECK,RV64SVINVAL %s
210212
; RUN: llc -mtriple=riscv64 -mattr=+xventanacondops %s -o - | FileCheck --check-prefixes=CHECK,RV64XVENTANACONDOPS %s
@@ -364,6 +366,7 @@
364366
; RV32SVBARE: .attribute 5, "rv32i2p1_svbare1p0"
365367
; RV32SVNAPOT: .attribute 5, "rv32i2p1_svnapot1p0"
366368
; RV32SVPBMT: .attribute 5, "rv32i2p1_svpbmt1p0"
369+
; RV32SVUKTE: .attribute 5, "rv32i2p1_svukte0p3"
367370
; RV32SVVPTC: .attribute 5, "rv32i2p1_svvptc1p0"
368371
; RV32SVINVAL: .attribute 5, "rv32i2p1_svinval1p0"
369372
; RV32XCVALU: .attribute 5, "rv32i2p1_xcvalu1p0"
@@ -509,6 +512,7 @@
509512
; RV64SVBARE: .attribute 5, "rv64i2p1_svbare1p0"
510513
; RV64SVNAPOT: .attribute 5, "rv64i2p1_svnapot1p0"
511514
; RV64SVPBMT: .attribute 5, "rv64i2p1_svpbmt1p0"
515+
; RV64SVUKTE: .attribute 5, "rv64i2p1_svukte0p3"
512516
; RV64SVVPTC: .attribute 5, "rv64i2p1_svvptc1p0"
513517
; RV64SVINVAL: .attribute 5, "rv64i2p1_svinval1p0"
514518
; RV64XVENTANACONDOPS: .attribute 5, "rv64i2p1_xventanacondops1p0"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@
381381
.attribute arch, "rv32i_svbare1p0"
382382
# CHECK: attribute 5, "rv32i2p1_svbare1p0"
383383

384+
.attribute arch, "rv32i_svukte0p3"
385+
# CHECK: attribute 5, "rv32i2p1_svukte0p3"
386+
384387
.attribute arch, "rv32i_svvptc1p0"
385388
# CHECK: attribute 5, "rv32i2p1_svvptc1p0"
386389

llvm/unittests/TargetParser/RISCVISAInfoTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,7 @@ Experimental extensions
10941094
zvkgs 0.7
10951095
smctr 1.0
10961096
ssctr 1.0
1097+
svukte 0.3
10971098
10981099
Supported Profiles
10991100
rva20s64

0 commit comments

Comments
 (0)