[PATCH 19/23] aarch64: Return QLF_ERR for error conditions

Alice Carlotti alice.carlotti@arm.com
Thu May 7 16:14:21 GMT 2026


In vectype_to_qualifier and get_qualifier_from_partial_encoding, return
AARCH64_OPND_QLF_ERR instead of AARCH64_OPND_QLF_NIL to indicate an
error condition.


diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index b851868d3ff441c5fe3a13bafaa25fb433a03d5f..abc351f60b3f4cd2d6b9bb40205eb303f5bb6179 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -879,7 +879,7 @@ vectype_to_qualifier (const struct vector_type_el *vectype)
 
  vectype_conversion_fail:
   first_error (_("bad vector arrangement type"));
-  return AARCH64_OPND_QLF_NIL;
+  return AARCH64_OPND_QLF_ERR;
 }
 
 /* Register parsing.  */
@@ -4703,7 +4703,7 @@ parse_reg_with_qual (char **str, aarch64_reg_type reg_type,
   else
     {
       *qualifier = vectype_to_qualifier (&vectype);
-      if (*qualifier == AARCH64_OPND_QLF_NIL)
+      if (*qualifier == AARCH64_OPND_QLF_ERR)
 	return NULL;
     }
 
@@ -6974,7 +6974,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
 	  else
 	    {
 	      info->qualifier = vectype_to_qualifier (&vectype);
-	      if (info->qualifier == AARCH64_OPND_QLF_NIL)
+	      if (info->qualifier == AARCH64_OPND_QLF_ERR)
 		goto failure;
 	    }
 	  break;
@@ -7067,7 +7067,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
 	      if (vectype.type == NT_invtype)
 		goto failure;
 	      info->qualifier = vectype_to_qualifier (&vectype);
-	      if (info->qualifier == AARCH64_OPND_QLF_NIL)
+	      if (info->qualifier == AARCH64_OPND_QLF_ERR)
 		goto failure;
 	    }
 
@@ -7197,7 +7197,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
 		}
 	    }
 	  info->qualifier = vectype_to_qualifier (&vectype);
-	  if (info->qualifier == AARCH64_OPND_QLF_NIL)
+	  if (info->qualifier == AARCH64_OPND_QLF_ERR)
 	    goto failure;
 	  break;
 
@@ -8354,7 +8354,11 @@ parse_operands (char *str, const aarch64_opcode *opcode)
 	  if (vectype.type == NT_invtype)
 	    info->qualifier = AARCH64_OPND_QLF_NIL;
 	  else
-	    info->qualifier = vectype_to_qualifier (&vectype);
+	    {
+	      info->qualifier = vectype_to_qualifier (&vectype);
+	      if (info->qualifier == AARCH64_OPND_QLF_ERR)
+		goto failure;
+	    }
 	  break;
 
 	case AARCH64_OPND_BARRIER_GCSB:
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index c5d1293f77475e0697df3cd534442ec415d3310f..e55efbcf3cb0a9ccdc68ec0518cb1f50cc8fa3b9 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -2499,7 +2499,7 @@ aarch64_ext_plain_shrimm (const aarch64_operand *self, aarch64_opnd_info *info,
    constrained field(s).  Given the VALUE of such a field or fields, the
    qualifiers CANDIDATES and the MASK (indicating which bits are valid for
    operand encoding), the function returns the matching qualifier or
-   AARCH64_OPND_QLF_NIL if nothing matches.
+   AARCH64_OPND_QLF_ERR if nothing matches.
 
    N.B. CANDIDATES is a group of possible qualifiers that are valid for
    one operand; it has a maximum of AARCH64_MAX_QLF_SEQ_NUM qualifiers and
@@ -2522,7 +2522,7 @@ get_qualifier_from_partial_encoding (aarch64_insn value,
       if ((standard_value & mask) == (value & mask))
 	return candidates[i];
     }
-  return AARCH64_OPND_QLF_NIL;
+  return AARCH64_OPND_QLF_ERR;
 }
 
 /* Given a list of qualifier sequences, return all possible valid qualifiers
@@ -2549,7 +2549,6 @@ static int
 decode_sizeq (aarch64_inst *inst)
 {
   int idx;
-  enum aarch64_opnd_qualifier qualifier;
   aarch64_insn code;
   aarch64_insn value, mask;
   enum aarch64_field_kind fld_sz;
@@ -2600,9 +2599,10 @@ decode_sizeq (aarch64_inst *inst)
     }
 #endif /* DEBUG_AARCH64 */
 
-  qualifier = get_qualifier_from_partial_encoding (value, candidates, mask);
+  enum aarch64_opnd_qualifier qualifier
+    = get_qualifier_from_partial_encoding (value, candidates, mask);
 
-  if (qualifier == AARCH64_OPND_QLF_NIL)
+  if (qualifier == AARCH64_OPND_QLF_ERR)
     return 0;
 
   inst->operands[idx].qualifier = qualifier;


More information about the Binutils mailing list