Skip to content

Commit b1f5cb7

Browse files
T-TieTie
authored andcommitted
[RISCV] Add support for Ziccamoc (llvm#136694)
Support for Ziccamoc is added in this pr. Specification link: https://drive.google.com/file/d/12QKRm92cLcEk8-5J9NI91m0fAQOxqNAq/view --------- Co-authored-by: Tie <[email protected]>
1 parent d2b5e32 commit b1f5cb7

File tree

9 files changed

+24
-1
lines changed

9 files changed

+24
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// CHECK-NEXT: zicbop 1.0 'Zicbop' (Cache-Block Prefetch Instructions)
2020
// CHECK-NEXT: zicboz 1.0 'Zicboz' (Cache-Block Zero Instructions)
2121
// CHECK-NEXT: ziccamoa 1.0 'Ziccamoa' (Main Memory Supports All Atomics in A)
22+
// CHECK-NEXT: ziccamoc 1.0 'Ziccamoc' (Main Memory Supports Atomics in Zacas)
2223
// CHECK-NEXT: ziccif 1.0 'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)
2324
// CHECK-NEXT: zicclsm 1.0 'Zicclsm' (Main Memory Supports Misaligned Loads/Stores)
2425
// CHECK-NEXT: ziccrse 1.0 'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences)

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
// CHECK-NOT: __riscv_zicbop {{.*$}}
126126
// CHECK-NOT: __riscv_zicboz {{.*$}}
127127
// CHECK-NOT: __riscv_ziccamoa {{.*$}}
128+
// CHECK-NOT: __riscv_ziccamoc {{.*$}}
128129
// CHECK-NOT: __riscv_ziccif {{.*$}}
129130
// CHECK-NOT: __riscv_zicclsm {{.*$}}
130131
// CHECK-NOT: __riscv_ziccrse {{.*$}}
@@ -1047,6 +1048,14 @@
10471048
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICCAMOA-EXT %s
10481049
// CHECK-ZICCAMOA-EXT: __riscv_ziccamoa 1000000{{$}}
10491050

1051+
// RUN: %clang --target=riscv32-unknown-linux-gnu \
1052+
// RUN: -march=rv32iziccamoc -E -dM %s \
1053+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICCAMOC-EXT %s
1054+
// RUN: %clang --target=riscv64-unknown-linux-gnu \
1055+
// RUN: -march=rv64iziccamoc -E -dM %s \
1056+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICCAMOC-EXT %s
1057+
// CHECK-ZICCAMOC-EXT: __riscv_ziccamoc 1000000{{$}}
1058+
10501059
// RUN: %clang --target=riscv32-unknown-linux-gnu \
10511060
// RUN: -march=rv32iziccif -E -dM %s \
10521061
// RUN: -o - | FileCheck --check-prefix=CHECK-ZICCIF-EXT %s

llvm/docs/RISCVUsage.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ on support follow.
197197
``Zicbop`` Supported
198198
``Zicboz`` Assembly Support
199199
``Ziccamoa`` Supported (`See note <#riscv-profiles-extensions-note>`__)
200+
``Ziccamoc`` Supported (`See note <#riscv-profiles-extensions-note>`__)
200201
``Ziccif`` Supported (`See note <#riscv-profiles-extensions-note>`__)
201202
``Zicclsm`` Supported (`See note <#riscv-profiles-extensions-note>`__)
202203
``Ziccrse`` Supported (`See note <#riscv-profiles-extensions-note>`__)
@@ -298,7 +299,7 @@ Supported
298299

299300
.. _riscv-profiles-extensions-note:
300301

301-
``Za128rs``, ``Za64rs``, ``Zama16b``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
302+
``Za128rs``, ``Za64rs``, ``Zama16b``, ``Zic64b``, ``Ziccamoa``, ``Ziccamoc``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
302303
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.
303304

304305
.. _riscv-zacas-note:

llvm/docs/ReleaseNotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ Changes to the RISC-V Backend
167167
* Adds assembler support for ``.option exact``, which disables automatic compression,
168168
and branch and linker relaxation. This can be disabled with ``.option noexact``,
169169
which is also the default.
170+
<<<<<<< HEAD
170171
* `-mcpu=xiangshan-kunminghu` was added.
171172
* `-mcpu=andes-n45` and `-mcpu=andes-nx45` were added.
172173
* `-mcpu=andes-a45` and `-mcpu=andes-ax45` were added.
174+
* Adds support for the 'Ziccamoc` (Main Memory Supports Atomics in Zacas) extension, which was introduced as an optional extension of the RISC-V Profiles specification.
173175

174176
Changes to the WebAssembly Backend
175177
----------------------------------

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">,
102102
def FeatureStdExtZiccamoa
103103
: RISCVExtension<1, 0, "Main Memory Supports All Atomics in A">;
104104

105+
def FeatureStdExtZiccamoc
106+
: RISCVExtension<1, 0, "Main Memory Supports Atomics in Zacas">;
107+
105108
def FeatureStdExtZiccif
106109
: RISCVExtension<1, 0,
107110
"Main Memory Supports Instruction Fetch with Atomicity Requirement">;

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
; RUN: llc -mtriple=riscv64 -mattr=+zcmp %s -o - | FileCheck --check-prefixes=CHECK,RV64ZCMP %s
266266
; RUN: llc -mtriple=riscv64 -mattr=+zcmt %s -o - | FileCheck --check-prefixes=CHECK,RV64ZCMT %s
267267
; RUN: llc -mtriple=riscv64 -mattr=+ziccamoa %s -o - | FileCheck --check-prefixes=CHECK,RV64ZICCAMOA %s
268+
; RUN: llc -mtriple=riscv64 -mattr=+ziccamoc %s -o - | FileCheck --check-prefixes=CHECK,RV64ZICCAMOC %s
268269
; RUN: llc -mtriple=riscv64 -mattr=+ziccif %s -o - | FileCheck --check-prefixes=CHECK,RV64ZICCIF %s
269270
; RUN: llc -mtriple=riscv64 -mattr=+zicclsm %s -o - | FileCheck --check-prefixes=CHECK,RV64ZICCLSM %s
270271
; RUN: llc -mtriple=riscv64 -mattr=+ziccrse %s -o - | FileCheck --check-prefixes=CHECK,RV64ZICCRSE %s
@@ -602,6 +603,7 @@
602603
; RV64ZCMP: .attribute 5, "rv64i2p1_zca1p0_zcmp1p0"
603604
; RV64ZCMT: .attribute 5, "rv64i2p1_zicsr2p0_zca1p0_zcmt1p0"
604605
; RV64ZICCAMOA: .attribute 5, "rv64i2p1_ziccamoa1p0"
606+
; RV64ZICCAMOC: .attribute 5, "rv64i2p1_ziccamoc1p0"
605607
; RV64ZICCIF: .attribute 5, "rv64i2p1_ziccif1p0"
606608
; RV64ZICCLSM: .attribute 5, "rv64i2p1_zicclsm1p0"
607609
; RV64ZICCRSE: .attribute 5, "rv64i2p1_ziccrse1p0"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
; CHECK-NEXT: zicbop - 'Zicbop' (Cache-Block Prefetch Instructions).
238238
; CHECK-NEXT: zicboz - 'Zicboz' (Cache-Block Zero Instructions).
239239
; CHECK-NEXT: ziccamoa - 'Ziccamoa' (Main Memory Supports All Atomics in A).
240+
; CHECK-NEXT: ziccamoc - 'Ziccamoc' (Main Memory Supports Atomics in Zacas).
240241
; CHECK-NEXT: ziccif - 'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement).
241242
; CHECK-NEXT: zicclsm - 'Zicclsm' (Main Memory Supports Misaligned Loads/Stores).
242243
; CHECK-NEXT: ziccrse - 'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences).

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
.attribute arch, "rv32iziccamoa"
107107
# CHECK: attribute 5, "rv32i2p1_ziccamoa1p0"
108108

109+
.attribute arch, "rv32iziccamoc"
110+
# CHECK: attribute 5, "rv32i2p1_ziccamoc1p0"
111+
109112
.attribute arch, "rv32iziccif"
110113
# CHECK: attribute 5, "rv32i2p1_ziccif1p0"
111114

llvm/unittests/TargetParser/RISCVISAInfoTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ R"(All available -march extensions for RISC-V
982982
zicbop 1.0
983983
zicboz 1.0
984984
ziccamoa 1.0
985+
ziccamoc 1.0
985986
ziccif 1.0
986987
zicclsm 1.0
987988
ziccrse 1.0

0 commit comments

Comments
 (0)