-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RISC-V: Add support for 'Zacas' atomic CAS
This commit adds support for the 'Zacas' extension, adding atomic CAS instructions. Beware that this extension also introduces the concept of register pairs and it checks the validity of rs1 and rs2 if applicable. This is based on the latest (frozen) draft: <https://github.com/riscv/riscv-zacas/releases/tag/v1.0-rc5> bfd/ChangeLog: * elfxx-riscv.c (riscv_implicit_subsets): Make 'Zacas' to imply 'A' extension. (riscv_supported_std_z_ext): Add 'Zacas' to the supported list. (riscv_multi_subset_supports, riscv_multi_subset_supports_ext): Add handling for new instruction class. gas/ChangeLog: * testsuite/gas/riscv/zacas-32.s: New test. * testsuite/gas/riscv/zacas-32.d: Likewise. * testsuite/gas/riscv/zacas-64.s: Likewise. * testsuite/gas/riscv/zacas-64.d: Likewise. * testsuite/gas/riscv/zacas-32-fail.s: New failure test. * testsuite/gas/riscv/zacas-32-fail.d: Likewise. * testsuite/gas/riscv/zacas-32-fail.l: Likewise. * testsuite/gas/riscv/zacas-64-fail.s: New failure test. * testsuite/gas/riscv/zacas-64-fail.d: Likewise. * testsuite/gas/riscv/zacas-64-fail.l: Likewise. include/ChangeLog: * opcode/riscv-opc.h (MATCH_AMOCAS_D, MASK_AMOCAS_D, MATCH_AMOCAS_Q, MASK_AMOCAS_Q, MATCH_AMOCAS_W, MASK_AMOCAS_W): New. * opcode/riscv.h (enum riscv_insn_class): Add new instruction class INSN_CLASS_ZACAS. opcodes/ChangeLog: * riscv-opc.c (REGGROUP_REGS_x, REGGROUP_REGS_1, REGGROUP_REGS_2, DEFINE_MATCH_FUNC_R_3): New match function template with register groups. (match_reggroup_r_1_1_1, match_reggroup_r_1_2_2): New. (riscv_opcodes): Add atomic CAS instructions.
- Loading branch information
Showing
14 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#as: -march=rv32i_zacas | ||
#error_output: zacas-32-fail.l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.*: Assembler messages: | ||
.*: Error: illegal operands `amocas\.d a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.d a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.d\.aq a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.d\.aq a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.d\.rl a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.d\.rl a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.d\.aqrl a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.d\.aqrl a1,a5,\(a2\)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
target: | ||
# amocas.d (RV32): rs1 (operand 3) and rs2 (operand 2) must be even. | ||
amocas.d a1, a4, (a3) | ||
amocas.d a1, a5, (a2) | ||
amocas.d.aq a1, a4, (a3) | ||
amocas.d.aq a1, a5, (a2) | ||
amocas.d.rl a1, a4, (a3) | ||
amocas.d.rl a1, a5, (a2) | ||
amocas.d.aqrl a1, a4, (a3) | ||
amocas.d.aqrl a1, a5, (a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#as: -march=rv32i_zacas | ||
#objdump: -d | ||
|
||
.*:[ ]+file format .* | ||
|
||
|
||
Disassembly of section .text: | ||
|
||
0+000 <target>: | ||
[ ]+[0-9a-f]+:[ ]+28f6a5af[ ]+amocas\.w[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2cf6a5af[ ]+amocas\.w\.aq[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2af6a5af[ ]+amocas\.w\.rl[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2ef6a5af[ ]+amocas\.w\.aqrl[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+28e635af[ ]+amocas\.d[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ce635af[ ]+amocas\.d\.aq[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ae635af[ ]+amocas\.d\.rl[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ee635af[ ]+amocas\.d\.aqrl[ ]+a1,a4,\(a2\) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
target: | ||
amocas.w a1, a5, (a3) | ||
amocas.w.aq a1, a5, (a3) | ||
amocas.w.rl a1, a5, (a3) | ||
amocas.w.aqrl a1, a5, (a3) | ||
amocas.d a1, a4, (a2) | ||
amocas.d.aq a1, a4, (a2) | ||
amocas.d.rl a1, a4, (a2) | ||
amocas.d.aqrl a1, a4, (a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#as: -march=rv64i_zacas | ||
#error_output: zacas-64-fail.l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.*: Assembler messages: | ||
.*: Error: illegal operands `amocas\.q a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.q a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.q\.aq a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.q\.aq a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.q\.rl a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.q\.rl a1,a5,\(a2\)' | ||
.*: Error: illegal operands `amocas\.q\.aqrl a1,a4,\(a3\)' | ||
.*: Error: illegal operands `amocas\.q\.aqrl a1,a5,\(a2\)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
target: | ||
# amocas.q (RV64): rs1 (operand 3) and rs2 (operand 2) must be even. | ||
amocas.q a1, a4, (a3) | ||
amocas.q a1, a5, (a2) | ||
amocas.q.aq a1, a4, (a3) | ||
amocas.q.aq a1, a5, (a2) | ||
amocas.q.rl a1, a4, (a3) | ||
amocas.q.rl a1, a5, (a2) | ||
amocas.q.aqrl a1, a4, (a3) | ||
amocas.q.aqrl a1, a5, (a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#as: -march=rv64i_zacas | ||
#objdump: -d | ||
|
||
.*:[ ]+file format .* | ||
|
||
|
||
Disassembly of section .text: | ||
|
||
0+000 <target>: | ||
[ ]+[0-9a-f]+:[ ]+28f6b5af[ ]+amocas\.d[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2cf6b5af[ ]+amocas\.d\.aq[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2af6b5af[ ]+amocas\.d\.rl[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+2ef6b5af[ ]+amocas\.d\.aqrl[ ]+a1,a5,\(a3\) | ||
[ ]+[0-9a-f]+:[ ]+28e645af[ ]+amocas\.q[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ce645af[ ]+amocas\.q\.aq[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ae645af[ ]+amocas\.q\.rl[ ]+a1,a4,\(a2\) | ||
[ ]+[0-9a-f]+:[ ]+2ee645af[ ]+amocas\.q\.aqrl[ ]+a1,a4,\(a2\) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
target: | ||
amocas.d a1, a5, (a3) | ||
amocas.d.aq a1, a5, (a3) | ||
amocas.d.rl a1, a5, (a3) | ||
amocas.d.aqrl a1, a5, (a3) | ||
amocas.q a1, a4, (a2) | ||
amocas.q.aq a1, a4, (a2) | ||
amocas.q.rl a1, a4, (a2) | ||
amocas.q.aqrl a1, a4, (a2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters