Skip to content

Commit

Permalink
Add zacas
Browse files Browse the repository at this point in the history
  • Loading branch information
trdthg committed Nov 30, 2023
1 parent 0e78c95 commit ebd1d7f
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bfd/elfxx-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
{"v", "d", check_implicit_always},
{"v", "zve64d", check_implicit_always},
{"v", "zvl128b", check_implicit_always},
{"zacas", "a", check_implicit_always},
{"zvfh", "zvfhmin", check_implicit_always},
{"zvfh", "zfhmin", check_implicit_always},
{"zvfhmin", "zve32f", check_implicit_always},
Expand Down Expand Up @@ -1268,6 +1269,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
{"zihintpause", ISA_SPEC_CLASS_DRAFT, 2, 0, 0 },
{"zmmul", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zawrs", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zacas", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zfa", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zfh", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zfhmin", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
Expand Down Expand Up @@ -2430,6 +2432,8 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps,
return riscv_subset_supports (rps, "a");
case INSN_CLASS_ZAWRS:
return riscv_subset_supports (rps, "zawrs");
case INSN_CLASS_ZACAS:
return riscv_subset_supports (rps, "zacas");
case INSN_CLASS_F:
return riscv_subset_supports (rps, "f");
case INSN_CLASS_D:
Expand Down Expand Up @@ -2648,6 +2652,8 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps,
return "a";
case INSN_CLASS_ZAWRS:
return "zawrs";
case INSN_CLASS_ZACAS:
return "zacas";
case INSN_CLASS_F:
return "f";
case INSN_CLASS_D:
Expand Down
11 changes: 11 additions & 0 deletions gas/testsuite/gas/riscv/zacas-32.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#as: -march=rv32g_zacas
#source: zacas-32.s
#objdump: -d

.*:[ ]+file format .*


Disassembly of section .text:

0+000 <target>:
[ ]+[0-9a-f]+:[ ]+28c5a52f[ ]+amocas.w[ ]+a0,a1,a2
2 changes: 2 additions & 0 deletions gas/testsuite/gas/riscv/zacas-32.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target:
amocas.w a0,a1,a2
11 changes: 11 additions & 0 deletions gas/testsuite/gas/riscv/zacas-64.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#as: -march=rv64i_zacas
#source: zacas-64.s
#objdump: -d

.*:[ ]+file format .*


Disassembly of section .text:

0+000 <target>:
[ ]+[0-9a-f]+:[ ]+28c5b52f[ ]+amocas.d[ ]+a0,a1,a2
2 changes: 2 additions & 0 deletions gas/testsuite/gas/riscv/zacas-64.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target:
amocas.d a0,a1,a2
7 changes: 7 additions & 0 deletions include/opcode/riscv-opc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,13 @@
#define MASK_WRS_NTO 0xffffffff
#define MATCH_WRS_STO 0x01d00073
#define MASK_WRS_STO 0xffffffff
/* Zacas intructions */
#define MATCH_CAS_W 0x2800202F
#define MASK_CAS_W 0xFE00707F
#define MATCH_CAS_D 0x2800302F
#define MASK_CAS_D 0xFE00707F
#define MATCH_CAS_Q 0x2800602F
#define MASK_CAS_Q 0xFE00707F
/* Vendor-specific (CORE-V) Xcvmac instructions. */
#define MATCH_CV_MAC 0x9000302b
#define MASK_CV_MAC 0xfe00707f
Expand Down
1 change: 1 addition & 0 deletions include/opcode/riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ enum riscv_insn_class
INSN_CLASS_ZIHINTPAUSE,
INSN_CLASS_ZMMUL,
INSN_CLASS_ZAWRS,
INSN_CLASS_ZACAS,
INSN_CLASS_F_INX,
INSN_CLASS_D_INX,
INSN_CLASS_Q_INX,
Expand Down
8 changes: 8 additions & 0 deletions opcodes/riscv-opc.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,14 @@ const struct riscv_opcode riscv_opcodes[] =
{"wrs.nto", 0, INSN_CLASS_ZAWRS, "", MATCH_WRS_NTO, MASK_WRS_NTO, match_opcode, 0 },
{"wrs.sto", 0, INSN_CLASS_ZAWRS, "", MATCH_WRS_STO, MASK_WRS_STO, match_opcode, 0 },

/* Zacas instructions */
{"amocas.w", 0, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_CAS_W, MASK_CAS_W, match_opcode, 0 },
{"amocas.d", 0, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_CAS_D, MASK_CAS_D, match_opcode, 0 },
{"amocas.q", 64, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_CAS_Q, MASK_CAS_Q, match_opcode, 0 },
{"amocas.w.aqrl", 0, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_AMOADD_W|MASK_AQRL, MASK_AMOADD_W|MASK_AQRL, match_opcode, 0 },
{"amocas.d.aqrl", 0, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_AMOADD_D|MASK_AQRL, MASK_AMOADD_D|MASK_AQRL, match_opcode, 0 },
{"amocas.q.aqrl", 64, INSN_CLASS_ZACAS, "d,t,0(s)", MATCH_AMOADD_Q|MASK_AQRL, MASK_AMOADD_Q|MASK_AQRL, match_opcode, 0 },

/* Zfa instructions. */
{"fli.s", 0, INSN_CLASS_ZFA, "D,Wfv", MATCH_FLI_S, MASK_FLI_S, match_opcode, 0 },
{"fli.d", 0, INSN_CLASS_D_AND_ZFA, "D,Wfv", MATCH_FLI_D, MASK_FLI_D, match_opcode, 0 },
Expand Down

0 comments on commit ebd1d7f

Please sign in to comment.