aarch64: Add FEAT_RLCS HINT aliases

Message ID 20261102132956.53418-1-muhammad.kamran@arm.com
State New
Headers
Series aarch64: Add FEAT_RLCS HINT aliases |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Muhammad Kamran Nov. 2, 2026, 1:29 p.m. UTC
  Add the SLBND and SRLS system instruction aliases from FEAT_RLCS.

SRLS has an optional STSHSTRM operand, so add a dedicated
hint operand kind for the optional syntax and for disassembly.
---
 gas/config/tc-aarch64.c                  |  6 +++++-
 gas/testsuite/gas/aarch64/rlcs-invalid.d |  3 +++
 gas/testsuite/gas/aarch64/rlcs-invalid.l |  3 +++
 gas/testsuite/gas/aarch64/rlcs-invalid.s |  7 +++++++
 gas/testsuite/gas/aarch64/rlcs.d         | 11 +++++++++++
 gas/testsuite/gas/aarch64/rlcs.s         | 11 +++++++++++
 gas/testsuite/gas/aarch64/system.d       |  6 +++---
 include/opcode/aarch64.h                 |  3 +++
 opcodes/aarch64-asm-2.c                  |  3 +++
 opcodes/aarch64-dis-2.c                  |  7 +++++++
 opcodes/aarch64-opc-2.c                  |  1 +
 opcodes/aarch64-opc.c                    | 12 ++++++++++--
 opcodes/aarch64-tbl-2.h                  |  2 ++
 opcodes/aarch64-tbl.h                    |  5 +++++
 14 files changed, 74 insertions(+), 6 deletions(-)
 create mode 100644 gas/testsuite/gas/aarch64/rlcs-invalid.d
 create mode 100644 gas/testsuite/gas/aarch64/rlcs-invalid.l
 create mode 100644 gas/testsuite/gas/aarch64/rlcs-invalid.s
 create mode 100644 gas/testsuite/gas/aarch64/rlcs.d
 create mode 100644 gas/testsuite/gas/aarch64/rlcs.s
  

Patch

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index acd36d26f6b..4e2f70af45b 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -4674,7 +4674,9 @@  parse_hint_opt (const char *name, char **str,
       || ((strcmp ("stshh", name) == 0)
 	  && (o->value != HINT_OPD_KEEP && o->value != HINT_OPD_STRM))
       || ((strcmp ("shuh", name) == 0)
-	  && (o->value != HINT_OPD_PHINT)))
+	  && (o->value != HINT_OPD_PHINT))
+      || ((strcmp ("srls", name) == 0)
+	  && (o->value != HINT_OPD_STSHSTRM)))
       return false;
 
   *str = q;
@@ -6510,6 +6512,7 @@  process_omitted_operand (enum aarch64_opnd type, const aarch64_opcode *opcode,
 
     case AARCH64_OPND_BTI_TARGET:
     case AARCH64_OPND_SHUH_PHINT:
+    case AARCH64_OPND_SRLS_STSHSTRM:
       operand->hint_option = aarch64_hint_options + default_value;
       break;
 
@@ -8422,6 +8425,7 @@  parse_operands (char *str, const aarch64_opcode *opcode)
 
 	case AARCH64_OPND_BTI_TARGET:
 	case AARCH64_OPND_SHUH_PHINT:
+	case AARCH64_OPND_SRLS_STSHSTRM:
 	  if (!parse_hint_opt (opcode->name, &str, &(info->hint_option)))
 	    goto failure;
 	  info->qualifier = AARCH64_OPND_QLF_NIL;
diff --git a/gas/testsuite/gas/aarch64/rlcs-invalid.d b/gas/testsuite/gas/aarch64/rlcs-invalid.d
new file mode 100644
index 00000000000..a82dd4b589c
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/rlcs-invalid.d
@@ -0,0 +1,3 @@ 
+#name: Negative test of RLCS instructions.
+#source: rlcs-invalid.s
+#error_output: rlcs-invalid.l
diff --git a/gas/testsuite/gas/aarch64/rlcs-invalid.l b/gas/testsuite/gas/aarch64/rlcs-invalid.l
new file mode 100644
index 00000000000..50d150feb4d
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/rlcs-invalid.l
@@ -0,0 +1,3 @@ 
+[^ :]+: Assembler messages:
+[^ :]+:[0-9]+: Error: unexpected characters following instruction -- `slbnd s'
+[^ :]+:[0-9]+: Error: operand 1 must be an optional store shared stream \(stshstrm\) -- `srls ph'
diff --git a/gas/testsuite/gas/aarch64/rlcs-invalid.s b/gas/testsuite/gas/aarch64/rlcs-invalid.s
new file mode 100644
index 00000000000..351c0fb3fe4
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/rlcs-invalid.s
@@ -0,0 +1,7 @@ 
+.arch armv9-a
+
+/* Scoped Release Boundary.  */
+	slbnd s
+
+/* Scope Release.  */
+	srls ph
diff --git a/gas/testsuite/gas/aarch64/rlcs.d b/gas/testsuite/gas/aarch64/rlcs.d
new file mode 100644
index 00000000000..639df2ea2a2
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/rlcs.d
@@ -0,0 +1,11 @@ 
+#name: Release Consistency Scoping instructions
+#objdump: -dr
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <.*>:
+.*:	d503271f 	slbnd
+.*:	d50326df 	srls
+.*:	d50326ff 	srls	stshstrm
diff --git a/gas/testsuite/gas/aarch64/rlcs.s b/gas/testsuite/gas/aarch64/rlcs.s
new file mode 100644
index 00000000000..ae140f7996d
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/rlcs.s
@@ -0,0 +1,11 @@ 
+/* Release Consistency Scoping instructions.  */
+.arch armv9-a
+
+/* Scoped Release Boundary.  */
+	slbnd
+
+/* Scope Release.  */
+	srls
+
+/* Scope Release Store Shared Stream.  */
+	srls stshstrm
diff --git a/gas/testsuite/gas/aarch64/system.d b/gas/testsuite/gas/aarch64/system.d
index 01446c15c51..6a248043b2d 100644
--- a/gas/testsuite/gas/aarch64/system.d
+++ b/gas/testsuite/gas/aarch64/system.d
@@ -72,9 +72,9 @@  Disassembly of section \.text:
 .*:	d503267f 	(hint	#0x33|shuh	ph)
 .*:	d503269f 	(hint	#0x34|stcph)
 .*:	d50326bf 	hint	#0x35
-.*:	d50326df 	hint	#0x36
-.*:	d50326ff 	hint	#0x37
-.*:	d503271f 	hint	#0x38
+.*:	d50326df 	(hint	#0x36|srls)
+.*:	d50326ff 	(hint	#0x37|srls	stshstrm)
+.*:	d503271f 	(hint	#0x38|slbnd)
 .*:	d503273f 	hint	#0x39
 .*:	d503275f 	hint	#0x3a
 .*:	d503277f 	hint	#0x3b
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index bfe7489e813..8a9b7847cb4 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -772,6 +772,7 @@  enum aarch64_opnd
   AARCH64_OPND_BTI_TARGET,	/* BTI {<target>}.  */
   AARCH64_OPND_STSHH_POLICY,	/* STSHH {<policy>}.  */
   AARCH64_OPND_SHUH_PHINT,	/* SHUH Priority Hint.  */
+  AARCH64_OPND_SRLS_STSHSTRM,	/* SRLS {STSHSTRM}.  */
   AARCH64_OPND_BRBOP,		/* BRB operation IALL or INJ in bit 5.  */
   AARCH64_OPND_Rt_IN_SYS_ALIASES,	/* Defaulted and omitted Rt used in SYS aliases such as brb.  */
   AARCH64_OPND_LSE128_Rt,	/* LSE128 <Xt1>.  */
@@ -1905,6 +1906,8 @@  struct aarch64_inst
 #define HINT_OPD_STRM	0x31
 #define HINT_OPD_NPHINT	0x32
 #define HINT_OPD_PHINT	0x33
+#define HINT_OPD_NSTSHSTRM	0x36
+#define HINT_OPD_STSHSTRM	0x37
 #define HINT_OPD_NULL	0x00
 
 
diff --git a/opcodes/aarch64-asm-2.c b/opcodes/aarch64-asm-2.c
index f50b5fe28f5..7b78bc62642 100644
--- a/opcodes/aarch64-asm-2.c
+++ b/opcodes/aarch64-asm-2.c
@@ -544,6 +544,8 @@  aarch64_find_real_opcode (const aarch64_opcode *opcode)
     case A64_OPID_d503241f_bti_BTI_TARGET:
     case A64_OPID_d503229f_csdb:
     case A64_OPID_d503201f_nop:
+    case A64_OPID_d50326df_srls_SRLS_STSHSTRM:
+    case A64_OPID_d503271f_slbnd:
     case A64_OPID_d503265f_shuh_SHUH_PHINT:
     case A64_OPID_d503269f_stcph:
     case A64_OPID_d503261f_stshh_STSHH_POLICY:
@@ -1039,6 +1041,7 @@  aarch64_insert_operand (const aarch64_operand *self,
     case AARCH64_OPND_BTI_TARGET:
     case AARCH64_OPND_STSHH_POLICY:
     case AARCH64_OPND_SHUH_PHINT:
+    case AARCH64_OPND_SRLS_STSHSTRM:
       return aarch64_ins_hint (self, info, code, inst, errors);
     case AARCH64_OPND_SVE_ADDR_RI_S4x16:
     case AARCH64_OPND_SVE_ADDR_RI_S4x32:
diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c
index 776c4ac2656..0a112f9044b 100644
--- a/opcodes/aarch64-dis-2.c
+++ b/opcodes/aarch64-dis-2.c
@@ -37687,6 +37687,12 @@  aarch64_find_next_alias_opcode (const aarch64_opcode *opcode)
       value = A64_OPID_d503201f_nop;
       break;
     case A64_OPID_d503201f_nop:
+      value = A64_OPID_d50326df_srls_SRLS_STSHSTRM;
+      break;
+    case A64_OPID_d50326df_srls_SRLS_STSHSTRM:
+      value = A64_OPID_d503271f_slbnd;
+      break;
+    case A64_OPID_d503271f_slbnd:
       value = A64_OPID_d503265f_shuh_SHUH_PHINT;
       break;
     case A64_OPID_d503265f_shuh_SHUH_PHINT:
@@ -38177,6 +38183,7 @@  aarch64_extract_operand (const aarch64_operand *self,
     case AARCH64_OPND_BTI_TARGET:
     case AARCH64_OPND_STSHH_POLICY:
     case AARCH64_OPND_SHUH_PHINT:
+    case AARCH64_OPND_SRLS_STSHSTRM:
       return aarch64_ext_hint (self, info, code, inst, errors);
     case AARCH64_OPND_SVE_ADDR_RI_S4x16:
     case AARCH64_OPND_SVE_ADDR_RI_S4x32:
diff --git a/opcodes/aarch64-opc-2.c b/opcodes/aarch64-opc-2.c
index dfd0ca33425..0630cde30bf 100644
--- a/opcodes/aarch64-opc-2.c
+++ b/opcodes/aarch64-opc-2.c
@@ -156,6 +156,7 @@  const struct aarch64_operand aarch64_operands[] =
   {AARCH64_OPND_CLASS_SYSTEM, "BTI_TARGET", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "BTI targets r/j/c/jc"},
   {AARCH64_OPND_CLASS_SYSTEM, "STSHH_POLICY", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an STSHH policy (keep/strm)"},
   {AARCH64_OPND_CLASS_SYSTEM, "SHUH_PHINT", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an optional priority hint (ph)"},
+  {AARCH64_OPND_CLASS_SYSTEM, "SRLS_STSHSTRM", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {}, "an optional store shared stream (stshstrm)"},
   {AARCH64_OPND_CLASS_SYSTEM, "BRBOP", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {{1, 5, false}}, "Branch Record Buffer operation operand"},
   {AARCH64_OPND_CLASS_INT_REG, "Rt_IN_SYS_ALIASES", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {{5, 0, false}}, "Rt register with defaults for SYS aliases"},
   {AARCH64_OPND_CLASS_INT_REG, "LSE128_Rt", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {{5, 0, false}}, "an integer register"},
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index 732ba336e72..a539883ed88 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -369,10 +369,11 @@  const struct aarch64_name_value_pair aarch64_barrier_dsb_nxs_options[4] =
 const struct aarch64_name_value_pair aarch64_hint_options[] =
 {
   /* BTI.  This is also the F_DEFAULT entry for AARCH64_OPND_BTI_TARGET.
-     BTI R and SHUH must be the first and second entries respectively
-     so that F_DEFAULT refers to the correct table entries.  */
+     BTI R, SHUH and SRLS must be the first, second and third entries
+     respectively so that F_DEFAULT refers to the correct table entries.  */
   { "r",	HINT_OPD_R },		/* BTI R.  */
   { "",		HINT_OPD_NPHINT},	/* SHUH. */
+  { "",		HINT_OPD_NSTSHSTRM},	/* SRLS. */
   { "csync",	HINT_OPD_CSYNC },	/* PSB CSYNC.  */
   { "dsync",	HINT_OPD_DSYNC },	/* GCSB DSYNC.  */
   { "c",	HINT_OPD_C },		/* BTI C.  */
@@ -381,6 +382,7 @@  const struct aarch64_name_value_pair aarch64_hint_options[] =
   { "keep",	HINT_OPD_KEEP },	/* STSHH KEEP  */
   { "strm",	HINT_OPD_STRM },	/* STSHH STRM  */
   { "ph",	HINT_OPD_PHINT },	/* SHUH PH.  */
+  { "stshstrm",	HINT_OPD_STSHSTRM },	/* SRLS STSHSTRM.  */
   { NULL,	HINT_OPD_NULL },
 };
 
@@ -4879,6 +4881,12 @@  aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
 		  style_sub_mnem (styler, opnd->hint_option->name));
       break;
 
+    case AARCH64_OPND_SRLS_STSHSTRM:
+      if (*(opnd->hint_option->name))
+	snprintf (buf, size, "%s",
+		  style_sub_mnem (styler, opnd->hint_option->name));
+      break;
+
     case AARCH64_OPND_MOPS_ADDR_Rd:
     case AARCH64_OPND_MOPS_ADDR_Rs:
       snprintf (buf, size, "[%s]!",
diff --git a/opcodes/aarch64-tbl-2.h b/opcodes/aarch64-tbl-2.h
index cff4ad80f90..8e6bd57b5f7 100644
--- a/opcodes/aarch64-tbl-2.h
+++ b/opcodes/aarch64-tbl-2.h
@@ -1386,6 +1386,8 @@  enum aarch64_opcode_idx
   A64_OPID_d503261f_stshh_STSHH_POLICY,
   A64_OPID_d503269f_stcph,
   A64_OPID_d503265f_shuh_SHUH_PHINT,
+  A64_OPID_d503271f_slbnd,
+  A64_OPID_d50326df_srls_SRLS_STSHSTRM,
   A64_OPID_d500401f_msr_PSTATEFIELD_UIMM4,
   A64_OPID_d503201f_hint_UIMM7,
   A64_OPID_d503201f_nop,
diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h
index 2d63d6a423a..54ac96f4a14 100644
--- a/opcodes/aarch64-tbl.h
+++ b/opcodes/aarch64-tbl.h
@@ -5184,6 +5184,9 @@  const struct aarch64_opcode aarch64_opcode_table[] =
   CORE_INSN ("stshh", 0xd503261f, 0xffffffdf, ic_system, 0, OP1 (STSHH_POLICY), QL_NIL1, F_ALIAS),
   CORE_INSN ("stcph", 0xd503269f, 0xffffffff, ic_system, 0, OP0 (), QL_0, F_ALIAS),
   CORE_INSN ("shuh", 0xd503265f, 0xffffffdf, ic_system, 0, OP1 (SHUH_PHINT), QL_NIL1, F_ALIAS | F_OPD0_OPT | F_DEFAULT (0x1)),
+  /* RLCS aliases in the HINT encoding space.  */
+  CORE_INSN ("slbnd", 0xd503271f, 0xffffffff, ic_system, 0, OP0 (), QL_0, F_ALIAS),
+  CORE_INSN ("srls", 0xd50326df, 0xffffffdf, ic_system, 0, OP1 (SRLS_STSHSTRM), QL_NIL1, F_ALIAS | F_OPD0_OPT | F_DEFAULT (0x2)),
   CORE_INSN ("msr", 0xd500401f, 0xfff8f01f, ic_system, 0, OP2 (PSTATEFIELD, UIMM4), QL_NIL2, F_SYS_WRITE),
   CORE_INSN ("hint",0xd503201f, 0xfffff01f, ic_system, 0, OP1 (UIMM7), QL_NIL1, F_HAS_ALIAS),
   CORE_INSN ("nop", 0xd503201f, 0xffffffff, ic_system, 0, OP0 (), QL_0, F_ALIAS),
@@ -8252,6 +8255,8 @@  const struct aarch64_opcode aarch64_opcode_table[] =
       "an STSHH policy (keep/strm)")					\
     Y(SYSTEM, hint, "SHUH_PHINT", 0, F(),				\
       "an optional priority hint (ph)")						\
+    Y(SYSTEM, hint, "SRLS_STSHSTRM", 0, F(),				\
+      "an optional store shared stream (stshstrm)")			\
     Y(SYSTEM, imm, "BRBOP", 0, F(FLD(5, 1)),				\
       "Branch Record Buffer operation operand")				\
     Y(INT_REG, regno, "Rt_IN_SYS_ALIASES", 0, F(FLD(0, 5)),		\