Skip to content

Commit b090569

Browse files
authored
[RISCV] Support Zama16b1p0 (#88474)
This patch adds the support for Zama16b version 1.0, which has been added to RVA23U64 optional extensions recently
1 parent 16f1887 commit b090569

File tree

7 files changed

+25
-1
lines changed

7 files changed

+25
-1
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
// CHECK-NOT: __riscv_za128rs {{.*$}}
8080
// CHECK-NOT: __riscv_za64rs {{.*$}}
8181
// CHECK-NOT: __riscv_zacas {{.*$}}
82+
// CHECK-NOT: __riscv_zama16b {{.*$}}
8283
// CHECK-NOT: __riscv_zawrs {{.*$}}
8384
// CHECK-NOT: __riscv_zba {{.*$}}
8485
// CHECK-NOT: __riscv_zbb {{.*$}}
@@ -704,6 +705,12 @@
704705
// RUN: -o - | FileCheck --check-prefix=CHECK-ZACAS-EXT %s
705706
// CHECK-ZACAS-EXT: __riscv_zacas 1000000{{$}}
706707

708+
// RUN: %clang --target=riscv32 -march=rv32izama16b -x c -E -dM %s \
709+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZAMA16B-EXT %s
710+
// RUN: %clang --target=riscv64 -march=rv64izama16b -x c -E -dM %s \
711+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZAMA16B-EXT %s
712+
// CHECK-ZAMA16B-EXT: __riscv_zama16b 1000000{{$}}
713+
707714
// RUN: %clang --target=riscv32-unknown-linux-gnu \
708715
// RUN: -march=rv32izawrs -E -dM %s \
709716
// RUN: -o - | FileCheck --check-prefix=CHECK-ZAWRS-EXT %s

llvm/docs/RISCVUsage.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ on support follow.
119119
``Za128rs`` Supported (`See note <#riscv-profiles-extensions-note>`__)
120120
``Za64rs`` Supported (`See note <#riscv-profiles-extensions-note>`__)
121121
``Zacas`` Supported (`See note <#riscv-zacas-note>`__)
122+
``Zama16b`` Supported (`See note <#riscv-profiles-extensions-note>`__)
122123
``Zawrs`` Assembly Support
123124
``Zba`` Supported
124125
``Zbb`` Supported
@@ -237,7 +238,7 @@ Supported
237238

238239
.. _riscv-profiles-extensions-note:
239240

240-
``Za128rs``, ``Za64rs``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
241+
``Za128rs``, ``Za64rs``, ``Zama16b``, ``Zic64b``, ``Ziccamoa``, ``Ziccif``, ``Zicclsm``, ``Ziccrse``, ``Shcounterenvw``, ``Shgatpa``, ``Shtvala``, ``Shvsatpa``, ``Shvstvala``, ``Shvstvecd``, ``Ssccptr``, ``Sscounterenw``, ``Ssstateen``, ``Ssstrict``, ``Sstvala``, ``Sstvecd``, ``Ssu64xl``, ``Svade``, ``Svbare``
241242
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.
242243

243244
.. _riscv-zacas-note:

llvm/lib/Support/RISCVISAInfo.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
119119
{"za128rs", {1, 0}},
120120
{"za64rs", {1, 0}},
121121
{"zacas", {1, 0}},
122+
{"zama16b", {1, 0}},
122123
{"zawrs", {1, 0}},
123124

124125
{"zba", {1, 0}},

llvm/lib/Target/RISCV/RISCVFeatures.td

+7
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ def HasStdExtAOrZalrsc
208208
"'A' (Atomic Instructions) or "
209209
"'Zalrsc' (Load-Reserved/Store-Conditional)">;
210210

211+
def FeatureStdExtZama16b
212+
: SubtargetFeature<"zama16b", "HasStdExtZama16b", "true",
213+
"'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)">;
214+
def HasStdExtZama16b : Predicate<"Subtarget->hasStdExtZama16b()">,
215+
AssemblerPredicate<(all_of FeatureStdExtZama16b),
216+
"'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)">;
217+
211218
def FeatureStdExtZawrs : SubtargetFeature<"zawrs", "HasStdExtZawrs", "true",
212219
"'Zawrs' (Wait on Reservation Set)">;
213220
def HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">,

llvm/test/CodeGen/RISCV/attributes.ll

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
; RUN: llc -mtriple=riscv32 -mattr=+zacas %s -o - | FileCheck --check-prefix=RV32ZACAS %s
116116
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zalasr %s -o - | FileCheck --check-prefix=RV32ZALASR %s
117117
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zalrsc %s -o - | FileCheck --check-prefix=RV32ZALRSC %s
118+
; RUN: llc -mtriple=riscv32 -mattr=+zama16b %s -o - | FileCheck --check-prefixes=CHECK,RV32ZAMA16B %s
118119
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zicfilp %s -o - | FileCheck --check-prefix=RV32ZICFILP %s
119120
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zabha %s -o - | FileCheck --check-prefix=RV32ZABHA %s
120121
; RUN: llc -mtriple=riscv32 -mattr=+experimental-ssnpm %s -o - | FileCheck --check-prefix=RV32SSNPM %s
@@ -199,6 +200,7 @@
199200
; RUN: llc -mtriple=riscv64 -mattr=+xtheadvdot %s -o - | FileCheck --check-prefixes=CHECK,RV64XTHEADVDOT %s
200201
; RUN: llc -mtriple=riscv64 -mattr=+za64rs %s -o - | FileCheck --check-prefixes=CHECK,RV64ZA64RS %s
201202
; RUN: llc -mtriple=riscv64 -mattr=+za128rs %s -o - | FileCheck --check-prefixes=CHECK,RV64ZA128RS %s
203+
; RUN: llc -mtriple=riscv64 -mattr=+zama16b %s -o - | FileCheck --check-prefixes=CHECK,RV64ZAMA16B %s
202204
; RUN: llc -mtriple=riscv64 -mattr=+zawrs %s -o - | FileCheck --check-prefixes=CHECK,RV64ZAWRS %s
203205
; RUN: llc -mtriple=riscv64 -mattr=+experimental-ztso %s -o - | FileCheck --check-prefixes=CHECK,RV64ZTSO %s
204206
; RUN: llc -mtriple=riscv64 -mattr=+zca %s -o - | FileCheck --check-prefixes=CHECK,RV64ZCA %s
@@ -370,6 +372,7 @@
370372
; RV32ZACAS: .attribute 5, "rv32i2p1_a2p1_zacas1p0"
371373
; RV32ZALASR: .attribute 5, "rv32i2p1_zalasr0p1"
372374
; RV32ZALRSC: .attribute 5, "rv32i2p1_zalrsc0p2"
375+
; RV32ZAMA16B: .attribute 5, "rv32i2p1_zama16b1p0"
373376
; RV32ZICFILP: .attribute 5, "rv32i2p1_zicfilp0p4"
374377
; RV32ZABHA: .attribute 5, "rv32i2p1_a2p1_zabha1p0"
375378
; RV32SSNPM: .attribute 5, "rv32i2p1_ssnpm0p8"
@@ -418,6 +421,7 @@
418421
; RV64ZICBOZ: .attribute 5, "rv64i2p1_zicboz1p0"
419422
; RV64ZA64RS: .attribute 5, "rv64i2p1_za64rs1p0"
420423
; RV64ZA128RS: .attribute 5, "rv64i2p1_za128rs1p0"
424+
; RV64ZAMA16B: .attribute 5, "rv64i2p1_zama16b1p0"
421425
; RV64ZAWRS: .attribute 5, "rv64i2p1_zawrs1p0"
422426
; RV64ZICBOP: .attribute 5, "rv64i2p1_zicbop1p0"
423427
; RV64SHCOUNTERENW: .attribute 5, "rv64i2p1_shcounterenw1p0"

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

+3
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@
270270
.attribute arch, "rv32iza64rs1p0"
271271
# CHECK: attribute 5, "rv32i2p1_za64rs1p0"
272272

273+
.attribute arch, "rv32izama16b"
274+
# CHECK: attribute 5, "rv32i2p1_zama16b1p0"
275+
273276
.attribute arch, "rv32izawrs1p0"
274277
# CHECK: attribute 5, "rv32i2p1_zawrs1p0"
275278

llvm/unittests/Support/RISCVISAInfoTest.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ R"(All available -march extensions for RISC-V
769769
za128rs 1.0
770770
za64rs 1.0
771771
zacas 1.0
772+
zama16b 1.0
772773
zawrs 1.0
773774
zfa 1.0
774775
zfh 1.0

0 commit comments

Comments
 (0)