Skip to content

Commit 9324872

Browse files
authored
[RISCV][MC] Split tests for A into Zaamo and Zalrsc parts
So that we don't duplicate tests in later patch. Reviewers: topperc, dtcxzyw, asb Reviewed By: asb Pull Request: #79111
1 parent 63f742c commit 9324872

8 files changed

+92
-71
lines changed

llvm/test/MC/RISCV/rv32a-invalid.s renamed to llvm/test/MC/RISCV/rv32zaamo-invalid.s

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@
44
amoswap.w a1, a2, a3 # CHECK: :[[@LINE]]:19: error: expected '(' or optional integer offset
55
amomin.w a1, a2, 1 # CHECK: :[[@LINE]]:20: error: expected '(' after optional integer offset
66
amomin.w a1, a2, 1(a3) # CHECK: :[[@LINE]]:18: error: optional integer offset must be 0
7-
lr.w a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset
87

98
# Only .aq, .rl, and .aqrl suffixes are valid
109
amoxor.w.rlqa a2, a3, (a4) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
1110
amoor.w.aq.rl a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
1211
amoor.w. a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
13-
14-
# lr only takes two operands
15-
lr.w s0, (s1), s2 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction
16-
17-
# Note: errors for use of RV64A instructions for RV32 are checked in
18-
# rv64a-valid.s

llvm/test/MC/RISCV/rv32a-valid.s renamed to llvm/test/MC/RISCV/rv32zaamo-valid.s

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,6 @@
99
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
1010
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
1111

12-
# CHECK-ASM-AND-OBJ: lr.w t0, (t1)
13-
# CHECK-ASM: encoding: [0xaf,0x22,0x03,0x10]
14-
lr.w t0, (t1)
15-
# CHECK-ASM-AND-OBJ: lr.w.aq t1, (t2)
16-
# CHECK-ASM: encoding: [0x2f,0xa3,0x03,0x14]
17-
lr.w.aq t1, (t2)
18-
# CHECK-ASM-AND-OBJ: lr.w.rl t2, (t3)
19-
# CHECK-ASM: encoding: [0xaf,0x23,0x0e,0x12]
20-
lr.w.rl t2, (t3)
21-
# CHECK-ASM-AND-OBJ: lr.w.aqrl t3, (t4)
22-
# CHECK-ASM: encoding: [0x2f,0xae,0x0e,0x16]
23-
lr.w.aqrl t3, (t4)
24-
25-
# CHECK-ASM-AND-OBJ: sc.w t6, t5, (t4)
26-
# CHECK-ASM: encoding: [0xaf,0xaf,0xee,0x19]
27-
sc.w t6, t5, (t4)
28-
# CHECK-ASM-AND-OBJ: sc.w.aq t5, t4, (t3)
29-
# CHECK-ASM: encoding: [0x2f,0x2f,0xde,0x1d]
30-
sc.w.aq t5, t4, (t3)
31-
# CHECK-ASM-AND-OBJ: sc.w.rl t4, t3, (t2)
32-
# CHECK-ASM: encoding: [0xaf,0xae,0xc3,0x1b]
33-
sc.w.rl t4, t3, (t2)
34-
# CHECK-ASM-AND-OBJ: sc.w.aqrl t3, t2, (t1)
35-
# CHECK-ASM: encoding: [0x2f,0x2e,0x73,0x1e]
36-
sc.w.aqrl t3, t2, (t1)
37-
3812
# CHECK-ASM-AND-OBJ: amoswap.w a4, ra, (s0)
3913
# CHECK-ASM: encoding: [0x2f,0x27,0x14,0x08]
4014
amoswap.w a4, ra, (s0)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 | FileCheck %s
2+
3+
# Final operand must have parentheses
4+
lr.w a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset
5+
6+
# lr only takes two operands
7+
lr.w s0, (s1), s2 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# RUN: llvm-mc %s -triple=riscv32 -mattr=+a -riscv-no-aliases -show-encoding \
2+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+a -riscv-no-aliases -show-encoding \
4+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
5+
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+a < %s \
6+
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
7+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
8+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a < %s \
9+
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
10+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
11+
12+
# CHECK-ASM-AND-OBJ: lr.w t0, (t1)
13+
# CHECK-ASM: encoding: [0xaf,0x22,0x03,0x10]
14+
lr.w t0, (t1)
15+
# CHECK-ASM-AND-OBJ: lr.w.aq t1, (t2)
16+
# CHECK-ASM: encoding: [0x2f,0xa3,0x03,0x14]
17+
lr.w.aq t1, (t2)
18+
# CHECK-ASM-AND-OBJ: lr.w.rl t2, (t3)
19+
# CHECK-ASM: encoding: [0xaf,0x23,0x0e,0x12]
20+
lr.w.rl t2, (t3)
21+
# CHECK-ASM-AND-OBJ: lr.w.aqrl t3, (t4)
22+
# CHECK-ASM: encoding: [0x2f,0xae,0x0e,0x16]
23+
lr.w.aqrl t3, (t4)
24+
25+
# CHECK-ASM-AND-OBJ: sc.w t6, t5, (t4)
26+
# CHECK-ASM: encoding: [0xaf,0xaf,0xee,0x19]
27+
sc.w t6, t5, (t4)
28+
# CHECK-ASM-AND-OBJ: sc.w.aq t5, t4, (t3)
29+
# CHECK-ASM: encoding: [0x2f,0x2f,0xde,0x1d]
30+
sc.w.aq t5, t4, (t3)
31+
# CHECK-ASM-AND-OBJ: sc.w.rl t4, t3, (t2)
32+
# CHECK-ASM: encoding: [0xaf,0xae,0xc3,0x1b]
33+
sc.w.rl t4, t3, (t2)
34+
# CHECK-ASM-AND-OBJ: sc.w.aqrl t3, t2, (t1)
35+
# CHECK-ASM: encoding: [0x2f,0x2e,0x73,0x1e]
36+
sc.w.aqrl t3, t2, (t1)

llvm/test/MC/RISCV/rv64a-invalid.s renamed to llvm/test/MC/RISCV/rv64zaamo-invalid.s

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
amoswap.d a1, a2, a3 # CHECK: :[[@LINE]]:19: error: expected '(' or optional integer offset
55
amomin.d a1, a2, 1 # CHECK: :[[@LINE]]:20: error: expected '(' after optional integer offset
66
amomin.d a1, a2, 1(a3) # CHECK: :[[@LINE]]:18: error: optional integer offset must be 0
7-
lr.d a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset
87

98
# Only .aq, .rl, and .aqrl suffixes are valid
109
amoxor.d.rlqa a2, a3, (a4) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
1110
amoor.d.aq.rl a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
1211
amoor.d. a4, a5, (a6) # CHECK: :[[@LINE]]:1: error: unrecognized instruction mnemonic
13-
14-
# lr only takes two operands
15-
lr.d s0, (s1), s2 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction

llvm/test/MC/RISCV/rv64a-valid.s renamed to llvm/test/MC/RISCV/rv64zaamo-valid.s

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,6 @@
77
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 \
88
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
99

10-
# CHECK-ASM-AND-OBJ: lr.d t0, (t1)
11-
# CHECK-ASM: encoding: [0xaf,0x32,0x03,0x10]
12-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
13-
lr.d t0, (t1)
14-
# CHECK-ASM-AND-OBJ: lr.d.aq t1, (t2)
15-
# CHECK-ASM: encoding: [0x2f,0xb3,0x03,0x14]
16-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
17-
lr.d.aq t1, (t2)
18-
# CHECK-ASM-AND-OBJ: lr.d.rl t2, (t3)
19-
# CHECK-ASM: encoding: [0xaf,0x33,0x0e,0x12]
20-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
21-
lr.d.rl t2, (t3)
22-
# CHECK-ASM-AND-OBJ: lr.d.aqrl t3, (t4)
23-
# CHECK-ASM: encoding: [0x2f,0xbe,0x0e,0x16]
24-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
25-
lr.d.aqrl t3, (t4)
26-
27-
# CHECK-ASM-AND-OBJ: sc.d t6, t5, (t4)
28-
# CHECK-ASM: encoding: [0xaf,0xbf,0xee,0x19]
29-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
30-
sc.d t6, t5, (t4)
31-
# CHECK-ASM-AND-OBJ: sc.d.aq t5, t4, (t3)
32-
# CHECK-ASM: encoding: [0x2f,0x3f,0xde,0x1d]
33-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
34-
sc.d.aq t5, t4, (t3)
35-
# CHECK-ASM-AND-OBJ: sc.d.rl t4, t3, (t2)
36-
# CHECK-ASM: encoding: [0xaf,0xbe,0xc3,0x1b]
37-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
38-
sc.d.rl t4, t3, (t2)
39-
# CHECK-ASM-AND-OBJ: sc.d.aqrl t3, t2, (t1)
40-
# CHECK-ASM: encoding: [0x2f,0x3e,0x73,0x1e]
41-
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
42-
sc.d.aqrl t3, t2, (t1)
43-
4410
# CHECK-ASM-AND-OBJ: amoswap.d a4, ra, (s0)
4511
# CHECK-ASM: encoding: [0x2f,0x37,0x14,0x08]
4612
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: not llvm-mc -triple riscv64 -mattr=+a < %s 2>&1 | FileCheck %s
2+
3+
# Final operand must have parentheses
4+
lr.d a4, a5 # CHECK: :[[@LINE]]:10: error: expected '(' or optional integer offset
5+
6+
# lr only takes two operands
7+
lr.d s0, (s1), s2 # CHECK: :[[@LINE]]:16: error: invalid operand for instruction

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# RUN: llvm-mc %s -triple=riscv64 -mattr=+a -riscv-no-aliases -show-encoding \
2+
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3+
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a < %s \
4+
# RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
5+
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
6+
#
7+
# RUN: not llvm-mc -triple riscv32 -mattr=+a < %s 2>&1 \
8+
# RUN: | FileCheck -check-prefix=CHECK-RV32 %s
9+
10+
# CHECK-ASM-AND-OBJ: lr.d t0, (t1)
11+
# CHECK-ASM: encoding: [0xaf,0x32,0x03,0x10]
12+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
13+
lr.d t0, (t1)
14+
# CHECK-ASM-AND-OBJ: lr.d.aq t1, (t2)
15+
# CHECK-ASM: encoding: [0x2f,0xb3,0x03,0x14]
16+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
17+
lr.d.aq t1, (t2)
18+
# CHECK-ASM-AND-OBJ: lr.d.rl t2, (t3)
19+
# CHECK-ASM: encoding: [0xaf,0x33,0x0e,0x12]
20+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
21+
lr.d.rl t2, (t3)
22+
# CHECK-ASM-AND-OBJ: lr.d.aqrl t3, (t4)
23+
# CHECK-ASM: encoding: [0x2f,0xbe,0x0e,0x16]
24+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
25+
lr.d.aqrl t3, (t4)
26+
27+
# CHECK-ASM-AND-OBJ: sc.d t6, t5, (t4)
28+
# CHECK-ASM: encoding: [0xaf,0xbf,0xee,0x19]
29+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
30+
sc.d t6, t5, (t4)
31+
# CHECK-ASM-AND-OBJ: sc.d.aq t5, t4, (t3)
32+
# CHECK-ASM: encoding: [0x2f,0x3f,0xde,0x1d]
33+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
34+
sc.d.aq t5, t4, (t3)
35+
# CHECK-ASM-AND-OBJ: sc.d.rl t4, t3, (t2)
36+
# CHECK-ASM: encoding: [0xaf,0xbe,0xc3,0x1b]
37+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
38+
sc.d.rl t4, t3, (t2)
39+
# CHECK-ASM-AND-OBJ: sc.d.aqrl t3, t2, (t1)
40+
# CHECK-ASM: encoding: [0x2f,0x3e,0x73,0x1e]
41+
# CHECK-RV32: :[[@LINE+1]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
42+
sc.d.aqrl t3, t2, (t1)

0 commit comments

Comments
 (0)