Skip to content

Commit 0fbe45b

Browse files
authored
[RISCV] Add support of Sscofpmf (llvm#83831)
This is used in profile, but somehow we missed it.
1 parent 65a8e3a commit 0fbe45b

File tree

7 files changed

+23
-1
lines changed

7 files changed

+23
-1
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// CHECK-NOT: __riscv_smepmp {{.*$}}
3030
// CHECK-NOT: __riscv_ssaia {{.*$}}
3131
// CHECK-NOT: __riscv_ssccptr {{.*$}}
32+
// CHECK-NOT: __riscv_sscofpmf {{.*$}}
3233
// CHECK-NOT: __riscv_sscounterenw {{.*$}}
3334
// CHECK-NOT: __riscv_ssstateen {{.*$}}
3435
// CHECK-NOT: __riscv_ssstrict {{.*$}}
@@ -351,6 +352,14 @@
351352
// RUN: -o - | FileCheck --check-prefix=CHECK-SSCCPTR-EXT %s
352353
// CHECK-SSCCPTR-EXT: __riscv_ssccptr 1000000{{$}}
353354

355+
// RUN: %clang --target=riscv32-unknown-linux-gnu \
356+
// RUN: -march=rv32isscofpmf -E -dM %s \
357+
// RUN: -o - | FileCheck --check-prefix=CHECK-SSCOFPMF-EXT %s
358+
// RUN: %clang --target=riscv64-unknown-linux-gnu \
359+
// RUN: -march=rv64isscofpmf -E -dM %s \
360+
// RUN: -o - | FileCheck --check-prefix=CHECK-SSCOFPMF-EXT %s
361+
// CHECK-SSCOFPMF-EXT: __riscv_sscofpmf 1000000{{$}}
362+
354363
// RUN: %clang --target=riscv32-unknown-linux-gnu \
355364
// RUN: -march=rv32isscounterenw -E -dM %s \
356365
// RUN: -o - | FileCheck --check-prefix=CHECK-SSCOUNTERENW-EXT %s

llvm/docs/RISCVUsage.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ on support follow.
101101
``Smepmp`` Supported
102102
``Ssaia`` Supported
103103
``Ssccptr`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
104+
``Sscofpmf`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
104105
``Sscounterenw`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
105106
``Ssstateen`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
106107
``Ssstrict`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
@@ -234,7 +235,7 @@ Supported
234235

235236
.. _riscv-profiles-extensions-note:
236237

237-
``Za128rs``, ``Za64rs``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
238+
``Za128rs``, ``Za64rs``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscofpmf``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
238239
These extensions are defined as part of the `RISC-V Profiles specification <https://github.com/riscv/riscv-profiles/releases/tag/v1.0>`__. They do not introduce any new features themselves, but instead describe existing hardware features.
239240

240241
.. _riscv-zacas-note:

llvm/lib/Support/RISCVISAInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
6565
{"smepmp", {1, 0}},
6666
{"ssaia", {1, 0}},
6767
{"ssccptr", {1, 0}},
68+
{"sscofpmf", {1, 0}},
6869
{"sscounterenw", {1, 0}},
6970
{"ssstateen", {1, 0}},
7071
{"ssstrict", {1, 0}},

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,9 @@ def FeatureStdExtSsccptr
807807
: SubtargetFeature<"ssccptr", "HasStdExtSsccptr", "true",
808808
"'Ssccptr' (Main memory supports page table reads)", []>;
809809

810+
def FeatureStdExtSscofpmf
811+
: SubtargetFeature<"sscofpmf", "HasStdExtSscofpmf", "true",
812+
"'Sscofpmf' (Count Overflow and Mode-Based Filtering)", []>;
810813
def FeatureStdExtShcounterenw
811814
: SubtargetFeature<"shcounterenw", "HasStdExtShcounterenw", "true",
812815
"'Shcounterenw' (Support writeable hcounteren enable "

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
; RUN: llc -mtriple=riscv32 -mattr=+shgatpa %s -o - | FileCheck --check-prefixes=CHECK,RV32SHGATPA %s
4343
; RUN: llc -mtriple=riscv32 -mattr=+shvsatpa %s -o - | FileCheck --check-prefixes=CHECK,RV32SHVSATPA %s
4444
; RUN: llc -mtriple=riscv32 -mattr=+ssccptr %s -o - | FileCheck --check-prefixes=CHECK,RV32SSCCPTR %s
45+
; RUN: llc -mtriple=riscv32 -mattr=+sscofpmf %s -o - | FileCheck --check-prefixes=CHECK,RV32SSCOFPMF %s
4546
; RUN: llc -mtriple=riscv32 -mattr=+sscounterenw %s -o - | FileCheck --check-prefixes=CHECK,RV32SSCOUNTERENW %s
4647
; RUN: llc -mtriple=riscv32 -mattr=+ssstateen %s -o - | FileCheck --check-prefixes=CHECK,RV32SSSTATEEN %s
4748
; RUN: llc -mtriple=riscv32 -mattr=+ssstrict %s -o - | FileCheck --check-prefixes=CHECK,RV32SSSTRICT %s
@@ -166,6 +167,7 @@
166167
; RUN: llc -mtriple=riscv64 -mattr=+shgatpa %s -o - | FileCheck --check-prefixes=CHECK,RV64SHGATPA %s
167168
; RUN: llc -mtriple=riscv64 -mattr=+shvsatpa %s -o - | FileCheck --check-prefixes=CHECK,RV64SHVSATPA %s
168169
; RUN: llc -mtriple=riscv64 -mattr=+ssccptr %s -o - | FileCheck --check-prefixes=CHECK,RV64SSCCPTR %s
170+
; RUN: llc -mtriple=riscv64 -mattr=+sscofpmf %s -o - | FileCheck --check-prefixes=CHECK,RV64SSCOFPMF %s
169171
; RUN: llc -mtriple=riscv64 -mattr=+sscounterenw %s -o - | FileCheck --check-prefixes=CHECK,RV64SSCOUNTERENW %s
170172
; RUN: llc -mtriple=riscv64 -mattr=+ssstateen %s -o - | FileCheck --check-prefixes=CHECK,RV64SSSTATEEN %s
171173
; RUN: llc -mtriple=riscv64 -mattr=+ssstrict %s -o - | FileCheck --check-prefixes=CHECK,RV64SSSTRICT %s
@@ -295,6 +297,7 @@
295297
; RV32SHGATPA: .attribute 5, "rv32i2p1_shgatpa1p0"
296298
; RV32SHVSATPA: .attribute 5, "rv32i2p1_shvsatpa1p0"
297299
; RV32SSCCPTR: .attribute 5, "rv32i2p1_ssccptr1p0"
300+
; RV32SSCOFPMF: .attribute 5, "rv32i2p1_sscofpmf1p0"
298301
; RV32SSCOUNTERENW: .attribute 5, "rv32i2p1_sscounterenw1p0"
299302
; RV32SSSTATEEN: .attribute 5, "rv32i2p1_ssstateen1p0"
300303
; RV32SSSTRICT: .attribute 5, "rv32i2p1_ssstrict1p0"
@@ -421,6 +424,7 @@
421424
; RV64SHGATPA: .attribute 5, "rv64i2p1_shgatpa1p0"
422425
; RV64SHVSATPA: .attribute 5, "rv64i2p1_shvsatpa1p0"
423426
; RV64SSCCPTR: .attribute 5, "rv64i2p1_ssccptr1p0"
427+
; RV64SSCOFPMF: .attribute 5, "rv64i2p1_sscofpmf1p0"
424428
; RV64SSCOUNTERENW: .attribute 5, "rv64i2p1_sscounterenw1p0"
425429
; RV64SSSTATEEN: .attribute 5, "rv64i2p1_ssstateen1p0"
426430
; RV64SSSTRICT: .attribute 5, "rv64i2p1_ssstrict1p0"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@
318318
.attribute arch, "rv32i_ssccptr1p0"
319319
# CHECK: attribute 5, "rv32i2p1_ssccptr1p0"
320320

321+
.attribute arch, "rv32i_sscofpmf1p0"
322+
# CHECK: attribute 5, "rv32i2p1_sscofpmf1p0"
323+
321324
.attribute arch, "rv32i_sscounterenw1p0"
322325
# CHECK: attribute 5, "rv32i2p1_sscounterenw1p0"
323326

llvm/unittests/Support/RISCVISAInfoTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ R"(All available -march extensions for RISC-V
830830
smepmp 1.0
831831
ssaia 1.0
832832
ssccptr 1.0
833+
sscofpmf 1.0
833834
sscounterenw 1.0
834835
ssstateen 1.0
835836
ssstrict 1.0

0 commit comments

Comments
 (0)