Skip to content

Commit 1a14c44

Browse files
authored
[RISCV][MC] Add experimental support of Zaamo and Zalrsc
`A` extension has been split into two parts: Zaamo (Atomic Memory Operations) and Zalrsc (Load-Reserved/Store-Conditional). See also https://github.com/riscv/riscv-zaamo-zalrsc. This patch adds the MC support. Reviewers: dtcxzyw, topperc, kito-cheng Reviewed By: topperc Pull Request: #78970
1 parent a15ebe0 commit 1a14c44

16 files changed

+106
-5
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@
141141

142142
// Experimental extensions
143143

144+
// CHECK-NOT: __riscv_zaamo {{.*$}}
144145
// CHECK-NOT: __riscv_zacas {{.*$}}
146+
// CHECK-NOT: __riscv_zalrsc {{.*$}}
145147
// CHECK-NOT: __riscv_zcmop {{.*$}}
146148
// CHECK-NOT: __riscv_zfbfmin {{.*$}}
147149
// CHECK-NOT: __riscv_zicfilp {{.*$}}
@@ -1307,6 +1309,13 @@
13071309
// CHECK-ZVKT-EXT: __riscv_zvkt 1000000{{$}}
13081310

13091311
// Experimental extensions
1312+
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
1313+
// RUN: -march=rv32i_zaamo0p2 -E -dM %s \
1314+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZAAMO-EXT %s
1315+
// RUN: %clang --target=riscv64 -menable-experimental-extensions \
1316+
// RUN: -march=rv64i_zaamo0p2 -E -dM %s \
1317+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZAAMO-EXT %s
1318+
// CHECK-ZAAMO-EXT: __riscv_zaamo 2000{{$}}
13101319

13111320
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
13121321
// RUN: -march=rv32i_zacas1p0 -E -dM %s \
@@ -1316,6 +1325,14 @@
13161325
// RUN: -o - | FileCheck --check-prefix=CHECK-ZACAS-EXT %s
13171326
// CHECK-ZACAS-EXT: __riscv_zacas 1000000{{$}}
13181327

1328+
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
1329+
// RUN: -march=rv32i_zalrsc0p2 -E -dM %s \
1330+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZALRSC-EXT %s
1331+
// RUN: %clang --target=riscv64 -menable-experimental-extensions \
1332+
// RUN: -march=rv64i_zalrsc0p2 -E -dM %s \
1333+
// RUN: -o - | FileCheck --check-prefix=CHECK-ZALRSC-EXT %s
1334+
// CHECK-ZALRSC-EXT: __riscv_zalrsc 2000{{$}}
1335+
13191336
// RUN: %clang --target=riscv32 -menable-experimental-extensions \
13201337
// RUN: -march=rv32izfbfmin1p0 -E -dM %s \
13211338
// RUN: -o - | FileCheck --check-prefix=CHECK-ZFBFMIN-EXT %s

llvm/docs/RISCVUsage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ The primary goal of experimental support is to assist in the process of ratifica
246246
``experimental-zcmop``
247247
LLVM implements the `v0.2 proposed specification <https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc>`__.
248248

249+
``experimental-zaamo``, ``experimental-zalrsc``
250+
LLVM implements the `v0.2 proposed specification <https://github.com/riscv/riscv-zaamo-zalrsc/releases/tag/v0.2>`__.
251+
249252
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`.
250253

251254
Vendor Extensions

llvm/lib/Support/RISCVISAInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
190190
};
191191

192192
// NOTE: This table should be sorted alphabetically by extension name.
193+
// clang-format off
193194
static const RISCVSupportedExtension SupportedExperimentalExtensions[] = {
195+
{"zaamo", {0, 2}},
194196
{"zacas", {1, 0}},
197+
{"zalrsc", {0, 2}},
195198

196199
{"zcmop", {0, 2}},
197200

@@ -209,6 +212,7 @@ static const RISCVSupportedExtension SupportedExperimentalExtensions[] = {
209212
{"zvfbfmin", {1, 0}},
210213
{"zvfbfwma", {1, 0}},
211214
};
215+
// clang-format on
212216

213217
static void verifyTables() {
214218
#ifndef NDEBUG

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ def FeatureStdExtZa64rs : SubtargetFeature<"za64rs", "HasStdExtZa64rs", "true",
168168
def FeatureStdExtZa128rs : SubtargetFeature<"za128rs", "HasStdExtZa128rs", "true",
169169
"'Za128rs' (Reservation Set Size of at Most 128 Bytes)">;
170170

171+
def FeatureStdExtZaamo
172+
: SubtargetFeature<"experimental-zaamo", "HasStdExtZaamo", "true",
173+
"'Zaamo' (Atomic Memory Operations)">;
174+
def HasStdExtAOrZaamo
175+
: Predicate<"Subtarget->hasStdExtA() || Subtarget->hasStdExtZaamo()">,
176+
AssemblerPredicate<(any_of FeatureStdExtA, FeatureStdExtZaamo),
177+
"'A' (Atomic Instructions) or "
178+
"'Zaamo' (Atomic Memory Operations)">;
179+
171180
def FeatureStdExtZacas
172181
: SubtargetFeature<"experimental-zacas", "HasStdExtZacas", "true",
173182
"'Zacas' (Atomic Compare-And-Swap Instructions)">;
@@ -176,6 +185,15 @@ def HasStdExtZacas : Predicate<"Subtarget->hasStdExtZacas()">,
176185
"'Zacas' (Atomic Compare-And-Swap Instructions)">;
177186
def NoStdExtZacas : Predicate<"!Subtarget->hasStdExtZacas()">;
178187

188+
def FeatureStdExtZalrsc
189+
: SubtargetFeature<"experimental-zalrsc", "HasStdExtZalrsc", "true",
190+
"'Zalrsc' (Load-Reserved/Store-Conditional)">;
191+
def HasStdExtAOrZalrsc
192+
: Predicate<"Subtarget->hasStdExtA() || Subtarget->hasStdExtZalrsc()">,
193+
AssemblerPredicate<(any_of FeatureStdExtA, FeatureStdExtZalrsc),
194+
"'A' (Atomic Instructions) or "
195+
"'Zalrsc' (Load-Reserved/Store-Conditional)">;
196+
179197
def FeatureStdExtZawrs : SubtargetFeature<"zawrs", "HasStdExtZawrs", "true",
180198
"'Zawrs' (Wait on Reservation Set)">;
181199
def HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">,

llvm/lib/Target/RISCV/RISCVInstrInfoA.td

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ multiclass AMO_rr_aq_rl<bits<5> funct5, bits<3> funct3, string opcodestr> {
4747
// Instructions
4848
//===----------------------------------------------------------------------===//
4949

50-
let Predicates = [HasStdExtA], IsSignExtendingOpW = 1 in {
50+
let Predicates = [HasStdExtAOrZalrsc], IsSignExtendingOpW = 1 in {
5151
defm LR_W : LR_r_aq_rl<0b010, "lr.w">, Sched<[WriteAtomicLDW, ReadAtomicLDW]>;
5252
defm SC_W : AMO_rr_aq_rl<0b00011, 0b010, "sc.w">,
5353
Sched<[WriteAtomicSTW, ReadAtomicSTW, ReadAtomicSTW]>;
54+
} // Predicates = [HasStdExtAOrZalrsc], IsSignExtendingOpW = 1
55+
56+
let Predicates = [HasStdExtAOrZaamo], IsSignExtendingOpW = 1 in {
5457
defm AMOSWAP_W : AMO_rr_aq_rl<0b00001, 0b010, "amoswap.w">,
5558
Sched<[WriteAtomicW, ReadAtomicWA, ReadAtomicWD]>;
5659
defm AMOADD_W : AMO_rr_aq_rl<0b00000, 0b010, "amoadd.w">,
@@ -69,12 +72,15 @@ defm AMOMINU_W : AMO_rr_aq_rl<0b11000, 0b010, "amominu.w">,
6972
Sched<[WriteAtomicW, ReadAtomicWA, ReadAtomicWD]>;
7073
defm AMOMAXU_W : AMO_rr_aq_rl<0b11100, 0b010, "amomaxu.w">,
7174
Sched<[WriteAtomicW, ReadAtomicWA, ReadAtomicWD]>;
72-
} // Predicates = [HasStdExtA]
75+
} // Predicates = [HasStdExtAOrZaamo], IsSignExtendingOpW = 1
7376

74-
let Predicates = [HasStdExtA, IsRV64] in {
77+
let Predicates = [HasStdExtAOrZalrsc, IsRV64] in {
7578
defm LR_D : LR_r_aq_rl<0b011, "lr.d">, Sched<[WriteAtomicLDD, ReadAtomicLDD]>;
7679
defm SC_D : AMO_rr_aq_rl<0b00011, 0b011, "sc.d">,
7780
Sched<[WriteAtomicSTD, ReadAtomicSTD, ReadAtomicSTD]>;
81+
} // Predicates = [HasStdExtAOrZalrsc, IsRV64]
82+
83+
let Predicates = [HasStdExtAOrZaamo, IsRV64] in {
7884
defm AMOSWAP_D : AMO_rr_aq_rl<0b00001, 0b011, "amoswap.d">,
7985
Sched<[WriteAtomicD, ReadAtomicDA, ReadAtomicDD]>;
8086
defm AMOADD_D : AMO_rr_aq_rl<0b00000, 0b011, "amoadd.d">,
@@ -93,7 +99,7 @@ defm AMOMINU_D : AMO_rr_aq_rl<0b11000, 0b011, "amominu.d">,
9399
Sched<[WriteAtomicD, ReadAtomicDA, ReadAtomicDD]>;
94100
defm AMOMAXU_D : AMO_rr_aq_rl<0b11100, 0b011, "amomaxu.d">,
95101
Sched<[WriteAtomicD, ReadAtomicDA, ReadAtomicDD]>;
96-
} // Predicates = [HasStdExtA, IsRV64]
102+
} // Predicates = [HasStdExtAOrZaamo, IsRV64]
97103

98104
//===----------------------------------------------------------------------===//
99105
// Pseudo-instructions and codegen patterns

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@
9393
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV32ZFBFMIN %s
9494
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zvfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV32ZVFBFMIN %s
9595
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zvfbfwma %s -o - | FileCheck --check-prefixes=CHECK,RV32ZVFBFWMA %s
96+
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zaamo %s -o - | FileCheck --check-prefix=RV32ZAAMO %s
9697
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zacas %s -o - | FileCheck --check-prefix=RV32ZACAS %s
98+
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zalrsc %s -o - | FileCheck --check-prefix=RV32ZALRSC %s
9799
; RUN: llc -mtriple=riscv32 -mattr=+experimental-zicfilp %s -o - | FileCheck --check-prefix=RV32ZICFILP %s
98100

99101
; RUN: llc -mtriple=riscv64 %s -o - | FileCheck %s
@@ -195,7 +197,9 @@
195197
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV64ZFBFMIN %s
196198
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zvfbfmin %s -o - | FileCheck --check-prefixes=CHECK,RV64ZVFBFMIN %s
197199
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zvfbfwma %s -o - | FileCheck --check-prefixes=CHECK,RV64ZVFBFWMA %s
200+
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zaamo %s -o - | FileCheck --check-prefix=RV64ZAAMO %s
198201
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zacas %s -o - | FileCheck --check-prefix=RV64ZACAS %s
202+
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zalrsc %s -o - | FileCheck --check-prefix=RV64ZALRSC %s
199203
; RUN: llc -mtriple=riscv64 -mattr=+experimental-zicfilp %s -o - | FileCheck --check-prefix=RV64ZICFILP %s
200204

201205
; CHECK: .attribute 4, 16
@@ -292,7 +296,9 @@
292296
; RV32ZFBFMIN: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zfbfmin1p0"
293297
; RV32ZVFBFMIN: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvl32b1p0"
294298
; RV32ZVFBFWMA: .attribute 5, "rv32i2p1_f2p2_zicsr2p0_zfbfmin1p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvfbfwma1p0_zvl32b1p0"
299+
; RV32ZAAMO: .attribute 5, "rv32i2p1_zaamo0p2"
295300
; RV32ZACAS: .attribute 5, "rv32i2p1_a2p1_zacas1p0"
301+
; RV32ZALRSC: .attribute 5, "rv32i2p1_zalrsc0p2"
296302
; RV32ZICFILP: .attribute 5, "rv32i2p1_zicfilp0p4"
297303

298304
; RV64M: .attribute 5, "rv64i2p1_m2p0"
@@ -393,7 +399,9 @@
393399
; RV64ZFBFMIN: .attribute 5, "rv64i2p1_f2p2_zicsr2p0_zfbfmin1p0"
394400
; RV64ZVFBFMIN: .attribute 5, "rv64i2p1_f2p2_zicsr2p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvl32b1p0"
395401
; RV64ZVFBFWMA: .attribute 5, "rv64i2p1_f2p2_zicsr2p0_zfbfmin1p0_zve32f1p0_zve32x1p0_zvfbfmin1p0_zvfbfwma1p0_zvl32b1p0"
402+
; RV64ZAAMO: .attribute 5, "rv64i2p1_zaamo0p2"
396403
; RV64ZACAS: .attribute 5, "rv64i2p1_a2p1_zacas1p0"
404+
; RV64ZALRSC: .attribute 5, "rv64i2p1_zalrsc0p2"
397405
; RV64ZICFILP: .attribute 5, "rv64i2p1_zicfilp0p4"
398406

399407
define i32 @addi(i32 %a) {

llvm/test/MC/RISCV/rv32i-invalid.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ xor s2, s2 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
170170

171171
# Instruction not in the base ISA
172172
div a4, ra, s0 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'M' (Integer Multiplication and Division){{$}}
173-
amomaxu.w s5, s4, (s3) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'A' (Atomic Instructions){{$}}
173+
amomaxu.w s5, s4, (s3) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'A' (Atomic Instructions) or 'Zaamo' (Atomic Memory Operations){{$}}
174+
lr.w t0, (t1) # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'A' (Atomic Instructions) or 'Zalrsc' (Load-Reserved/Store-Conditional){{$}}
174175
fadd.s ft0, ft1, ft2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'F' (Single-Precision Floating-Point){{$}}
175176
fadd.h ft0, ft1, ft2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfh' (Half-Precision Floating-Point){{$}}
176177
fadd.s a0, a1, a2 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Zfinx' (Float in Integer){{$}}

llvm/test/MC/RISCV/rv32zaamo-invalid.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 | FileCheck %s
2+
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zaamo < %s 2>&1 | FileCheck %s
23

34
# Final operand must have parentheses
45
amoswap.w a1, a2, a3 # CHECK: :[[@LINE]]:19: error: expected '(' or optional integer offset

llvm/test/MC/RISCV/rv32zaamo-valid.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a < %s \
99
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
1010
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
11+
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zaamo -riscv-no-aliases -show-encoding \
12+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
13+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zaamo -riscv-no-aliases -show-encoding \
14+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
15+
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zaamo < %s \
16+
# RUN: | llvm-objdump --mattr=+experimental-zaamo -M no-aliases -d -r - \
17+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
18+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zaamo < %s \
19+
# RUN: | llvm-objdump --mattr=+experimental-zaamo -M no-aliases -d -r - \
20+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
1121

1222
# CHECK-ASM-AND-OBJ: amoswap.w a4, ra, (s0)
1323
# CHECK-ASM: encoding: [0x2f,0x27,0x14,0x08]

llvm/test/MC/RISCV/rv32zalrsc-invalid.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 | FileCheck %s
2+
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zalrsc < %s 2>&1 | FileCheck %s
23

34
# Final operand must have parentheses
45
lr.w a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset

llvm/test/MC/RISCV/rv32zalrsc-valid.s

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a < %s \
99
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
1010
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
11+
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zalrsc -riscv-no-aliases -show-encoding \
12+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
13+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zalrsc -riscv-no-aliases -show-encoding \
14+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
15+
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zalrsc < %s \
16+
# RUN: | llvm-objdump --mattr=+experimental-zalrsc -M no-aliases -d -r - \
17+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
18+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zalrsc < %s \
19+
# RUN: | llvm-objdump --mattr=+experimental-zalrsc -M no-aliases -d -r - \
20+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
1121

1222
# CHECK-ASM-AND-OBJ: lr.w t0, (t1)
1323
# CHECK-ASM: encoding: [0xaf,0x22,0x03,0x10]

llvm/test/MC/RISCV/rv64zaamo-invalid.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: not llvm-mc -triple riscv64 -mattr=+a < %s 2>&1 | FileCheck %s
2+
# RUN: not llvm-mc -triple riscv64 -mattr=+experimental-zaamo < %s 2>&1 | FileCheck %s
23

34
# Final operand must have parentheses
45
amoswap.d a1, a2, a3 # CHECK: :[[@LINE]]:19: error: expected '(' or optional integer offset

llvm/test/MC/RISCV/rv64zaamo-valid.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
#
77
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 \
88
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
9+
#
10+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zaamo -riscv-no-aliases -show-encoding \
11+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
12+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zaamo < %s \
13+
# RUN: | llvm-objdump --mattr=+experimental-zaamo -M no-aliases -d -r - \
14+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
15+
#
16+
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zaamo < %s 2>&1 \
17+
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
918

1019
# CHECK-ASM-AND-OBJ: amoswap.d a4, ra, (s0)
1120
# CHECK-ASM: encoding: [0x2f,0x37,0x14,0x08]

llvm/test/MC/RISCV/rv64zalrsc-invalid.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: not llvm-mc -triple riscv64 -mattr=+a < %s 2>&1 | FileCheck %s
2+
# RUN: not llvm-mc -triple riscv64 -mattr=+experimental-zalrsc < %s 2>&1 | FileCheck %s
23

34
# Final operand must have parentheses
45
lr.d a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset

llvm/test/MC/RISCV/rv64zalrsc-valid.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
#
77
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 \
88
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
9+
#
10+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zalrsc -riscv-no-aliases -show-encoding \
11+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
12+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zalrsc < %s \
13+
# RUN: | llvm-objdump --mattr=+experimental-zalrsc -M no-aliases -d -r - \
14+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
15+
#
16+
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zalrsc < %s 2>&1 \
17+
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
918

1019
# CHECK-ASM-AND-OBJ: lr.d t0, (t1)
1120
# CHECK-ASM: encoding: [0xaf,0x32,0x03,0x10]

llvm/unittests/Support/RISCVISAInfoTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,9 @@ Experimental extensions
795795
zicfiss 0.4
796796
zicond 1.0
797797
zimop 0.1
798+
zaamo 0.2
798799
zacas 1.0
800+
zalrsc 0.2
799801
zfbfmin 1.0
800802
zcmop 0.2
801803
ztso 0.1

0 commit comments

Comments
 (0)