74659d
diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.27/gas/config/tc-arm.c
74659d
--- binutils.orig/gas/config/tc-arm.c	2017-08-09 10:26:30.032741952 +0100
74659d
+++ binutils-2.27/gas/config/tc-arm.c	2017-08-09 11:17:17.747598541 +0100
74659d
@@ -147,8 +147,10 @@ static const arm_feature_set *legacy_cpu
74659d
 static const arm_feature_set *legacy_fpu = NULL;
74659d
 
74659d
 static const arm_feature_set *mcpu_cpu_opt = NULL;
74659d
+static arm_feature_set *dyn_mcpu_ext_opt = NULL;
74659d
 static const arm_feature_set *mcpu_fpu_opt = NULL;
74659d
 static const arm_feature_set *march_cpu_opt = NULL;
74659d
+static arm_feature_set *dyn_march_ext_opt = NULL;
74659d
 static const arm_feature_set *march_fpu_opt = NULL;
74659d
 static const arm_feature_set *mfpu_opt = NULL;
74659d
 static const arm_feature_set *object_arch = NULL;
74659d
@@ -187,7 +189,6 @@ static const arm_feature_set arm_ext_v5j
74659d
 static const arm_feature_set arm_ext_v6 = ARM_FEATURE_CORE_LOW (ARM_EXT_V6);
74659d
 static const arm_feature_set arm_ext_v6k = ARM_FEATURE_CORE_LOW (ARM_EXT_V6K);
74659d
 static const arm_feature_set arm_ext_v6t2 = ARM_FEATURE_CORE_LOW (ARM_EXT_V6T2);
74659d
-static const arm_feature_set arm_ext_v6m = ARM_FEATURE_CORE_LOW (ARM_EXT_V6M);
74659d
 static const arm_feature_set arm_ext_v6_notm =
74659d
   ARM_FEATURE_CORE_LOW (ARM_EXT_V6_NOTM);
74659d
 static const arm_feature_set arm_ext_v6_dsp =
74659d
@@ -201,11 +202,11 @@ static const arm_feature_set arm_ext_v7
74659d
 static const arm_feature_set arm_ext_v7a = ARM_FEATURE_CORE_LOW (ARM_EXT_V7A);
74659d
 static const arm_feature_set arm_ext_v7r = ARM_FEATURE_CORE_LOW (ARM_EXT_V7R);
74659d
 #ifdef OBJ_ELF
74659d
-static const arm_feature_set arm_ext_v7m = ARM_FEATURE_CORE_LOW (ARM_EXT_V7M);
74659d
+static const arm_feature_set ATTRIBUTE_UNUSED arm_ext_v7m = ARM_FEATURE_CORE_LOW (ARM_EXT_V7M);
74659d
 #endif
74659d
 static const arm_feature_set arm_ext_v8 = ARM_FEATURE_CORE_LOW (ARM_EXT_V8);
74659d
 static const arm_feature_set arm_ext_m =
74659d
-  ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_OS | ARM_EXT_V7M,
74659d
+  ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_V7M,
74659d
 		    ARM_EXT2_V8M | ARM_EXT2_V8M_MAIN);
74659d
 static const arm_feature_set arm_ext_mp = ARM_FEATURE_CORE_LOW (ARM_EXT_MP);
74659d
 static const arm_feature_set arm_ext_sec = ARM_FEATURE_CORE_LOW (ARM_EXT_SEC);
74659d
@@ -234,14 +235,16 @@ static const arm_feature_set arm_ext_ras
74659d
 /* FP16 instructions.  */
74659d
 static const arm_feature_set arm_ext_fp16 =
74659d
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST);
74659d
+static const arm_feature_set arm_ext_v8_3 =
74659d
+  ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A);
74659d
 
74659d
 static const arm_feature_set arm_arch_any = ARM_ANY;
74659d
+#ifdef OBJ_ELF
74659d
+static const arm_feature_set fpu_any = FPU_ANY;
74659d
+#endif
74659d
 static const arm_feature_set arm_arch_full ATTRIBUTE_UNUSED = ARM_FEATURE (-1, -1, -1);
74659d
 static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2;
74659d
 static const arm_feature_set arm_arch_none = ARM_ARCH_NONE;
74659d
-#ifdef OBJ_ELF
74659d
-static const arm_feature_set arm_arch_v6m_only = ARM_ARCH_V6M_ONLY;
74659d
-#endif
74659d
 
74659d
 static const arm_feature_set arm_cext_iwmmxt2 =
74659d
   ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT2);
74659d
@@ -291,6 +294,8 @@ static const arm_feature_set crc_ext_arm
74659d
   ARM_FEATURE_COPROC (CRC_EXT_ARMV8);
74659d
 static const arm_feature_set fpu_neon_ext_v8_1 =
74659d
   ARM_FEATURE_COPROC (FPU_NEON_EXT_RDMA);
74659d
+static const arm_feature_set fpu_neon_ext_dotprod =
74659d
+  ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD);
74659d
 
74659d
 static int mfloat_abi_opt = -1;
74659d
 /* Record user cpu selection for object attributes.  */
74659d
@@ -685,9 +690,11 @@ struct asm_opcode
74659d
 #define T2_SUBS_PC_LR	0xf3de8f00
74659d
 
74659d
 #define DATA_OP_SHIFT	21
74659d
+#define SBIT_SHIFT	20
74659d
 
74659d
 #define T2_OPCODE_MASK	0xfe1fffff
74659d
 #define T2_DATA_OP_SHIFT 21
74659d
+#define T2_SBIT_SHIFT	 20
74659d
 
74659d
 #define A_COND_MASK         0xf0000000
74659d
 #define A_PUSH_POP_OP_MASK  0x0fff0000
74659d
@@ -1276,6 +1283,7 @@ arm_reg_alt_syntax (char **ccp, char *st
74659d
 	if (*ccp != start && processor <= 15)
74659d
 	  return processor;
74659d
       }
74659d
+      /* Fall through.  */
74659d
 
74659d
     case REG_TYPE_MMXWC:
74659d
       /* WC includes WCG.  ??? I'm not sure this is true for all
74659d
@@ -2705,7 +2713,7 @@ mapping_state (enum mstate state)
74659d
 
74659d
 	Some Thumb instructions are alignment-sensitive modulo 4 bytes,
74659d
 	but themselves require 2-byte alignment; this applies to some
74659d
-	PC- relative forms.  However, these cases will invovle implicit
74659d
+	PC- relative forms.  However, these cases will involve implicit
74659d
 	literal pool generation or an explicit .align >=2, both of
74659d
 	which will cause the section to me marked with sufficient
74659d
 	alignment.  Thus, we don't handle those cases here.  */
74659d
@@ -3042,7 +3050,7 @@ s_ccs_ref (int unused ATTRIBUTE_UNUSED)
74659d
 }
74659d
 
74659d
 /*  If name is not NULL, then it is used for marking the beginning of a
74659d
-    function, wherease if it is NULL then it means the function end.  */
74659d
+    function, whereas if it is NULL then it means the function end.  */
74659d
 static void
74659d
 asmfunc_debug (const char * name)
74659d
 {
74659d
@@ -3375,7 +3383,7 @@ tc_start_label_without_colon (void)
74659d
 }
74659d
 
74659d
 /* Can't use symbol_new here, so have to create a symbol and then at
74659d
-   a later date assign it a value. Thats what these functions do.  */
74659d
+   a later date assign it a value. That's what these functions do.  */
74659d
 
74659d
 static void
74659d
 symbol_locate (symbolS *    symbolP,
74659d
@@ -4964,9 +4972,13 @@ parse_ifimm_zero (char **in)
74659d
   int error_code;
74659d
 
74659d
   if (!is_immediate_prefix (**in))
74659d
-    return FALSE;
74659d
-
74659d
-  ++*in;
74659d
+    {
74659d
+      /* In unified syntax, all prefixes are optional.  */
74659d
+      if (!unified_syntax)
74659d
+	return FALSE;
74659d
+    }
74659d
+  else
74659d
+    ++*in;
74659d
 
74659d
   /* Accept #0x0 as a synonym for #0.  */
74659d
   if (strncmp (*in, "0x", 2) == 0)
74659d
@@ -6530,6 +6542,8 @@ enum operand_parse_code
74659d
   OP_EXPi,	/* same, with optional immediate prefix */
74659d
   OP_EXPr,	/* same, with optional relocation suffix */
74659d
   OP_HALF,	/* 0 .. 65535 or low/high reloc.  */
74659d
+  OP_IROT1,	/* VCADD rotate immediate: 90, 270.  */
74659d
+  OP_IROT2,	/* VCMLA rotate immediate: 0, 90, 180, 270.  */
74659d
 
74659d
   OP_CPSF,	/* CPS flags */
74659d
   OP_ENDI,	/* Endianness specifier */
74659d
@@ -6541,7 +6555,7 @@ enum operand_parse_code
74659d
   OP_APSR_RR,   /* ARM register or "APSR_nzcv".  */
74659d
 
74659d
   OP_RRnpc_I0,	/* ARM register or literal 0 */
74659d
-  OP_RR_EXr,	/* ARM register or expression with opt. reloc suff. */
74659d
+  OP_RR_EXr,	/* ARM register or expression with opt. reloc stuff. */
74659d
   OP_RR_EXi,	/* ARM register or expression with imm prefix */
74659d
   OP_RF_IF,	/* FPA register or immediate */
74659d
   OP_RIWR_RIWC, /* iWMMXt R or C reg */
74659d
@@ -7178,8 +7192,14 @@ parse_operands (char *str, const unsigne
74659d
 	    {
74659d
 	      if (inst.operands[i].reg == REG_PC)
74659d
 		inst.error = BAD_PC;
74659d
-	      else if (inst.operands[i].reg == REG_SP)
74659d
-		inst.error = BAD_SP;
74659d
+	      else if (inst.operands[i].reg == REG_SP
74659d
+		       /* The restriction on Rd/Rt/Rt2 on Thumb mode has been
74659d
+			  relaxed since ARMv8-A.  */
74659d
+		       && !ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
+		{
74659d
+		  gas_assert (thumb);
74659d
+		  inst.error = BAD_SP;
74659d
+		}
74659d
 	    }
74659d
 	  break;
74659d
 
74659d
@@ -7277,14 +7297,23 @@ parse_operands (char *str, const unsigne
74659d
 
74659d
 /* Reject "bad registers" for Thumb-2 instructions.  Many Thumb-2
74659d
    instructions are unpredictable if these registers are used.  This
74659d
-   is the BadReg predicate in ARM's Thumb-2 documentation.  */
74659d
-#define reject_bad_reg(reg)				\
74659d
-  do							\
74659d
-   if (reg == REG_SP || reg == REG_PC)			\
74659d
-     {							\
74659d
-       inst.error = (reg == REG_SP) ? BAD_SP : BAD_PC;	\
74659d
-       return;						\
74659d
-     }							\
74659d
+   is the BadReg predicate in ARM's Thumb-2 documentation.
74659d
+
74659d
+   Before ARMv8-A, REG_PC and REG_SP were not allowed in quite a few
74659d
+   places, while the restriction on REG_SP was relaxed since ARMv8-A.  */
74659d
+#define reject_bad_reg(reg)					\
74659d
+  do								\
74659d
+   if (reg == REG_PC)						\
74659d
+     {								\
74659d
+       inst.error = BAD_PC;					\
74659d
+       return;							\
74659d
+     }								\
74659d
+   else if (reg == REG_SP					\
74659d
+	    && !ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))	\
74659d
+     {								\
74659d
+       inst.error = BAD_SP;					\
74659d
+       return;							\
74659d
+     }								\
74659d
   while (0)
74659d
 
74659d
 /* If REG is R13 (the stack pointer), warn that its use is
74659d
@@ -7303,7 +7332,7 @@ parse_operands (char *str, const unsigne
74659d
 
74659d
    The only binary encoding difference is the Coprocessor number.  Coprocessor
74659d
    9 is used for half-precision calculations or conversions.  The format of the
74659d
-   instruction is the same as the equivalent Coprocessor 10 instuction that
74659d
+   instruction is the same as the equivalent Coprocessor 10 instruction that
74659d
    exists for Single-Precision operation.  */
74659d
 
74659d
 static void
74659d
@@ -7426,6 +7455,24 @@ encode_arm_vfp_reg (int reg, enum vfp_re
74659d
 static void
74659d
 encode_arm_shift (int i)
74659d
 {
74659d
+  /* Register-shifted register.  */
74659d
+  if (inst.operands[i].immisreg)
74659d
+    {
74659d
+      int op_index;
74659d
+      for (op_index = 0; op_index <= i; ++op_index)
74659d
+	{
74659d
+	  /* Check the operand only when it's presented.  In pre-UAL syntax,
74659d
+	     if the destination register is the same as the first operand, two
74659d
+	     register form of the instruction can be used.  */
74659d
+	  if (inst.operands[op_index].present && inst.operands[op_index].isreg
74659d
+	      && inst.operands[op_index].reg == REG_PC)
74659d
+	    as_warn (UNPRED_REG ("r15"));
74659d
+	}
74659d
+
74659d
+      if (inst.operands[i].imm == REG_PC)
74659d
+	as_warn (UNPRED_REG ("r15"));
74659d
+    }
74659d
+
74659d
   if (inst.operands[i].shift_kind == SHIFT_RRX)
74659d
     inst.instruction |= SHIFT_ROR << 5;
74659d
   else
74659d
@@ -7930,17 +7977,13 @@ move_or_literal_pool (int i, enum lit_ty
74659d
 	{
74659d
 	  if (thumb_p)
74659d
 	    {
74659d
-	      /* This can be encoded only for a low register.  */
74659d
-	      if ((v & ~0xFF) == 0 && (inst.operands[i].reg < 8))
74659d
-		{
74659d
-		  /* This can be done with a mov(1) instruction.  */
74659d
-		  inst.instruction = T_OPCODE_MOV_I8 | (inst.operands[i].reg << 8);
74659d
-		  inst.instruction |= v;
74659d
-		  return TRUE;
74659d
-		}
74659d
+	      /* LDR should not use lead in a flag-setting instruction being
74659d
+		 chosen so we do not check whether movs can be used.  */
74659d
 
74659d
-	      if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2)
74659d
+	      if ((ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2)
74659d
 		  || ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2_v8m))
74659d
+		  && inst.operands[i].reg != 13
74659d
+		  && inst.operands[i].reg != 15)
74659d
 		{
74659d
 		  /* Check if on thumb2 it can be done with a mov.w, mvn or
74659d
 		     movw instruction.  */
74659d
@@ -8326,6 +8369,12 @@ do_adr (void)
74659d
   inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE;
74659d
   inst.reloc.pc_rel = 1;
74659d
   inst.reloc.exp.X_add_number -= 8;
74659d
+
74659d
+  if (inst.reloc.exp.X_op == O_symbol
74659d
+      && inst.reloc.exp.X_add_symbol != NULL
74659d
+      && S_IS_DEFINED (inst.reloc.exp.X_add_symbol)
74659d
+      && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol))
74659d
+    inst.reloc.exp.X_add_number += 1;  
74659d
 }
74659d
 
74659d
 /* This is a pseudo-op of the form "adrl rd, label" to be converted
74659d
@@ -8344,6 +8393,12 @@ do_adrl (void)
74659d
   inst.reloc.pc_rel	       = 1;
74659d
   inst.size		       = INSN_SIZE * 2;
74659d
   inst.reloc.exp.X_add_number -= 8;
74659d
+
74659d
+  if (inst.reloc.exp.X_op == O_symbol
74659d
+      && inst.reloc.exp.X_add_symbol != NULL
74659d
+      && S_IS_DEFINED (inst.reloc.exp.X_add_symbol)
74659d
+      && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol))
74659d
+    inst.reloc.exp.X_add_number += 1;  
74659d
 }
74659d
 
74659d
 static void
74659d
@@ -8622,7 +8677,7 @@ do_co_reg (void)
74659d
 	  || inst.instruction == 0xfe000010)
74659d
 	/* MCR, MCR2  */
74659d
 	reject_bad_reg (Rd);
74659d
-      else
74659d
+      else if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
 	/* MRC, MRC2  */
74659d
 	constraint (Rd == REG_SP, BAD_SP);
74659d
     }
74659d
@@ -8691,6 +8746,14 @@ do_co_reg2c (void)
74659d
       constraint (Rn == REG_PC, BAD_PC);
74659d
     }
74659d
 
74659d
+  /* Only check the MRRC{2} variants.  */
74659d
+  if ((inst.instruction & 0x0FF00000) == 0x0C500000)
74659d
+    {
74659d
+       /* If Rd == Rn, error that the operation is
74659d
+	  unpredictable (example MRRC p3,#1,r1,r1,c4).  */
74659d
+       constraint (Rd == Rn, BAD_OVERLAP);
74659d
+    }
74659d
+
74659d
   inst.instruction |= inst.operands[0].reg << 8;
74659d
   inst.instruction |= inst.operands[1].imm << 4;
74659d
   inst.instruction |= Rd << 12;
74659d
@@ -8916,7 +8979,7 @@ check_ldr_r15_aligned (void)
74659d
 	      && (inst.operands[0].reg == REG_PC
74659d
 	      && inst.operands[1].reg == REG_PC
74659d
 	      && (inst.reloc.exp.X_add_number & 0x3)),
74659d
-	      _("ldr to register 15 must be 4-byte alligned"));
74659d
+	      _("ldr to register 15 must be 4-byte aligned"));
74659d
 }
74659d
 
74659d
 static void
74659d
@@ -9025,9 +9088,9 @@ do_mov16 (void)
74659d
 
74659d
   top = (inst.instruction & 0x00400000) != 0;
74659d
   constraint (top && inst.reloc.type == BFD_RELOC_ARM_MOVW,
74659d
-	      _(":lower16: not allowed this instruction"));
74659d
+	      _(":lower16: not allowed in this instruction"));
74659d
   constraint (!top && inst.reloc.type == BFD_RELOC_ARM_MOVT,
74659d
-	      _(":upper16: not allowed instruction"));
74659d
+	      _(":upper16: not allowed in this instruction"));
74659d
   inst.instruction |= inst.operands[0].reg << 12;
74659d
   if (inst.reloc.type == BFD_RELOC_UNUSED)
74659d
     {
74659d
@@ -9079,6 +9142,11 @@ do_vmrs (void)
74659d
       return;
74659d
     }
74659d
 
74659d
+  /* MVFR2 is only valid at ARMv8-A.  */
74659d
+  if (inst.operands[1].reg == 5)
74659d
+    constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_armv8),
74659d
+		_(BAD_FPU));
74659d
+
74659d
   /* APSR_ sets isvec. All other refs to PC are illegal.  */
74659d
   if (!inst.operands[0].isvec && Rt == REG_PC)
74659d
     {
74659d
@@ -9105,6 +9173,11 @@ do_vmsr (void)
74659d
       return;
74659d
     }
74659d
 
74659d
+  /* MVFR2 is only valid for ARMv8-A.  */
74659d
+  if (inst.operands[0].reg == 5)
74659d
+    constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_armv8),
74659d
+		_(BAD_FPU));
74659d
+
74659d
   /* If we get through parsing the register name, we just insert the number
74659d
      generated into the instruction without further validation.  */
74659d
   inst.instruction |= (inst.operands[0].reg << 16);
74659d
@@ -10453,7 +10526,7 @@ do_t_add_sub_w (void)
74659d
 }
74659d
 
74659d
 /* Parse an add or subtract instruction.  We get here with inst.instruction
74659d
-   equalling any of THUMB_OPCODE_add, adds, sub, or subs.  */
74659d
+   equaling any of THUMB_OPCODE_add, adds, sub, or subs.  */
74659d
 
74659d
 static void
74659d
 do_t_add_sub (void)
74659d
@@ -10484,7 +10557,8 @@ do_t_add_sub (void)
74659d
 	{
74659d
 	  int add;
74659d
 
74659d
-	  constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
74659d
+	  if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
+	    constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
74659d
 
74659d
 	  add = (inst.instruction == T_MNEM_add
74659d
 		 || inst.instruction == T_MNEM_adds);
74659d
@@ -10608,7 +10682,8 @@ do_t_add_sub (void)
74659d
 	    }
74659d
 
74659d
 	  constraint (Rd == REG_PC, BAD_PC);
74659d
-	  constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
74659d
+	  if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
+	    constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
74659d
 	  constraint (Rs == REG_PC, BAD_PC);
74659d
 	  reject_bad_reg (Rn);
74659d
 
74659d
@@ -10701,9 +10776,14 @@ do_t_adr (void)
74659d
       inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD;
74659d
       inst.reloc.exp.X_add_number -= 4; /* PC relative adjust.  */
74659d
       inst.reloc.pc_rel = 1;
74659d
-
74659d
       inst.instruction |= Rd << 4;
74659d
     }
74659d
+
74659d
+  if (inst.reloc.exp.X_op == O_symbol
74659d
+      && inst.reloc.exp.X_add_symbol != NULL
74659d
+      && S_IS_DEFINED (inst.reloc.exp.X_add_symbol)
74659d
+      && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol))
74659d
+    inst.reloc.exp.X_add_number += 1;
74659d
 }
74659d
 
74659d
 /* Arithmetic instructions for which there is just one 16-bit
74659d
@@ -11856,7 +11936,8 @@ do_t_mov_cmp (void)
74659d
 		  /* This is mov.w.  */
74659d
 		  constraint (Rn == REG_PC, BAD_PC);
74659d
 		  constraint (Rm == REG_PC, BAD_PC);
74659d
-		  constraint (Rn == REG_SP && Rm == REG_SP, BAD_SP);
74659d
+		  if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
+		    constraint (Rn == REG_SP && Rm == REG_SP, BAD_SP);
74659d
 		}
74659d
 	    }
74659d
 	  else
74659d
@@ -12082,12 +12163,12 @@ do_t_mov16 (void)
74659d
   top = (inst.instruction & 0x00800000) != 0;
74659d
   if (inst.reloc.type == BFD_RELOC_ARM_MOVW)
74659d
     {
74659d
-      constraint (top, _(":lower16: not allowed this instruction"));
74659d
+      constraint (top, _(":lower16: not allowed in this instruction"));
74659d
       inst.reloc.type = BFD_RELOC_ARM_THUMB_MOVW;
74659d
     }
74659d
   else if (inst.reloc.type == BFD_RELOC_ARM_MOVT)
74659d
     {
74659d
-      constraint (!top, _(":upper16: not allowed this instruction"));
74659d
+      constraint (!top, _(":upper16: not allowed in this instruction"));
74659d
       inst.reloc.type = BFD_RELOC_ARM_THUMB_MOVT;
74659d
     }
74659d
 
74659d
@@ -13049,17 +13130,6 @@ do_t_sxth (void)
74659d
 static void
74659d
 do_t_swi (void)
74659d
 {
74659d
-  /* We have to do the following check manually as ARM_EXT_OS only applies
74659d
-     to ARM_EXT_V6M.  */
74659d
-  if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6m))
74659d
-    {
74659d
-      if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_os)
74659d
-	  /* This only applies to the v6m howver, not later architectures.  */
74659d
-	  && ! ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v7))
74659d
-	as_bad (_("SVC is not permitted on this architecture"));
74659d
-      ARM_MERGE_FEATURE_SETS (thumb_arch_used, thumb_arch_used, arm_ext_os);
74659d
-    }
74659d
-
74659d
   inst.reloc.type = BFD_RELOC_ARM_SWI;
74659d
 }
74659d
 
74659d
@@ -13077,7 +13147,8 @@ do_t_tb (void)
74659d
   Rn = inst.operands[0].reg;
74659d
   Rm = inst.operands[0].imm;
74659d
 
74659d
-  constraint (Rn == REG_SP, BAD_SP);
74659d
+  if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
74659d
+    constraint (Rn == REG_SP, BAD_SP);
74659d
   reject_bad_reg (Rm);
74659d
 
74659d
   constraint (!half && inst.operands[0].shifted,
74659d
@@ -13317,6 +13388,8 @@ NEON_ENC_TAB
74659d
   X(3, (D, Q, S), MIXED),		\
74659d
   X(4, (D, D, D, I), DOUBLE),		\
74659d
   X(4, (Q, Q, Q, I), QUAD),		\
74659d
+  X(4, (D, D, S, I), DOUBLE),		\
74659d
+  X(4, (Q, Q, S, I), QUAD),		\
74659d
   X(2, (F, F), SINGLE),			\
74659d
   X(3, (F, F, F), SINGLE),		\
74659d
   X(2, (F, I), SINGLE),			\
74659d
@@ -14390,6 +14463,11 @@ static void
74659d
 do_vfp_nsyn_push (void)
74659d
 {
74659d
   nsyn_insert_sp ();
74659d
+
74659d
+  constraint (inst.operands[1].imm < 1 || inst.operands[1].imm > 16,
74659d
+	      _("register list must contain at least 1 and at most 16 "
74659d
+		"registers"));
74659d
+
74659d
   if (inst.operands[1].issingle)
74659d
     do_vfp_nsyn_opcode ("fstmdbs");
74659d
   else
74659d
@@ -14400,6 +14478,11 @@ static void
74659d
 do_vfp_nsyn_pop (void)
74659d
 {
74659d
   nsyn_insert_sp ();
74659d
+
74659d
+  constraint (inst.operands[1].imm < 1 || inst.operands[1].imm > 16,
74659d
+	      _("register list must contain at least 1 and at most 16 "
74659d
+		"registers"));
74659d
+
74659d
   if (inst.operands[1].issingle)
74659d
     do_vfp_nsyn_opcode ("fldmias");
74659d
   else
74659d
@@ -14952,7 +15035,14 @@ do_neon_ceq (void)
74659d
    scalars, which are encoded in 5 bits, M : Rm.
74659d
    For 16-bit scalars, the register is encoded in Rm[2:0] and the index in
74659d
    M:Rm[3], and for 32-bit scalars, the register is encoded in Rm[3:0] and the
74659d
-   index in M.  */
74659d
+   index in M.
74659d
+
74659d
+   Dot Product instructions are similar to multiply instructions except elsize
74659d
+   should always be 32.
74659d
+
74659d
+   This function translates SCALAR, which is GAS's internal encoding of indexed
74659d
+   scalar register, to raw encoding.  There is also register and index range
74659d
+   check based on ELSIZE.  */
74659d
 
74659d
 static unsigned
74659d
 neon_scalar_for_mul (unsigned scalar, unsigned elsize)
74659d
@@ -17220,6 +17310,153 @@ do_vrintm (void)
74659d
   do_vrint_1 (neon_cvt_mode_m);
74659d
 }
74659d
 
74659d
+static unsigned
74659d
+neon_scalar_for_vcmla (unsigned opnd, unsigned elsize)
74659d
+{
74659d
+  unsigned regno = NEON_SCALAR_REG (opnd);
74659d
+  unsigned elno = NEON_SCALAR_INDEX (opnd);
74659d
+
74659d
+  if (elsize == 16 && elno < 2 && regno < 16)
74659d
+    return regno | (elno << 4);
74659d
+  else if (elsize == 32 && elno == 0)
74659d
+    return regno;
74659d
+
74659d
+  first_error (_("scalar out of range"));
74659d
+  return 0;
74659d
+}
74659d
+
74659d
+static void
74659d
+do_vcmla (void)
74659d
+{
74659d
+  constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_armv8),
74659d
+	      _(BAD_FPU));
74659d
+  constraint (inst.reloc.exp.X_op != O_constant, _("expression too complex"));
74659d
+  unsigned rot = inst.reloc.exp.X_add_number;
74659d
+  constraint (rot != 0 && rot != 90 && rot != 180 && rot != 270,
74659d
+	      _("immediate out of range"));
74659d
+  rot /= 90;
74659d
+  if (inst.operands[2].isscalar)
74659d
+    {
74659d
+      enum neon_shape rs = neon_select_shape (NS_DDSI, NS_QQSI, NS_NULL);
74659d
+      unsigned size = neon_check_type (3, rs, N_EQK, N_EQK,
74659d
+				       N_KEY | N_F16 | N_F32).size;
74659d
+      unsigned m = neon_scalar_for_vcmla (inst.operands[2].reg, size);
74659d
+      inst.is_neon = 1;
74659d
+      inst.instruction = 0xfe000800;
74659d
+      inst.instruction |= LOW4 (inst.operands[0].reg) << 12;
74659d
+      inst.instruction |= HI1 (inst.operands[0].reg) << 22;
74659d
+      inst.instruction |= LOW4 (inst.operands[1].reg) << 16;
74659d
+      inst.instruction |= HI1 (inst.operands[1].reg) << 7;
74659d
+      inst.instruction |= LOW4 (m);
74659d
+      inst.instruction |= HI1 (m) << 5;
74659d
+      inst.instruction |= neon_quad (rs) << 6;
74659d
+      inst.instruction |= rot << 20;
74659d
+      inst.instruction |= (size == 32) << 23;
74659d
+    }
74659d
+  else
74659d
+    {
74659d
+      enum neon_shape rs = neon_select_shape (NS_DDDI, NS_QQQI, NS_NULL);
74659d
+      unsigned size = neon_check_type (3, rs, N_EQK, N_EQK,
74659d
+				       N_KEY | N_F16 | N_F32).size;
74659d
+      neon_three_same (neon_quad (rs), 0, -1);
74659d
+      inst.instruction &= 0x00ffffff; /* Undo neon_dp_fixup.  */
74659d
+      inst.instruction |= 0xfc200800;
74659d
+      inst.instruction |= rot << 23;
74659d
+      inst.instruction |= (size == 32) << 20;
74659d
+    }
74659d
+}
74659d
+
74659d
+static void
74659d
+do_vcadd (void)
74659d
+{
74659d
+  constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_armv8),
74659d
+	      _(BAD_FPU));
74659d
+  constraint (inst.reloc.exp.X_op != O_constant, _("expression too complex"));
74659d
+  unsigned rot = inst.reloc.exp.X_add_number;
74659d
+  constraint (rot != 90 && rot != 270, _("immediate out of range"));
74659d
+  enum neon_shape rs = neon_select_shape (NS_DDDI, NS_QQQI, NS_NULL);
74659d
+  unsigned size = neon_check_type (3, rs, N_EQK, N_EQK,
74659d
+				   N_KEY | N_F16 | N_F32).size;
74659d
+  neon_three_same (neon_quad (rs), 0, -1);
74659d
+  inst.instruction &= 0x00ffffff; /* Undo neon_dp_fixup.  */
74659d
+  inst.instruction |= 0xfc800800;
74659d
+  inst.instruction |= (rot == 270) << 24;
74659d
+  inst.instruction |= (size == 32) << 20;
74659d
+}
74659d
+
74659d
+/* Dot Product instructions encoding support.  */
74659d
+
74659d
+static void
74659d
+do_neon_dotproduct (int unsigned_p)
74659d
+{
74659d
+  enum neon_shape rs;
74659d
+  unsigned scalar_oprd2 = 0;
74659d
+  int high8;
74659d
+
74659d
+  if (inst.cond != COND_ALWAYS)
74659d
+    as_warn (_("Dot Product instructions cannot be conditional,  the behaviour "
74659d
+	       "is UNPREDICTABLE"));
74659d
+
74659d
+  constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_neon_ext_armv8),
74659d
+	      _(BAD_FPU));
74659d
+
74659d
+  /* Dot Product instructions are in three-same D/Q register format or the third
74659d
+     operand can be a scalar index register.  */
74659d
+  if (inst.operands[2].isscalar)
74659d
+    {
74659d
+      scalar_oprd2 = neon_scalar_for_mul (inst.operands[2].reg, 32);
74659d
+      high8 = 0xfe000000;
74659d
+      rs = neon_select_shape (NS_DDS, NS_QQS, NS_NULL);
74659d
+    }
74659d
+  else
74659d
+    {
74659d
+      high8 = 0xfc000000;
74659d
+      rs = neon_select_shape (NS_DDD, NS_QQQ, NS_NULL);
74659d
+    }
74659d
+
74659d
+  if (unsigned_p)
74659d
+    neon_check_type (3, rs, N_EQK, N_EQK, N_KEY | N_U8);
74659d
+  else
74659d
+    neon_check_type (3, rs, N_EQK, N_EQK, N_KEY | N_S8);
74659d
+
74659d
+  /* The "U" bit in traditional Three Same encoding is fixed to 0 for Dot
74659d
+     Product instruction, so we pass 0 as the "ubit" parameter.  And the
74659d
+     "Size" field are fixed to 0x2, so we pass 32 as the "size" parameter.  */
74659d
+  neon_three_same (neon_quad (rs), 0, 32);
74659d
+
74659d
+  /* Undo neon_dp_fixup.  Dot Product instructions are using a slightly
74659d
+     different NEON three-same encoding.  */
74659d
+  inst.instruction &= 0x00ffffff;
74659d
+  inst.instruction |= high8;
74659d
+  /* Encode 'U' bit which indicates signedness.  */
74659d
+  inst.instruction |= (unsigned_p ? 1 : 0) << 4;
74659d
+  /* Re-encode operand2 if it's indexed scalar operand.  What has been encoded
74659d
+     from inst.operand[2].reg in neon_three_same is GAS's internal encoding, not
74659d
+     the instruction encoding.  */
74659d
+  if (inst.operands[2].isscalar)
74659d
+    {
74659d
+      inst.instruction &= 0xffffffd0;
74659d
+      inst.instruction |= LOW4 (scalar_oprd2);
74659d
+      inst.instruction |= HI1 (scalar_oprd2) << 5;
74659d
+    }
74659d
+}
74659d
+
74659d
+/* Dot Product instructions for signed integer.  */
74659d
+
74659d
+static void
74659d
+do_neon_dotproduct_s (void)
74659d
+{
74659d
+  return do_neon_dotproduct (0);
74659d
+}
74659d
+
74659d
+/* Dot Product instructions for unsigned integer.  */
74659d
+
74659d
+static void
74659d
+do_neon_dotproduct_u (void)
74659d
+{
74659d
+  return do_neon_dotproduct (1);
74659d
+}
74659d
+
74659d
 /* Crypto v1 instructions.  */
74659d
 static void
74659d
 do_crypto_2op_1 (unsigned elttype, int op)
74659d
@@ -17401,6 +17638,16 @@ do_crc32cw (void)
74659d
   do_crc32_1 (1, 2);
74659d
 }
74659d
 
74659d
+static void
74659d
+do_vjcvt (void)
74659d
+{
74659d
+  constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_vfp_ext_armv8),
74659d
+	      _(BAD_FPU));
74659d
+  neon_check_type (2, NS_FD, N_S32, N_F64);
74659d
+  do_vfp_sp_dp_cvt ();
74659d
+  do_vfp_cond_or_thumb ();
74659d
+}
74659d
+
74659d
 
74659d
 /* Overall per-instruction processing.	*/
74659d
 
74659d
@@ -17755,7 +18002,7 @@ opcode_lookup (char **str)
74659d
 	case OT_odd_infix_unc:
74659d
 	  if (!unified_syntax)
74659d
 	    return 0;
74659d
-	  /* else fall through */
74659d
+	  /* Fall through.  */
74659d
 
74659d
 	case OT_csuffix:
74659d
 	case OT_csuffixF:
74659d
@@ -17878,7 +18125,7 @@ now_it_add_mask (int cond)
74659d
      set_it_insn_type_last ()           ditto
74659d
      in_it_block ()                     ditto
74659d
      it_fsm_post_encode ()              from md_assemble ()
74659d
-     force_automatic_it_block_close ()  from label habdling functions
74659d
+     force_automatic_it_block_close ()  from label handling functions
74659d
 
74659d
    Rationale:
74659d
      1) md_assemble () calls it_fsm_pre_encode () before calling tencode (),
74659d
@@ -17911,7 +18158,7 @@ now_it_add_mask (int cond)
74659d
 	for covering other cases.
74659d
 
74659d
 	Calling handle_it_state () may not transition the IT block state to
74659d
-	OUTSIDE_IT_BLOCK immediatelly, since the (current) state could be
74659d
+	OUTSIDE_IT_BLOCK immediately, since the (current) state could be
74659d
 	still queried. Instead, if the FSM determines that the state should
74659d
 	be transitioned to OUTSIDE_IT_BLOCK, a flag is marked to be closed
74659d
 	after the tencode () function: that's what it_fsm_post_encode () does.
74659d
@@ -18002,7 +18249,7 @@ handle_it_state (void)
74659d
       switch (inst.it_insn_type)
74659d
 	{
74659d
 	case OUTSIDE_IT_INSN:
74659d
-	  /* The closure of the block shall happen immediatelly,
74659d
+	  /* The closure of the block shall happen immediately,
74659d
 	     so any in_it_block () call reports the block as closed.  */
74659d
 	  force_automatic_it_block_close ();
74659d
 	  break;
74659d
@@ -18236,6 +18483,13 @@ t32_insn_ok (arm_feature_set arch, const
74659d
       && opcode->tencode == do_t_branch)
74659d
     return TRUE;
74659d
 
74659d
+  /* MOV accepts T1/T3 encodings under Baseline, T3 encoding is 32bit.  */
74659d
+  if (ARM_CPU_HAS_FEATURE (arch, arm_ext_v8m)
74659d
+      && opcode->tencode == do_t_mov_cmp
74659d
+      /* Make sure CMP instruction is not affected.  */
74659d
+      && opcode->aencode == do_mov)
74659d
+    return TRUE;
74659d
+
74659d
   /* Wide instruction variants of all instructions with narrow *and* wide
74659d
      variants become available with ARMv6t2.  Other opcodes are either
74659d
      narrow-only or wide-only and are thus available if OPCODE is valid.  */
74659d
@@ -18296,7 +18550,10 @@ md_assemble (char *str)
74659d
 	  || (thumb_mode == 1
74659d
 	      && !ARM_CPU_HAS_FEATURE (variant, *opcode->tvariant)))
74659d
 	{
74659d
-	  as_bad (_("selected processor does not support `%s' in Thumb mode"), str);
74659d
+	  if (opcode->tencode == do_t_swi)
74659d
+	    as_bad (_("SVC is not permitted on this architecture"));
74659d
+	  else
74659d
+	    as_bad (_("selected processor does not support `%s' in Thumb mode"), str);
74659d
 	  return;
74659d
 	}
74659d
       if (inst.cond != COND_ALWAYS && !unified_syntax
74659d
@@ -18663,6 +18920,7 @@ static const struct reg_entry reg_names[
74659d
   REGDEF(FPINST,9,VFC), REGDEF(FPINST2,10,VFC),
74659d
   REGDEF(mvfr0,7,VFC), REGDEF(mvfr1,6,VFC),
74659d
   REGDEF(MVFR0,7,VFC), REGDEF(MVFR1,6,VFC),
74659d
+  REGDEF(mvfr2,5,VFC), REGDEF(MVFR2,5,VFC),
74659d
 
74659d
   /* Maverick DSP coprocessor registers.  */
74659d
   REGSET(mvf,MVF),  REGSET(mvd,MVD),  REGSET(mvfx,MVFX),  REGSET(mvdx,MVDX),
74659d
@@ -18780,24 +19038,32 @@ static const struct asm_psr psrs[] =
74659d
 /* Table of V7M psr names.  */
74659d
 static const struct asm_psr v7m_psrs[] =
74659d
 {
74659d
-  {"apsr",	  0 }, {"APSR",		0 },
74659d
-  {"iapsr",	  1 }, {"IAPSR",	1 },
74659d
-  {"eapsr",	  2 }, {"EAPSR",	2 },
74659d
-  {"psr",	  3 }, {"PSR",		3 },
74659d
-  {"xpsr",	  3 }, {"XPSR",		3 }, {"xPSR",	  3 },
74659d
-  {"ipsr",	  5 }, {"IPSR",		5 },
74659d
-  {"epsr",	  6 }, {"EPSR",		6 },
74659d
-  {"iepsr",	  7 }, {"IEPSR",	7 },
74659d
-  {"msp",	  8 }, {"MSP",		8 }, {"msp_s",     8 }, {"MSP_S",     8 },
74659d
-  {"psp",	  9 }, {"PSP",		9 }, {"psp_s",     9 }, {"PSP_S",     9 },
74659d
-  {"primask",	  16}, {"PRIMASK",	16},
74659d
-  {"basepri",	  17}, {"BASEPRI",	17},
74659d
-  {"basepri_max", 18}, {"BASEPRI_MAX",	18},
74659d
-  {"basepri_max", 18}, {"BASEPRI_MASK",	18}, /* Typo, preserved for backwards compatibility.  */
74659d
-  {"faultmask",	  19}, {"FAULTMASK",	19},
74659d
-  {"control",	  20}, {"CONTROL",	20},
74659d
-  {"msp_ns",	0x88}, {"MSP_NS",     0x88},
74659d
-  {"psp_ns",	0x89}, {"PSP_NS",     0x89}
74659d
+  {"apsr",	   0x0 }, {"APSR",	   0x0 },
74659d
+  {"iapsr",	   0x1 }, {"IAPSR",	   0x1 },
74659d
+  {"eapsr",	   0x2 }, {"EAPSR",	   0x2 },
74659d
+  {"psr",	   0x3 }, {"PSR",	   0x3 },
74659d
+  {"xpsr",	   0x3 }, {"XPSR",	   0x3 }, {"xPSR",	  3 },
74659d
+  {"ipsr",	   0x5 }, {"IPSR",	   0x5 },
74659d
+  {"epsr",	   0x6 }, {"EPSR",	   0x6 },
74659d
+  {"iepsr",	   0x7 }, {"IEPSR",	   0x7 },
74659d
+  {"msp",	   0x8 }, {"MSP",	   0x8 },
74659d
+  {"psp",	   0x9 }, {"PSP",	   0x9 },
74659d
+  {"msplim",	   0xa }, {"MSPLIM",	   0xa },
74659d
+  {"psplim",	   0xb }, {"PSPLIM",	   0xb },
74659d
+  {"primask",	   0x10}, {"PRIMASK",	   0x10},
74659d
+  {"basepri",	   0x11}, {"BASEPRI",	   0x11},
74659d
+  {"basepri_max",  0x12}, {"BASEPRI_MAX",  0x12},
74659d
+  {"faultmask",	   0x13}, {"FAULTMASK",	   0x13},
74659d
+  {"control",	   0x14}, {"CONTROL",	   0x14},
74659d
+  {"msp_ns",	   0x88}, {"MSP_NS",	   0x88},
74659d
+  {"psp_ns",	   0x89}, {"PSP_NS",	   0x89},
74659d
+  {"msplim_ns",	   0x8a}, {"MSPLIM_NS",	   0x8a},
74659d
+  {"psplim_ns",	   0x8b}, {"PSPLIM_NS",	   0x8b},
74659d
+  {"primask_ns",   0x90}, {"PRIMASK_NS",   0x90},
74659d
+  {"basepri_ns",   0x91}, {"BASEPRI_NS",   0x91},
74659d
+  {"faultmask_ns", 0x93}, {"FAULTMASK_NS", 0x93},
74659d
+  {"control_ns",   0x94}, {"CONTROL_NS",   0x94},
74659d
+  {"sp_ns",	   0x98}, {"SP_NS",	   0x98 }
74659d
 };
74659d
 
74659d
 /* Table of all shift-in-operand names.	 */
74659d
@@ -19112,8 +19378,6 @@ static const struct asm_opcode insns[] =
74659d
  tC3("ldmia",	8900000, _ldmia,    2, (RRw, REGLST), ldmstm, t_ldmstm),
74659d
  tC3("ldmfd",	8900000, _ldmia,    2, (RRw, REGLST), ldmstm, t_ldmstm),
74659d
 
74659d
- TCE("swi",	f000000, df00,     1, (EXPi),        swi, t_swi),
74659d
- TCE("svc",	f000000, df00,     1, (EXPi),        swi, t_swi),
74659d
  tCE("b",	a000000, _b,	   1, (EXPr),	     branch, t_branch),
74659d
  TCE("bl",	b000000, f000f800, 1, (EXPr),	     bl, t_branch23),
74659d
 
74659d
@@ -19142,6 +19406,12 @@ static const struct asm_opcode insns[] =
74659d
  TC3("rsbs",	0700000, ebd00000, 3, (RR, oRR, SH), arit, t_rsb),
74659d
 
74659d
 #undef  THUMB_VARIANT
74659d
+#define THUMB_VARIANT  & arm_ext_os
74659d
+
74659d
+ TCE("swi",	f000000, df00,     1, (EXPi),        swi, t_swi),
74659d
+ TCE("svc",	f000000, df00,     1, (EXPi),        swi, t_swi),
74659d
+
74659d
+#undef  THUMB_VARIANT
74659d
 #define THUMB_VARIANT  & arm_ext_v6
74659d
 
74659d
  TCE("cpy",       1a00000, 4600,     2, (RR, RR),      rd_rm, t_cpy),
74659d
@@ -19729,6 +19999,21 @@ static const struct asm_opcode insns[] =
74659d
  TUE ("esb", 320f010, f3af8010, 0, (), noargs,  noargs),
74659d
 
74659d
 #undef  ARM_VARIANT
74659d
+#define ARM_VARIANT   & arm_ext_v8_3
74659d
+#undef  THUMB_VARIANT
74659d
+#define THUMB_VARIANT & arm_ext_v8_3
74659d
+ NCE (vjcvt, eb90bc0, 2, (RVS, RVD), vjcvt),
74659d
+ NUF (vcmla, 0, 4, (RNDQ, RNDQ, RNDQ_RNSC, EXPi), vcmla),
74659d
+ NUF (vcadd, 0, 4, (RNDQ, RNDQ, RNDQ, EXPi), vcadd),
74659d
+
74659d
+#undef  ARM_VARIANT
74659d
+#define ARM_VARIANT   & fpu_neon_ext_dotprod
74659d
+#undef  THUMB_VARIANT
74659d
+#define THUMB_VARIANT & fpu_neon_ext_dotprod
74659d
+ NUF (vsdot, d00, 3, (RNDQ, RNDQ, RNDQ_RNSC), neon_dotproduct_s),
74659d
+ NUF (vudot, d00, 3, (RNDQ, RNDQ, RNDQ_RNSC), neon_dotproduct_u),
74659d
+
74659d
+#undef  ARM_VARIANT
74659d
 #define ARM_VARIANT  & fpu_fpa_ext_v1  /* Core FPA instruction set (V1).  */
74659d
 #undef  THUMB_VARIANT
74659d
 #define THUMB_VARIANT NULL
74659d
@@ -21706,7 +21991,7 @@ arm_frag_align_code (int n, int max)
74659d
    Note - despite the name this initialisation is not done when the frag
74659d
    is created, but only when its type is assigned.  A frag can be created
74659d
    and used a long time before its type is set, so beware of assuming that
74659d
-   this initialisationis performed first.  */
74659d
+   this initialisation is performed first.  */
74659d
 
74659d
 #ifndef OBJ_ELF
74659d
 void
74659d
@@ -21720,7 +22005,7 @@ arm_init_frag (fragS * fragP, int max_ch
74659d
 void
74659d
 arm_init_frag (fragS * fragP, int max_chars)
74659d
 {
74659d
-  int frag_thumb_mode;
74659d
+  bfd_boolean frag_thumb_mode;
74659d
 
74659d
   /* If the current ARM vs THUMB mode has not already
74659d
      been recorded into this frag then do so now.  */
74659d
@@ -22731,6 +23016,23 @@ md_apply_fix (fixS *	fixP,
74659d
 	     changing the opcode.  */
74659d
 	  if (newimm == (unsigned int) FAIL)
74659d
 	    newimm = negate_data_op (&temp, value);
74659d
+	  /* MOV accepts both ARM modified immediate (A1 encoding) and
74659d
+	     UINT16 (A2 encoding) when possible, MOVW only accepts UINT16.
74659d
+	     When disassembling, MOV is preferred when there is no encoding
74659d
+	     overlap.  */
74659d
+	  if (newimm == (unsigned int) FAIL
74659d
+	      && ((temp >> DATA_OP_SHIFT) & 0xf) == OPCODE_MOV
74659d
+	      && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2)
74659d
+	      && !((temp >> SBIT_SHIFT) & 0x1)
74659d
+	      && value >= 0 && value <= 0xffff)
74659d
+	    {
74659d
+	      /* Clear bits[23:20] to change encoding from A1 to A2.  */
74659d
+	      temp &= 0xff0fffff;
74659d
+	      /* Encoding high 4bits imm.  Code below will encode the remaining
74659d
+		 low 12bits.  */
74659d
+	      temp |= (value & 0x0000f000) << 4;
74659d
+	      newimm = value & 0x00000fff;
74659d
+	    }
74659d
 	}
74659d
 
74659d
       if (newimm == (unsigned int) FAIL)
74659d
@@ -22816,6 +23118,7 @@ md_apply_fix (fixS *	fixP,
74659d
     case BFD_RELOC_ARM_OFFSET_IMM:
74659d
       if (!fixP->fx_done && seg->use_rela_p)
74659d
 	value = 0;
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_LITERAL:
74659d
       sign = value > 0;
74659d
@@ -23046,32 +23349,59 @@ md_apply_fix (fixS *	fixP,
74659d
       newval |= md_chars_to_number (buf+2, THUMB_SIZE);
74659d
 
74659d
       newimm = FAIL;
74659d
-      if (fixP->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE
74659d
+      if ((fixP->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE
74659d
+	   /* ARMv8-M Baseline MOV will reach here, but it doesn't support
74659d
+	      Thumb2 modified immediate encoding (T2).  */
74659d
+	   && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2))
74659d
 	  || fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
74659d
 	{
74659d
 	  newimm = encode_thumb32_immediate (value);
74659d
 	  if (newimm == (unsigned int) FAIL)
74659d
 	    newimm = thumb32_negate_data_op (&newval, value);
74659d
 	}
74659d
-      if (fixP->fx_r_type != BFD_RELOC_ARM_T32_IMMEDIATE
74659d
-	  && newimm == (unsigned int) FAIL)
74659d
+      if (newimm == (unsigned int) FAIL)
74659d
 	{
74659d
-	  /* Turn add/sum into addw/subw.  */
74659d
-	  if (fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
74659d
-	    newval = (newval & 0xfeffffff) | 0x02000000;
74659d
-	  /* No flat 12-bit imm encoding for addsw/subsw.  */
74659d
-	  if ((newval & 0x00100000) == 0)
74659d
+	  if (fixP->fx_r_type != BFD_RELOC_ARM_T32_IMMEDIATE)
74659d
 	    {
74659d
-	      /* 12 bit immediate for addw/subw.  */
74659d
-	      if (value < 0)
74659d
+	      /* Turn add/sum into addw/subw.  */
74659d
+	      if (fixP->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM)
74659d
+		newval = (newval & 0xfeffffff) | 0x02000000;
74659d
+	      /* No flat 12-bit imm encoding for addsw/subsw.  */
74659d
+	      if ((newval & 0x00100000) == 0)
74659d
 		{
74659d
-		  value = -value;
74659d
-		  newval ^= 0x00a00000;
74659d
+		  /* 12 bit immediate for addw/subw.  */
74659d
+		  if (value < 0)
74659d
+		    {
74659d
+		      value = -value;
74659d
+		      newval ^= 0x00a00000;
74659d
+		    }
74659d
+		  if (value > 0xfff)
74659d
+		    newimm = (unsigned int) FAIL;
74659d
+		  else
74659d
+		    newimm = value;
74659d
+		}
74659d
+	    }
74659d
+	  else
74659d
+	    {
74659d
+	      /* MOV accepts both Thumb2 modified immediate (T2 encoding) and
74659d
+		 UINT16 (T3 encoding), MOVW only accepts UINT16.  When
74659d
+		 disassembling, MOV is preferred when there is no encoding
74659d
+		 overlap.
74659d
+		 NOTE: MOV is using ORR opcode under Thumb 2 mode.  */
74659d
+	      if (((newval >> T2_DATA_OP_SHIFT) & 0xf) == T2_OPCODE_ORR
74659d
+		  && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6t2_v8m)
74659d
+		  && !((newval >> T2_SBIT_SHIFT) & 0x1)
74659d
+		  && value >= 0 && value <=0xffff)
74659d
+		{
74659d
+		  /* Toggle bit[25] to change encoding from T2 to T3.  */
74659d
+		  newval ^= 1 << 25;
74659d
+		  /* Clear bits[19:16].  */
74659d
+		  newval &= 0xfff0ffff;
74659d
+		  /* Encoding high 4bits imm.  Code below will encode the
74659d
+		     remaining low 12bits.  */
74659d
+		  newval |= (value & 0x0000f000) << 4;
74659d
+		  newimm = value & 0x00000fff;
74659d
 		}
74659d
-	      if (value > 0xfff)
74659d
-		newimm = (unsigned int) FAIL;
74659d
-	      else
74659d
-		newimm = value;
74659d
 	    }
74659d
 	}
74659d
 
74659d
@@ -23174,6 +23504,7 @@ md_apply_fix (fixS *	fixP,
74659d
 	  newval = md_chars_to_number (buf, INSN_SIZE);
74659d
 	  fixP->fx_done = 0;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_PLT32:
74659d
 #endif
74659d
@@ -23210,7 +23541,7 @@ md_apply_fix (fixS *	fixP,
74659d
       /* We are going to store value (shifted right by two) in the
74659d
 	 instruction, in a 24 bit, signed field.  Bits 26 through 32 either
74659d
 	 all clear or all set and bit 0 must be clear.  For B/BL bit 1 must
74659d
-	 also be be clear.  */
74659d
+	 also be clear.  */
74659d
       if (value & temp)
74659d
 	as_bad_where (fixP->fx_file, fixP->fx_line,
74659d
 		      _("misaligned branch destination"));
74659d
@@ -24066,6 +24397,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_8_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_16:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24073,6 +24405,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_16_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_32:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24080,6 +24413,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_32_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_MOVW:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24087,6 +24421,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_ARM_MOVW_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_MOVT:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24094,6 +24429,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_ARM_MOVT_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_THUMB_MOVW:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24101,6 +24437,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_ARM_THUMB_MOVW_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_ARM_THUMB_MOVT:
74659d
       if (fixp->fx_pcrel)
74659d
@@ -24108,6 +24445,7 @@ tc_gen_reloc (asection *section, fixS *f
74659d
 	  code = BFD_RELOC_ARM_THUMB_MOVT_PCREL;
74659d
 	  break;
74659d
 	}
74659d
+      /* Fall through.  */
74659d
 
74659d
     case BFD_RELOC_NONE:
74659d
     case BFD_RELOC_ARM_PCREL_BRANCH:
74659d
@@ -24791,7 +25129,12 @@ md_begin (void)
74659d
       mcpu_cpu_opt = legacy_cpu;
74659d
     }
74659d
   else if (!mcpu_cpu_opt)
74659d
-    mcpu_cpu_opt = march_cpu_opt;
74659d
+    {
74659d
+      mcpu_cpu_opt = march_cpu_opt;
74659d
+      dyn_mcpu_ext_opt = dyn_march_ext_opt;
74659d
+      /* Avoid double free in arm_md_end.  */
74659d
+      dyn_march_ext_opt = NULL;
74659d
+    }
74659d
 
74659d
   if (legacy_fpu)
74659d
     {
74659d
@@ -24831,16 +25174,22 @@ md_begin (void)
74659d
       mcpu_cpu_opt = &cpu_default;
74659d
       selected_cpu = cpu_default;
74659d
     }
74659d
-  else if (no_cpu_selected ())
74659d
-    selected_cpu = cpu_default;
74659d
+  else if (dyn_mcpu_ext_opt)
74659d
+    ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
74659d
+  else
74659d
+    selected_cpu = *mcpu_cpu_opt;
74659d
 #else
74659d
-  if (mcpu_cpu_opt)
74659d
+  if (mcpu_cpu_opt && dyn_mcpu_ext_opt)
74659d
+    ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
74659d
+  else if (mcpu_cpu_opt)
74659d
     selected_cpu = *mcpu_cpu_opt;
74659d
   else
74659d
     mcpu_cpu_opt = &arm_arch_any;
74659d
 #endif
74659d
 
74659d
   ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
74659d
+  if (dyn_mcpu_ext_opt)
74659d
+    ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
74659d
 
74659d
   autoselect_thumb_from_cpu_variant ();
74659d
 
74659d
@@ -25215,6 +25564,7 @@ struct arm_cpu_option_table
74659d
   const char *name;
74659d
   size_t name_len;
74659d
   const arm_feature_set	value;
74659d
+  const arm_feature_set	ext;
74659d
   /* For some CPUs we assume an FPU unless the user explicitly sets
74659d
      -mfpu=...	*/
74659d
   const arm_feature_set	default_fpu;
74659d
@@ -25225,174 +25575,387 @@ struct arm_cpu_option_table
74659d
 
74659d
 /* This list should, at a minimum, contain all the cpu names
74659d
    recognized by GCC.  */
74659d
-#define ARM_CPU_OPT(N, V, DF, CN) { N, sizeof (N) - 1, V, DF, CN }
74659d
+#define ARM_CPU_OPT(N, CN, V, E, DF) { N, sizeof (N) - 1, V, E, DF, CN }
74659d
 static const struct arm_cpu_option_table arm_cpus[] =
74659d
 {
74659d
-  ARM_CPU_OPT ("all",		ARM_ANY,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm1",		ARM_ARCH_V1,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm2",		ARM_ARCH_V2,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm250",	ARM_ARCH_V2S,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm3",		ARM_ARCH_V2S,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm6",		ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm60",		ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm600",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm610",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm620",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7",		ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7m",		ARM_ARCH_V3M,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7d",		ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7dm",	ARM_ARCH_V3M,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7di",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7dmi",	ARM_ARCH_V3M,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm70",		ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm700",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm700i",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm710",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm710t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm720",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm720t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm740t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm710c",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7100",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7500",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7500fe",	ARM_ARCH_V3,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7t",		ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7tdmi",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm7tdmi-s",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm8",		ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm810",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("strongarm",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("strongarm1",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("strongarm110",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("strongarm1100",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("strongarm1110",	ARM_ARCH_V4,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm9",		ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm920",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    "ARM920T"),
74659d
-  ARM_CPU_OPT ("arm920t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm922t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm940t",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,    NULL),
74659d
-  ARM_CPU_OPT ("arm9tdmi",	ARM_ARCH_V4T,	 FPU_ARCH_FPA,	  NULL),
74659d
-  ARM_CPU_OPT ("fa526",		ARM_ARCH_V4,	 FPU_ARCH_FPA,	  NULL),
74659d
-  ARM_CPU_OPT ("fa626",		ARM_ARCH_V4,	 FPU_ARCH_FPA,	  NULL),
74659d
+  ARM_CPU_OPT ("all",		  NULL,		       ARM_ANY,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm1",		  NULL,		       ARM_ARCH_V1,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm2",		  NULL,		       ARM_ARCH_V2,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm250",	  NULL,		       ARM_ARCH_V2S,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm3",		  NULL,		       ARM_ARCH_V2S,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm6",		  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm60",		  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm600",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm610",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm620",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7",		  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7m",		  NULL,		       ARM_ARCH_V3M,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7d",		  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7dm",	  NULL,		       ARM_ARCH_V3M,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7di",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7dmi",	  NULL,		       ARM_ARCH_V3M,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm70",		  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm700",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm700i",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm710",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm710t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm720",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm720t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm740t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm710c",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7100",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7500",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7500fe",	  NULL,		       ARM_ARCH_V3,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7t",		  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7tdmi",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm7tdmi-s",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm8",		  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm810",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("strongarm",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("strongarm1",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("strongarm110",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("strongarm1100",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("strongarm1110",	  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm9",		  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm920",	  "ARM920T",	       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm920t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm922t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm940t",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("arm9tdmi",	  NULL,		       ARM_ARCH_V4T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("fa526",		  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+  ARM_CPU_OPT ("fa626",		  NULL,		       ARM_ARCH_V4,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_FPA),
74659d
+
74659d
   /* For V5 or later processors we default to using VFP; but the user
74659d
      should really set the FPU type explicitly.	 */
74659d
-  ARM_CPU_OPT ("arm9e-r0",	ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm9e",		ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm926ej",	ARM_ARCH_V5TEJ,	 FPU_ARCH_VFP_V2, "ARM926EJ-S"),
74659d
-  ARM_CPU_OPT ("arm926ejs",	ARM_ARCH_V5TEJ,	 FPU_ARCH_VFP_V2, "ARM926EJ-S"),
74659d
-  ARM_CPU_OPT ("arm926ej-s",	ARM_ARCH_V5TEJ,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm946e-r0",	ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm946e",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, "ARM946E-S"),
74659d
-  ARM_CPU_OPT ("arm946e-s",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm966e-r0",	ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm966e",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, "ARM966E-S"),
74659d
-  ARM_CPU_OPT ("arm966e-s",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm968e-s",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm10t",	ARM_ARCH_V5T,	 FPU_ARCH_VFP_V1, NULL),
74659d
-  ARM_CPU_OPT ("arm10tdmi",	ARM_ARCH_V5T,	 FPU_ARCH_VFP_V1, NULL),
74659d
-  ARM_CPU_OPT ("arm10e",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm1020",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, "ARM1020E"),
74659d
-  ARM_CPU_OPT ("arm1020t",	ARM_ARCH_V5T,	 FPU_ARCH_VFP_V1, NULL),
74659d
-  ARM_CPU_OPT ("arm1020e",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm1022e",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm1026ejs",	ARM_ARCH_V5TEJ,	 FPU_ARCH_VFP_V2,
74659d
-								 "ARM1026EJ-S"),
74659d
-  ARM_CPU_OPT ("arm1026ej-s",	ARM_ARCH_V5TEJ,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("fa606te",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("fa616te",	ARM_ARCH_V5TE,   FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("fa626te",	ARM_ARCH_V5TE,   FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("fmp626",	ARM_ARCH_V5TE,   FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("fa726te",	ARM_ARCH_V5TE,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm1136js",	ARM_ARCH_V6,	 FPU_NONE,	  "ARM1136J-S"),
74659d
-  ARM_CPU_OPT ("arm1136j-s",	ARM_ARCH_V6,	 FPU_NONE,	  NULL),
74659d
-  ARM_CPU_OPT ("arm1136jfs",	ARM_ARCH_V6,	 FPU_ARCH_VFP_V2,
74659d
-								 "ARM1136JF-S"),
74659d
-  ARM_CPU_OPT ("arm1136jf-s",	ARM_ARCH_V6,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("mpcore",	ARM_ARCH_V6K,	 FPU_ARCH_VFP_V2, "MPCore"),
74659d
-  ARM_CPU_OPT ("mpcorenovfp",	ARM_ARCH_V6K,	 FPU_NONE,	  "MPCore"),
74659d
-  ARM_CPU_OPT ("arm1156t2-s",	ARM_ARCH_V6T2,	 FPU_NONE,	  NULL),
74659d
-  ARM_CPU_OPT ("arm1156t2f-s",	ARM_ARCH_V6T2,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("arm1176jz-s",	ARM_ARCH_V6KZ,	 FPU_NONE,	  NULL),
74659d
-  ARM_CPU_OPT ("arm1176jzf-s",	ARM_ARCH_V6KZ,	 FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("cortex-a5",	ARM_ARCH_V7A_MP_SEC,
74659d
-						 FPU_NONE,	  "Cortex-A5"),
74659d
-  ARM_CPU_OPT ("cortex-a7",	ARM_ARCH_V7VE,   FPU_ARCH_NEON_VFP_V4,
74659d
-								  "Cortex-A7"),
74659d
-  ARM_CPU_OPT ("cortex-a8",	ARM_ARCH_V7A_SEC,
74659d
-						 ARM_FEATURE_COPROC (FPU_VFP_V3
74659d
-							| FPU_NEON_EXT_V1),
74659d
-								  "Cortex-A8"),
74659d
-  ARM_CPU_OPT ("cortex-a9",	ARM_ARCH_V7A_MP_SEC,
74659d
-						 ARM_FEATURE_COPROC (FPU_VFP_V3
74659d
-							| FPU_NEON_EXT_V1),
74659d
-								  "Cortex-A9"),
74659d
-  ARM_CPU_OPT ("cortex-a12",	ARM_ARCH_V7VE,   FPU_ARCH_NEON_VFP_V4,
74659d
-								  "Cortex-A12"),
74659d
-  ARM_CPU_OPT ("cortex-a15",	ARM_ARCH_V7VE,   FPU_ARCH_NEON_VFP_V4,
74659d
-								  "Cortex-A15"),
74659d
-  ARM_CPU_OPT ("cortex-a17",	ARM_ARCH_V7VE,   FPU_ARCH_NEON_VFP_V4,
74659d
-								  "Cortex-A17"),
74659d
-  ARM_CPU_OPT ("cortex-a32",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A32"),
74659d
-  ARM_CPU_OPT ("cortex-a35",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A35"),
74659d
-  ARM_CPU_OPT ("cortex-a53",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A53"),
74659d
-  ARM_CPU_OPT ("cortex-a57",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A57"),
74659d
-  ARM_CPU_OPT ("cortex-a72",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A72"),
74659d
-  ARM_CPU_OPT ("cortex-a73",    ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Cortex-A73"),
74659d
-  ARM_CPU_OPT ("cortex-r4",	ARM_ARCH_V7R,	 FPU_NONE,	  "Cortex-R4"),
74659d
-  ARM_CPU_OPT ("cortex-r4f",	ARM_ARCH_V7R,	 FPU_ARCH_VFP_V3D16,
74659d
-								  "Cortex-R4F"),
74659d
-  ARM_CPU_OPT ("cortex-r5",	ARM_ARCH_V7R_IDIV,
74659d
-						 FPU_NONE,	  "Cortex-R5"),
74659d
-  ARM_CPU_OPT ("cortex-r7",	ARM_ARCH_V7R_IDIV,
74659d
-						 FPU_ARCH_VFP_V3D16,
74659d
-								  "Cortex-R7"),
74659d
-  ARM_CPU_OPT ("cortex-r8",	ARM_ARCH_V7R_IDIV,
74659d
-						 FPU_ARCH_VFP_V3D16,
74659d
-								  "Cortex-R8"),
74659d
-  ARM_CPU_OPT ("cortex-m7",	ARM_ARCH_V7EM,	 FPU_NONE,	  "Cortex-M7"),
74659d
-  ARM_CPU_OPT ("cortex-m4",	ARM_ARCH_V7EM,	 FPU_NONE,	  "Cortex-M4"),
74659d
-  ARM_CPU_OPT ("cortex-m3",	ARM_ARCH_V7M,	 FPU_NONE,	  "Cortex-M3"),
74659d
-  ARM_CPU_OPT ("cortex-m1",	ARM_ARCH_V6SM,	 FPU_NONE,	  "Cortex-M1"),
74659d
-  ARM_CPU_OPT ("cortex-m0",	ARM_ARCH_V6SM,	 FPU_NONE,	  "Cortex-M0"),
74659d
-  ARM_CPU_OPT ("cortex-m0plus",	ARM_ARCH_V6SM,	 FPU_NONE,	  "Cortex-M0+"),
74659d
-  ARM_CPU_OPT ("exynos-m1",	ARM_ARCH_V8A,	 FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Samsung " \
74659d
-								  "Exynos M1"),
74659d
-  ARM_CPU_OPT ("qdf24xx",	ARM_ARCH_V8A,	 FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-								  "Qualcomm "
74659d
-								  "QDF24XX"),
74659d
+  ARM_CPU_OPT ("arm9e-r0",	  NULL,		       ARM_ARCH_V5TExP,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm9e",		  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm926ej",	  "ARM926EJ-S",	       ARM_ARCH_V5TEJ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm926ejs",	  "ARM926EJ-S",	       ARM_ARCH_V5TEJ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm926ej-s",	  NULL,		       ARM_ARCH_V5TEJ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm946e-r0",	  NULL,		       ARM_ARCH_V5TExP,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm946e",	  "ARM946E-S",	       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm946e-s",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm966e-r0",	  NULL,		       ARM_ARCH_V5TExP,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm966e",	  "ARM966E-S",	       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm966e-s",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm968e-s",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm10t",	  NULL,		       ARM_ARCH_V5T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V1),
74659d
+  ARM_CPU_OPT ("arm10tdmi",	  NULL,		       ARM_ARCH_V5T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V1),
74659d
+  ARM_CPU_OPT ("arm10e",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1020",	  "ARM1020E",	       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1020t",	  NULL,		       ARM_ARCH_V5T,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V1),
74659d
+  ARM_CPU_OPT ("arm1020e",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1022e",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1026ejs",	  "ARM1026EJ-S",       ARM_ARCH_V5TEJ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1026ej-s",	  NULL,		       ARM_ARCH_V5TEJ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("fa606te",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("fa616te",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("fa626te",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("fmp626",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("fa726te",	  NULL,		       ARM_ARCH_V5TE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1136js",	  "ARM1136J-S",	       ARM_ARCH_V6,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("arm1136j-s",	  NULL,		       ARM_ARCH_V6,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("arm1136jfs",	  "ARM1136JF-S",       ARM_ARCH_V6,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1136jf-s",	  NULL,		       ARM_ARCH_V6,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("mpcore",	  "MPCore",	       ARM_ARCH_V6K,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("mpcorenovfp",	  "MPCore",	       ARM_ARCH_V6K,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("arm1156t2-s",	  NULL,		       ARM_ARCH_V6T2,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("arm1156t2f-s",	  NULL,		       ARM_ARCH_V6T2,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("arm1176jz-s",	  NULL,		       ARM_ARCH_V6KZ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("arm1176jzf-s",	  NULL,		       ARM_ARCH_V6KZ,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("cortex-a5",	  "Cortex-A5",	       ARM_ARCH_V7A,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-a7",	  "Cortex-A7",	       ARM_ARCH_V7VE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_NEON_VFP_V4),
74659d
+  ARM_CPU_OPT ("cortex-a8",	  "Cortex-A8",	       ARM_ARCH_V7A,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
74659d
+	       ARM_FEATURE_COPROC (FPU_VFP_V3 | FPU_NEON_EXT_V1)),
74659d
+  ARM_CPU_OPT ("cortex-a9",	  "Cortex-A9",	       ARM_ARCH_V7A,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
74659d
+	       ARM_FEATURE_COPROC (FPU_VFP_V3 | FPU_NEON_EXT_V1)),
74659d
+  ARM_CPU_OPT ("cortex-a12",	  "Cortex-A12",	       ARM_ARCH_V7VE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_NEON_VFP_V4),
74659d
+  ARM_CPU_OPT ("cortex-a15",	  "Cortex-A15",	       ARM_ARCH_V7VE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_NEON_VFP_V4),
74659d
+  ARM_CPU_OPT ("cortex-a17",	  "Cortex-A17",	       ARM_ARCH_V7VE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_NEON_VFP_V4),
74659d
+  ARM_CPU_OPT ("cortex-a32",	  "Cortex-A32",	       ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a35",	  "Cortex-A35",	       ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a53",	  "Cortex-A53",	       ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a55",    "Cortex-A55",	       ARM_ARCH_V8_2A,
74659d
+	       ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a57",	  "Cortex-A57",	       ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a72",	  "Cortex-A72",	       ARM_ARCH_V8A,
74659d
+	      ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	      FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a73",	  "Cortex-A73",	       ARM_ARCH_V8A,
74659d
+	      ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	      FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-a75",    "Cortex-A75",	       ARM_ARCH_V8_2A,
74659d
+	       ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-r4",	  "Cortex-R4",	       ARM_ARCH_V7R,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-r4f",	  "Cortex-R4F",	       ARM_ARCH_V7R,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V3D16),
74659d
+  ARM_CPU_OPT ("cortex-r5",	  "Cortex-R5",	       ARM_ARCH_V7R,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-r7",	  "Cortex-R7",	       ARM_ARCH_V7R,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
74659d
+	       FPU_ARCH_VFP_V3D16),
74659d
+  ARM_CPU_OPT ("cortex-r8",	  "Cortex-R8",	       ARM_ARCH_V7R,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
74659d
+	       FPU_ARCH_VFP_V3D16),
74659d
+  ARM_CPU_OPT ("cortex-r52",	  "Cortex-R52",	       ARM_ARCH_V8R,
74659d
+	      ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	      FPU_ARCH_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("cortex-m33",	  "Cortex-M33",	       ARM_ARCH_V8M_MAIN,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m23",	  "Cortex-M23",	       ARM_ARCH_V8M_BASE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m7",	  "Cortex-M7",	       ARM_ARCH_V7EM,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m4",	  "Cortex-M4",	       ARM_ARCH_V7EM,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m3",	  "Cortex-M3",	       ARM_ARCH_V7M,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m1",	  "Cortex-M1",	       ARM_ARCH_V6SM,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m0",	  "Cortex-M0",	       ARM_ARCH_V6SM,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("cortex-m0plus",	  "Cortex-M0+",	       ARM_ARCH_V6SM,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_NONE),
74659d
+  ARM_CPU_OPT ("exynos-m1",	  "Samsung Exynos M1", ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
 
74659d
   /* ??? XSCALE is really an architecture.  */
74659d
-  ARM_CPU_OPT ("xscale",	ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL),
74659d
+  ARM_CPU_OPT ("xscale",	  NULL,		       ARM_ARCH_XSCALE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+
74659d
   /* ??? iwmmxt is not a processor.  */
74659d
-  ARM_CPU_OPT ("iwmmxt",	ARM_ARCH_IWMMXT, FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("iwmmxt2",	ARM_ARCH_IWMMXT2,FPU_ARCH_VFP_V2, NULL),
74659d
-  ARM_CPU_OPT ("i80200",	ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL),
74659d
+  ARM_CPU_OPT ("iwmmxt",	  NULL,		       ARM_ARCH_IWMMXT,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("iwmmxt2",	  NULL,		       ARM_ARCH_IWMMXT2,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+  ARM_CPU_OPT ("i80200",	  NULL,		       ARM_ARCH_XSCALE,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_VFP_V2),
74659d
+
74659d
   /* Maverick */
74659d
-  ARM_CPU_OPT ("ep9312",	ARM_FEATURE_LOW (ARM_AEXT_V4T, ARM_CEXT_MAVERICK),
74659d
-						 FPU_ARCH_MAVERICK, "ARM920T"),
74659d
+  ARM_CPU_OPT ("ep9312",	  "ARM920T",
74659d
+	       ARM_FEATURE_LOW (ARM_AEXT_V4T, ARM_CEXT_MAVERICK),
74659d
+	       ARM_ARCH_NONE, FPU_ARCH_MAVERICK),
74659d
+
74659d
   /* Marvell processors.  */
74659d
-  ARM_CPU_OPT ("marvell-pj4",   ARM_FEATURE_CORE (ARM_AEXT_V7A | ARM_EXT_MP
74659d
-						  | ARM_EXT_SEC,
74659d
-						  ARM_EXT2_V6T2_V8M),
74659d
-						FPU_ARCH_VFP_V3D16, NULL),
74659d
-  ARM_CPU_OPT ("marvell-whitney", ARM_FEATURE_CORE (ARM_AEXT_V7A | ARM_EXT_MP
74659d
-						    | ARM_EXT_SEC,
74659d
-						    ARM_EXT2_V6T2_V8M),
74659d
-					       FPU_ARCH_NEON_VFP_V4, NULL),
74659d
+  ARM_CPU_OPT ("marvell-pj4",	  NULL,		       ARM_ARCH_V7A,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
74659d
+	       FPU_ARCH_VFP_V3D16),
74659d
+  ARM_CPU_OPT ("marvell-whitney", NULL,		       ARM_ARCH_V7A,
74659d
+	       ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
74659d
+	       FPU_ARCH_NEON_VFP_V4),
74659d
+
74659d
   /* APM X-Gene family.  */
74659d
-  ARM_CPU_OPT ("xgene1",        ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-	                                                          "APM X-Gene 1"),
74659d
-  ARM_CPU_OPT ("xgene2",        ARM_ARCH_V8A,    FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
-	                                                          "APM X-Gene 2"),
74659d
+  ARM_CPU_OPT ("xgene1",	  "APM X-Gene 1",      ARM_ARCH_V8A,
74659d
+	       ARM_ARCH_NONE,
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
+  ARM_CPU_OPT ("xgene2",	  "APM X-Gene 2",      ARM_ARCH_V8A,
74659d
+	       ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
74659d
+	       FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
74659d
 
74659d
-  { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE, NULL }
74659d
+  { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE, ARM_ARCH_NONE, NULL }
74659d
 };
74659d
 #undef ARM_CPU_OPT
74659d
 
74659d
@@ -25459,6 +26022,8 @@ static const struct arm_arch_option_tabl
74659d
   ARM_ARCH_OPT ("armv8-a",	ARM_ARCH_V8A,	 FPU_ARCH_VFP),
74659d
   ARM_ARCH_OPT ("armv8.1-a",	ARM_ARCH_V8_1A,	 FPU_ARCH_VFP),
74659d
   ARM_ARCH_OPT ("armv8.2-a",	ARM_ARCH_V8_2A,	 FPU_ARCH_VFP),
74659d
+  ARM_ARCH_OPT ("armv8.3-a",	ARM_ARCH_V8_3A,	 FPU_ARCH_VFP),
74659d
+  ARM_ARCH_OPT ("armv8-r",	ARM_ARCH_V8R,	 FPU_ARCH_VFP),
74659d
   ARM_ARCH_OPT ("xscale",	ARM_ARCH_XSCALE, FPU_ARCH_VFP),
74659d
   ARM_ARCH_OPT ("iwmmxt",	ARM_ARCH_IWMMXT, FPU_ARCH_VFP),
74659d
   ARM_ARCH_OPT ("iwmmxt2",	ARM_ARCH_IWMMXT2,FPU_ARCH_VFP),
74659d
@@ -25490,6 +26055,9 @@ static const struct arm_option_extension
74659d
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
74659d
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
74659d
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
74659d
+  ARM_EXT_OPT ("dotprod", FPU_ARCH_DOTPROD_NEON_VFP_ARMV8,
74659d
+			  ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD),
74659d
+			  ARM_ARCH_V8_2A),
74659d
   ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
74659d
 			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
74659d
@@ -25502,6 +26070,13 @@ static const struct arm_option_extension
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV | ARM_EXT_DIV),
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_V7A),
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_V7R)),
74659d
+  /* Duplicate entry for the purpose of allowing ARMv7 to match in presence of
74659d
+     Thumb divide instruction.  Due to this having the same name as the
74659d
+     previous entry, this will be ignored when doing command-line parsing and
74659d
+     only considered by build attribute selection code.  */
74659d
+  ARM_EXT_OPT ("idiv",	ARM_FEATURE_CORE_LOW (ARM_EXT_DIV),
74659d
+			ARM_FEATURE_CORE_LOW (ARM_EXT_DIV),
74659d
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V7)),
74659d
   ARM_EXT_OPT ("iwmmxt",ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT),
74659d
 			ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT), ARM_ARCH_NONE),
74659d
   ARM_EXT_OPT ("iwmmxt2", ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT2),
74659d
@@ -25517,13 +26092,13 @@ static const struct arm_option_extension
74659d
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V6M)),
74659d
   ARM_EXT_OPT ("pan",	ARM_FEATURE_CORE_HIGH (ARM_EXT2_PAN),
74659d
 			ARM_FEATURE (ARM_EXT_V8, ARM_EXT2_PAN, 0),
74659d
-			ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
74659d
+			ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
74659d
   ARM_EXT_OPT ("ras",	ARM_FEATURE_CORE_HIGH (ARM_EXT2_RAS),
74659d
 			ARM_FEATURE (ARM_EXT_V8, ARM_EXT2_RAS, 0),
74659d
-			ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
74659d
+			ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
74659d
   ARM_EXT_OPT ("rdma",  FPU_ARCH_NEON_VFP_ARMV8_1,
74659d
 			ARM_FEATURE_COPROC (FPU_NEON_ARMV8 | FPU_NEON_EXT_RDMA),
74659d
-			ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
74659d
+			ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
74659d
   ARM_EXT_OPT2 ("sec",	ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
74659d
 			ARM_FEATURE_CORE_LOW (ARM_EXT_V6K),
74659d
@@ -25581,6 +26156,7 @@ static const struct arm_option_fpu_value
74659d
   {"arm1136jf-s",	FPU_ARCH_VFP_V2},
74659d
   {"maverick",		FPU_ARCH_MAVERICK},
74659d
   {"neon",              FPU_ARCH_VFP_V3_PLUS_NEON_V1},
74659d
+  {"neon-vfpv3",	FPU_ARCH_VFP_V3_PLUS_NEON_V1},
74659d
   {"neon-fp16",		FPU_ARCH_NEON_FP16},
74659d
   {"vfpv4",		FPU_ARCH_VFP_V4},
74659d
   {"vfpv4-d16",		FPU_ARCH_VFP_V4D16},
74659d
@@ -25632,10 +26208,9 @@ struct arm_long_option_table
74659d
 };
74659d
 
74659d
 static bfd_boolean
74659d
-arm_parse_extension (const char *str, const arm_feature_set **opt_p)
74659d
+arm_parse_extension (const char *str, const arm_feature_set *opt_set,
74659d
+		     arm_feature_set **ext_set_p)
74659d
 {
74659d
-  arm_feature_set *ext_set = XNEW (arm_feature_set);
74659d
-
74659d
   /* We insist on extensions being specified in alphabetical order, and with
74659d
      extensions being added before being removed.  We achieve this by having
74659d
      the global ARM_EXTENSIONS table in alphabetical order, and using the
74659d
@@ -25646,9 +26221,11 @@ arm_parse_extension (const char *str, co
74659d
   const arm_feature_set arm_any = ARM_ANY;
74659d
   int adding_value = -1;
74659d
 
74659d
-  /* Copy the feature set, so that we can modify it.  */
74659d
-  *ext_set = **opt_p;
74659d
-  *opt_p = ext_set;
74659d
+  if (!*ext_set_p)
74659d
+    {
74659d
+      *ext_set_p = XNEW (arm_feature_set);
74659d
+      **ext_set_p = arm_arch_none;
74659d
+    }
74659d
 
74659d
   while (str != NULL && *str != 0)
74659d
     {
74659d
@@ -25716,7 +26293,7 @@ arm_parse_extension (const char *str, co
74659d
 		/* Empty entry.  */
74659d
 		if (ARM_FEATURE_EQUAL (opt->allowed_archs[i], arm_any))
74659d
 		  continue;
74659d
-		if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *ext_set))
74659d
+		if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *opt_set))
74659d
 		  break;
74659d
 	      }
74659d
 	    if (i == nb_allowed_archs)
74659d
@@ -25727,10 +26304,15 @@ arm_parse_extension (const char *str, co
74659d
 
74659d
 	    /* Add or remove the extension.  */
74659d
 	    if (adding_value)
74659d
-	      ARM_MERGE_FEATURE_SETS (*ext_set, *ext_set, opt->merge_value);
74659d
+	      ARM_MERGE_FEATURE_SETS (**ext_set_p, **ext_set_p,
74659d
+				      opt->merge_value);
74659d
 	    else
74659d
-	      ARM_CLEAR_FEATURE (*ext_set, *ext_set, opt->clear_value);
74659d
+	      ARM_CLEAR_FEATURE (**ext_set_p, **ext_set_p, opt->clear_value);
74659d
 
74659d
+	    /* Allowing Thumb division instructions for ARMv7 in autodetection
74659d
+	       rely on this break so that duplicate extensions (extensions
74659d
+	       with the same name as a previous extension in the list) are not
74659d
+	       considered for command-line parsing.  */
74659d
 	    break;
74659d
 	  }
74659d
 
74659d
@@ -25786,6 +26368,9 @@ arm_parse_cpu (const char *str)
74659d
     if (opt->name_len == len && strncmp (opt->name, str, len) == 0)
74659d
       {
74659d
 	mcpu_cpu_opt = &opt->value;
74659d
+	if (!dyn_mcpu_ext_opt)
74659d
+	  dyn_mcpu_ext_opt = XNEW (arm_feature_set);
74659d
+	*dyn_mcpu_ext_opt = opt->ext;
74659d
 	mcpu_fpu_opt = &opt->default_fpu;
74659d
 	if (opt->canonical_name)
74659d
 	  {
74659d
@@ -25805,7 +26390,7 @@ arm_parse_cpu (const char *str)
74659d
 	  }
74659d
 
74659d
 	if (ext != NULL)
74659d
-	  return arm_parse_extension (ext, &mcpu_cpu_opt);
74659d
+	  return arm_parse_extension (ext, mcpu_cpu_opt, &dyn_mcpu_ext_opt);
74659d
 
74659d
 	return TRUE;
74659d
       }
74659d
@@ -25840,7 +26425,7 @@ arm_parse_arch (const char *str)
74659d
 	strcpy (selected_cpu_name, opt->name);
74659d
 
74659d
 	if (ext != NULL)
74659d
-	  return arm_parse_extension (ext, &march_cpu_opt);
74659d
+	  return arm_parse_extension (ext, march_cpu_opt, &dyn_march_ext_opt);
74659d
 
74659d
 	return TRUE;
74659d
       }
74659d
@@ -26080,30 +26665,62 @@ typedef struct
74659d
   arm_feature_set flags;
74659d
 } cpu_arch_ver_table;
74659d
 
74659d
-/* Mapping from CPU features to EABI CPU arch values.  As a general rule, table
74659d
-   must be sorted least features first but some reordering is needed, eg. for
74659d
-   Thumb-2 instructions to be detected as coming from ARMv6T2.  */
74659d
+/* Mapping from CPU features to EABI CPU arch values.  Table must be sorted
74659d
+   chronologically for architectures, with an exception for ARMv6-M and
74659d
+   ARMv6S-M due to legacy reasons.  No new architecture should have a
74659d
+   special case.  This allows for build attribute selection results to be
74659d
+   stable when new architectures are added.  */
74659d
 static const cpu_arch_ver_table cpu_arch_ver[] =
74659d
 {
74659d
+    {0, ARM_ARCH_V1},
74659d
+    {0, ARM_ARCH_V2},
74659d
+    {0, ARM_ARCH_V2S},
74659d
+    {0, ARM_ARCH_V3},
74659d
+    {0, ARM_ARCH_V3M},
74659d
+    {1, ARM_ARCH_V4xM},
74659d
     {1, ARM_ARCH_V4},
74659d
+    {2, ARM_ARCH_V4TxM},
74659d
     {2, ARM_ARCH_V4T},
74659d
+    {3, ARM_ARCH_V5xM},
74659d
     {3, ARM_ARCH_V5},
74659d
+    {3, ARM_ARCH_V5TxM},
74659d
     {3, ARM_ARCH_V5T},
74659d
+    {4, ARM_ARCH_V5TExP},
74659d
     {4, ARM_ARCH_V5TE},
74659d
     {5, ARM_ARCH_V5TEJ},
74659d
     {6, ARM_ARCH_V6},
74659d
-    {9, ARM_ARCH_V6K},
74659d
     {7, ARM_ARCH_V6Z},
74659d
+    {7, ARM_ARCH_V6KZ},
74659d
+    {9, ARM_ARCH_V6K},
74659d
+    {8, ARM_ARCH_V6T2},
74659d
+    {8, ARM_ARCH_V6KT2},
74659d
+    {8, ARM_ARCH_V6ZT2},
74659d
+    {8, ARM_ARCH_V6KZT2},
74659d
+
74659d
+    /* When assembling a file with only ARMv6-M or ARMv6S-M instruction, GNU as
74659d
+       always selected build attributes to match those of ARMv6-M
74659d
+       (resp. ARMv6S-M).  However, due to these architectures being a strict
74659d
+       subset of ARMv7-M in terms of instructions available, ARMv7-M attributes
74659d
+       would be selected when fully respecting chronology of architectures.
74659d
+       It is thus necessary to make a special case of ARMv6-M and ARMv6S-M and
74659d
+       move them before ARMv7 architectures.  */
74659d
     {11, ARM_ARCH_V6M},
74659d
     {12, ARM_ARCH_V6SM},
74659d
-    {8, ARM_ARCH_V6T2},
74659d
-    {10, ARM_ARCH_V7VE},
74659d
+
74659d
+    {10, ARM_ARCH_V7},
74659d
+    {10, ARM_ARCH_V7A},
74659d
     {10, ARM_ARCH_V7R},
74659d
     {10, ARM_ARCH_V7M},
74659d
+    {10, ARM_ARCH_V7VE},
74659d
+    {13, ARM_ARCH_V7EM},
74659d
     {14, ARM_ARCH_V8A},
74659d
+    {14, ARM_ARCH_V8_1A},
74659d
+    {14, ARM_ARCH_V8_2A},
74659d
+    {14, ARM_ARCH_V8_3A},
74659d
     {16, ARM_ARCH_V8M_BASE},
74659d
     {17, ARM_ARCH_V8M_MAIN},
74659d
-    {0, ARM_ARCH_NONE}
74659d
+    {15, ARM_ARCH_V8R},
74659d
+    {-1, ARM_ARCH_NONE}
74659d
 };
74659d
 
74659d
 /* Set an attribute if it has not already been set by the user.  */
74659d
@@ -26125,92 +26742,210 @@ aeabi_set_attribute_string (int tag, con
74659d
     bfd_elf_add_proc_attr_string (stdoutput, tag, value);
74659d
 }
74659d
 
74659d
-/* Set the public EABI object attributes.  */
74659d
-void
74659d
-aeabi_set_public_attributes (void)
74659d
+/* Return whether features in the *NEEDED feature set are available via
74659d
+   extensions for the architecture whose feature set is *ARCH_FSET.  */
74659d
+static bfd_boolean
74659d
+have_ext_for_needed_feat_p (const arm_feature_set *arch_fset,
74659d
+			    const arm_feature_set *needed)
74659d
 {
74659d
-  int arch;
74659d
-  char profile;
74659d
-  int virt_sec = 0;
74659d
-  int fp16_optional = 0;
74659d
-  arm_feature_set arm_arch = ARM_ARCH_NONE;
74659d
-  arm_feature_set flags;
74659d
-  arm_feature_set tmp;
74659d
-  arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
74659d
-  const cpu_arch_ver_table *p;
74659d
-
74659d
-  /* Choose the architecture based on the capabilities of the requested cpu
74659d
-     (if any) and/or the instructions actually used.  */
74659d
-  ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used);
74659d
-  ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
74659d
-  ARM_MERGE_FEATURE_SETS (flags, flags, selected_cpu);
74659d
+  int i, nb_allowed_archs;
74659d
+  arm_feature_set ext_fset;
74659d
+  const struct arm_option_extension_value_table *opt;
74659d
 
74659d
-  if (ARM_CPU_HAS_FEATURE (arm_arch_used, arm_arch_any))
74659d
-    ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v1);
74659d
+  ext_fset = arm_arch_none;
74659d
+  for (opt = arm_extensions; opt->name != NULL; opt++)
74659d
+    {
74659d
+      /* Extension does not provide any feature we need.  */
74659d
+      if (!ARM_CPU_HAS_FEATURE (*needed, opt->merge_value))
74659d
+	continue;
74659d
 
74659d
-  if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_any))
74659d
-    ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
74659d
+      nb_allowed_archs =
74659d
+	sizeof (opt->allowed_archs) / sizeof (opt->allowed_archs[0]);
74659d
+      for (i = 0; i < nb_allowed_archs; i++)
74659d
+	{
74659d
+	  /* Empty entry.  */
74659d
+	  if (ARM_FEATURE_EQUAL (opt->allowed_archs[i], arm_arch_any))
74659d
+	    break;
74659d
 
74659d
-  selected_cpu = flags;
74659d
+	  /* Extension is available, add it.  */
74659d
+	  if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *arch_fset))
74659d
+	    ARM_MERGE_FEATURE_SETS (ext_fset, ext_fset, opt->merge_value);
74659d
+	}
74659d
+    }
74659d
 
74659d
-  /* Allow the user to override the reported architecture.  */
74659d
-  if (object_arch)
74659d
+  /* Can we enable all features in *needed?  */
74659d
+  return ARM_FSET_CPU_SUBSET (*needed, ext_fset);
74659d
+}
74659d
+
74659d
+/* Select value for Tag_CPU_arch and Tag_CPU_arch_profile build attributes for
74659d
+   a given architecture feature set *ARCH_EXT_FSET including extension feature
74659d
+   set *EXT_FSET.  Selection logic used depend on EXACT_MATCH:
74659d
+   - if true, check for an exact match of the architecture modulo extensions;
74659d
+   - otherwise, select build attribute value of the first superset
74659d
+     architecture released so that results remains stable when new architectures
74659d
+     are added.
74659d
+   For -march/-mcpu=all the build attribute value of the most featureful
74659d
+   architecture is returned.  Tag_CPU_arch_profile result is returned in
74659d
+   PROFILE.  */
74659d
+static int
74659d
+get_aeabi_cpu_arch_from_fset (const arm_feature_set *arch_ext_fset,
74659d
+			      const arm_feature_set *ext_fset,
74659d
+			      char *profile, int exact_match)
74659d
+{
74659d
+  arm_feature_set arch_fset;
74659d
+  const cpu_arch_ver_table *p_ver, *p_ver_ret = NULL;
74659d
+
74659d
+  /* Select most featureful architecture with all its extensions if building
74659d
+     for -march=all as the feature sets used to set build attributes.  */
74659d
+  if (ARM_FEATURE_EQUAL (*arch_ext_fset, arm_arch_any))
74659d
     {
74659d
-      ARM_CLEAR_FEATURE (flags, flags, arm_arch_any);
74659d
-      ARM_MERGE_FEATURE_SETS (flags, flags, *object_arch);
74659d
+      /* Force revisiting of decision for each new architecture.  */
74659d
+      gas_assert (MAX_TAG_CPU_ARCH <= TAG_CPU_ARCH_V8M_MAIN);
74659d
+      *profile = 'A';
74659d
+      return TAG_CPU_ARCH_V8;
74659d
     }
74659d
 
74659d
-  /* We need to make sure that the attributes do not identify us as v6S-M
74659d
-     when the only v6S-M feature in use is the Operating System Extensions.  */
74659d
-  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_os))
74659d
-      if (!ARM_CPU_HAS_FEATURE (flags, arm_arch_v6m_only))
74659d
-	ARM_CLEAR_FEATURE (flags, flags, arm_ext_os);
74659d
+  ARM_CLEAR_FEATURE (arch_fset, *arch_ext_fset, *ext_fset);
74659d
 
74659d
-  tmp = flags;
74659d
-  arch = 0;
74659d
-  for (p = cpu_arch_ver; p->val; p++)
74659d
+  for (p_ver = cpu_arch_ver; p_ver->val != -1; p_ver++)
74659d
     {
74659d
-      if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
74659d
+      arm_feature_set known_arch_fset;
74659d
+
74659d
+      ARM_CLEAR_FEATURE (known_arch_fset, p_ver->flags, fpu_any);
74659d
+      if (exact_match)
74659d
 	{
74659d
-	  arch = p->val;
74659d
-	  arm_arch = p->flags;
74659d
-	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
74659d
+	  /* Base architecture match user-specified architecture and
74659d
+	     extensions, eg. ARMv6S-M matching -march=armv6-m+os.  */
74659d
+	  if (ARM_FEATURE_EQUAL (*arch_ext_fset, known_arch_fset))
74659d
+	    {
74659d
+	      p_ver_ret = p_ver;
74659d
+	      goto found;
74659d
+	    }
74659d
+	  /* Base architecture match user-specified architecture only
74659d
+	     (eg. ARMv6-M in the same case as above).  Record it in case we
74659d
+	     find a match with above condition.  */
74659d
+	  else if (p_ver_ret == NULL
74659d
+		   && ARM_FEATURE_EQUAL (arch_fset, known_arch_fset))
74659d
+	    p_ver_ret = p_ver;
74659d
 	}
74659d
-    }
74659d
+      else
74659d
+	{
74659d
 
74659d
-  /* The table lookup above finds the last architecture to contribute
74659d
-     a new feature.  Unfortunately, Tag13 is a subset of the union of
74659d
-     v6T2 and v7-M, so it is never seen as contributing a new feature.
74659d
-     We can not search for the last entry which is entirely used,
74659d
-     because if no CPU is specified we build up only those flags
74659d
-     actually used.  Perhaps we should separate out the specified
74659d
-     and implicit cases.  Avoid taking this path for -march=all by
74659d
-     checking for contradictory v7-A / v7-M features.  */
74659d
-  if (arch == TAG_CPU_ARCH_V7
74659d
-      && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
74659d
-      && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
74659d
-      && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
74659d
-    {
74659d
-      arch = TAG_CPU_ARCH_V7E_M;
74659d
-      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
74659d
+	  /* Architecture has all features wanted.  */
74659d
+	  if (ARM_FSET_CPU_SUBSET (arch_fset, known_arch_fset))
74659d
+	    {
74659d
+	      arm_feature_set added_fset;
74659d
+
74659d
+	      /* Compute features added by this architecture over the one
74659d
+		 recorded in p_ver_ret.  */
74659d
+	      if (p_ver_ret != NULL)
74659d
+		ARM_CLEAR_FEATURE (added_fset, known_arch_fset,
74659d
+				   p_ver_ret->flags);
74659d
+	      /* First architecture that match incl. with extensions, or the
74659d
+		 only difference in features over the recorded match is
74659d
+		 features that were optional and are now mandatory.  */
74659d
+	      if (p_ver_ret == NULL
74659d
+		  || ARM_FSET_CPU_SUBSET (added_fset, arch_fset))
74659d
+		{
74659d
+		  p_ver_ret = p_ver;
74659d
+		  goto found;
74659d
+		}
74659d
+	    }
74659d
+	  else if (p_ver_ret == NULL)
74659d
+	    {
74659d
+	      arm_feature_set needed_ext_fset;
74659d
+
74659d
+	      ARM_CLEAR_FEATURE (needed_ext_fset, arch_fset, known_arch_fset);
74659d
+
74659d
+	      /* Architecture has all features needed when using some
74659d
+		 extensions.  Record it and continue searching in case there
74659d
+		 exist an architecture providing all needed features without
74659d
+		 the need for extensions (eg. ARMv6S-M Vs ARMv6-M with
74659d
+		 OS extension).  */
74659d
+	      if (have_ext_for_needed_feat_p (&known_arch_fset,
74659d
+					      &needed_ext_fset))
74659d
+		p_ver_ret = p_ver;
74659d
+	    }
74659d
+	}
74659d
     }
74659d
 
74659d
-  ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
74659d
-  if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, arm_arch_any))
74659d
+  if (p_ver_ret == NULL)
74659d
+    return -1;
74659d
+
74659d
+found:
74659d
+  /* Tag_CPU_arch_profile.  */
74659d
+  if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v7a)
74659d
+      || ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v8)
74659d
+      || (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_atomics)
74659d
+	  && !ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v8m_m_only)))
74659d
+    *profile = 'A';
74659d
+  else if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v7r))
74659d
+    *profile = 'R';
74659d
+  else if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_m))
74659d
+    *profile = 'M';
74659d
+  else
74659d
+    *profile = '\0';
74659d
+  return p_ver_ret->val;
74659d
+}
74659d
+
74659d
+/* Set the public EABI object attributes.  */
74659d
+static void
74659d
+aeabi_set_public_attributes (void)
74659d
+{
74659d
+  char profile;
74659d
+  int arch = -1;
74659d
+  int virt_sec = 0;
74659d
+  int fp16_optional = 0;
74659d
+  int skip_exact_match = 0;
74659d
+  arm_feature_set flags, flags_arch, flags_ext;
74659d
+
74659d
+  /* Autodetection mode, choose the architecture based the instructions
74659d
+     actually used.  */
74659d
+  if (no_cpu_selected ())
74659d
     {
74659d
-      arch = TAG_CPU_ARCH_V8M_MAIN;
74659d
-      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
74659d
+      ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used);
74659d
+
74659d
+      if (ARM_CPU_HAS_FEATURE (arm_arch_used, arm_arch_any))
74659d
+	ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v1);
74659d
+
74659d
+      if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_any))
74659d
+	ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
74659d
+
74659d
+      /* Code run during relaxation relies on selected_cpu being set.  */
74659d
+      selected_cpu = flags;
74659d
     }
74659d
+  /* Otherwise, choose the architecture based on the capabilities of the
74659d
+     requested cpu.  */
74659d
+  else
74659d
+    flags = selected_cpu;
74659d
+  ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
74659d
 
74659d
-  /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
74659d
-     coming from ARMv8-A.  However, since ARMv8-A has more instructions than
74659d
-     ARMv8-M, -march=all must be detected as ARMv8-A.  */
74659d
-  if (arch == TAG_CPU_ARCH_V8M_MAIN
74659d
-      && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
74659d
+  /* Allow the user to override the reported architecture.  */
74659d
+  if (object_arch)
74659d
     {
74659d
-      arch = TAG_CPU_ARCH_V8;
74659d
-      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
74659d
+      ARM_CLEAR_FEATURE (flags_arch, *object_arch, fpu_any);
74659d
+      flags_ext = arm_arch_none;
74659d
     }
74659d
+  else
74659d
+    {
74659d
+      ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
74659d
+      flags_ext = dyn_mcpu_ext_opt ? *dyn_mcpu_ext_opt : arm_arch_none;
74659d
+      skip_exact_match = ARM_FEATURE_EQUAL (selected_cpu, arm_arch_any);
74659d
+    }
74659d
+
74659d
+  /* When this function is run again after relaxation has happened there is no
74659d
+     way to determine whether an architecture or CPU was specified by the user:
74659d
+     - selected_cpu is set above for relaxation to work;
74659d
+     - march_cpu_opt is not set if only -mcpu or .cpu is used;
74659d
+     - mcpu_cpu_opt is set to arm_arch_any for autodetection.
74659d
+     Therefore, if not in -march=all case we first try an exact match and fall
74659d
+     back to autodetection.  */
74659d
+  if (!skip_exact_match)
74659d
+    arch = get_aeabi_cpu_arch_from_fset (&flags_arch, &flags_ext, &profile, 1);
74659d
+  if (arch == -1)
74659d
+    arch = get_aeabi_cpu_arch_from_fset (&flags_arch, &flags_ext, &profile, 0);
74659d
+  if (arch == -1)
74659d
+    as_bad (_("no architecture contains all the instructions used\n"));
74659d
 
74659d
   /* Tag_CPU_name.  */
74659d
   if (selected_cpu_name[0])
74659d
@@ -26233,40 +26968,22 @@ aeabi_set_public_attributes (void)
74659d
   aeabi_set_attribute_int (Tag_CPU_arch, arch);
74659d
 
74659d
   /* Tag_CPU_arch_profile.  */
74659d
-  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
74659d
-      || ARM_CPU_HAS_FEATURE (flags, arm_ext_v8)
74659d
-      || (ARM_CPU_HAS_FEATURE (flags, arm_ext_atomics)
74659d
-	  && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m_m_only)))
74659d
-    profile = 'A';
74659d
-  else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7r))
74659d
-    profile = 'R';
74659d
-  else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_m))
74659d
-    profile = 'M';
74659d
-  else
74659d
-    profile = '\0';
74659d
-
74659d
   if (profile != '\0')
74659d
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
74659d
 
74659d
   /* Tag_DSP_extension.  */
74659d
-  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
74659d
-    {
74659d
-      arm_feature_set ext;
74659d
-
74659d
-      /* DSP instructions not in architecture.  */
74659d
-      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
74659d
-      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
74659d
-	aeabi_set_attribute_int (Tag_DSP_extension, 1);
74659d
-    }
74659d
+  if (dyn_mcpu_ext_opt && ARM_CPU_HAS_FEATURE (*dyn_mcpu_ext_opt, arm_ext_dsp))
74659d
+    aeabi_set_attribute_int (Tag_DSP_extension, 1);
74659d
 
74659d
+  ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
74659d
   /* Tag_ARM_ISA_use.  */
74659d
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
74659d
-      || arch == 0)
74659d
+      || ARM_FEATURE_ZERO (flags_arch))
74659d
     aeabi_set_attribute_int (Tag_ARM_ISA_use, 1);
74659d
 
74659d
   /* Tag_THUMB_ISA_use.  */
74659d
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v4t)
74659d
-      || arch == 0)
74659d
+      || ARM_FEATURE_ZERO (flags_arch))
74659d
     {
74659d
       int thumb_isa_use;
74659d
 
74659d
@@ -26348,9 +27065,7 @@ aeabi_set_public_attributes (void)
74659d
      by the base architecture.
74659d
 
74659d
      For new architectures we will have to check these tests.  */
74659d
-  gas_assert (arch <= TAG_CPU_ARCH_V8
74659d
-	      || (arch >= TAG_CPU_ARCH_V8M_BASE
74659d
-		  && arch <= TAG_CPU_ARCH_V8M_MAIN));
74659d
+  gas_assert (arch <= TAG_CPU_ARCH_V8M_MAIN);
74659d
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v8)
74659d
       || ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m))
74659d
     aeabi_set_attribute_int (Tag_DIV_use, 0);
74659d
@@ -26373,6 +27088,18 @@ aeabi_set_public_attributes (void)
74659d
     aeabi_set_attribute_int (Tag_Virtualization_use, virt_sec);
74659d
 }
74659d
 
74659d
+/* Post relaxation hook.  Recompute ARM attributes now that relaxation is
74659d
+   finished and free extension feature bits which will not be used anymore.  */
74659d
+void
74659d
+arm_md_post_relax (void)
74659d
+{
74659d
+  aeabi_set_public_attributes ();
74659d
+  XDELETE (dyn_mcpu_ext_opt);
74659d
+  dyn_mcpu_ext_opt = NULL;
74659d
+  XDELETE (dyn_march_ext_opt);
74659d
+  dyn_march_ext_opt = NULL;
74659d
+}
74659d
+
74659d
 /* Add the default contents for the .ARM.attributes section.  */
74659d
 void
74659d
 arm_md_end (void)
74659d
@@ -26405,7 +27132,10 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
74659d
     if (streq (opt->name, name))
74659d
       {
74659d
 	mcpu_cpu_opt = &opt->value;
74659d
-	selected_cpu = opt->value;
74659d
+	if (!dyn_mcpu_ext_opt)
74659d
+	  dyn_mcpu_ext_opt = XNEW (arm_feature_set);
74659d
+	*dyn_mcpu_ext_opt = opt->ext;
74659d
+	ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
74659d
 	if (opt->canonical_name)
74659d
 	  strcpy (selected_cpu_name, opt->canonical_name);
74659d
 	else
74659d
@@ -26417,6 +27147,8 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
74659d
 	    selected_cpu_name[i] = 0;
74659d
 	  }
74659d
 	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
74659d
+	if (dyn_mcpu_ext_opt)
74659d
+	  ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
74659d
 	*input_line_pointer = saved_char;
74659d
 	demand_empty_rest_of_line ();
74659d
 	return;
74659d
@@ -26447,9 +27179,11 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED
74659d
     if (streq (opt->name, name))
74659d
       {
74659d
 	mcpu_cpu_opt = &opt->value;
74659d
-	selected_cpu = opt->value;
74659d
+	XDELETE (dyn_mcpu_ext_opt);
74659d
+	dyn_mcpu_ext_opt = NULL;
74659d
+	selected_cpu = *mcpu_cpu_opt;
74659d
 	strcpy (selected_cpu_name, opt->name);
74659d
-	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
74659d
+	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
74659d
 	*input_line_pointer = saved_char;
74659d
 	demand_empty_rest_of_line ();
74659d
 	return;
74659d
@@ -26536,16 +27270,26 @@ s_arm_arch_extension (int ignored ATTRIB
74659d
 	    break;
74659d
 	  }
74659d
 
74659d
+	if (!dyn_mcpu_ext_opt)
74659d
+	  {
74659d
+	    dyn_mcpu_ext_opt = XNEW (arm_feature_set);
74659d
+	    *dyn_mcpu_ext_opt = arm_arch_none;
74659d
+	  }
74659d
 	if (adding_value)
74659d
-	  ARM_MERGE_FEATURE_SETS (selected_cpu, selected_cpu,
74659d
+	  ARM_MERGE_FEATURE_SETS (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
74659d
 				  opt->merge_value);
74659d
 	else
74659d
-	  ARM_CLEAR_FEATURE (selected_cpu, selected_cpu, opt->clear_value);
74659d
+	  ARM_CLEAR_FEATURE (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
74659d
+			     opt->clear_value);
74659d
 
74659d
-	mcpu_cpu_opt = &selected_cpu;
74659d
-	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
74659d
+	ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
74659d
+	ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
74659d
 	*input_line_pointer = saved_char;
74659d
 	demand_empty_rest_of_line ();
74659d
+	/* Allowing Thumb division instructions for ARMv7 in autodetection rely
74659d
+	   on this return so that duplicate extensions (extensions with the
74659d
+	   same name as a previous extension in the list) are not considered
74659d
+	   for command-line parsing.  */
74659d
 	return;
74659d
       }
74659d
 
74659d
@@ -26576,6 +27320,8 @@ s_arm_fpu (int ignored ATTRIBUTE_UNUSED)
74659d
       {
74659d
 	mfpu_opt = &opt->value;
74659d
 	ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
74659d
+	if (dyn_mcpu_ext_opt)
74659d
+	  ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
74659d
 	*input_line_pointer = saved_char;
74659d
 	demand_empty_rest_of_line ();
74659d
 	return;
74659d
diff -rup binutils.orig/gas/config/tc-arm.h binutils-2.27/gas/config/tc-arm.h
74659d
--- binutils.orig/gas/config/tc-arm.h	2017-08-09 10:26:30.032741952 +0100
74659d
+++ binutils-2.27/gas/config/tc-arm.h	2017-08-09 11:17:35.442400257 +0100
74659d
@@ -118,8 +118,8 @@ extern bfd_boolean tc_start_label_withou
74659d
 extern void arm_md_end (void);
74659d
 bfd_boolean arm_is_eabi (void);
74659d
 
74659d
-#define md_post_relax_hook		aeabi_set_public_attributes ()
74659d
-extern void aeabi_set_public_attributes (void);
74659d
+#define md_post_relax_hook		arm_md_post_relax ()
74659d
+extern void arm_md_post_relax (void);
74659d
 #endif
74659d
 
74659d
 /* NOTE: The fake label creation in stabs.c:s_stab_generic() has
74659d
diff -rup binutils.orig/gas/doc/c-arm.texi binutils-2.27/gas/doc/c-arm.texi
74659d
--- binutils.orig/gas/doc/c-arm.texi	2017-08-09 10:26:30.039741874 +0100
74659d
+++ binutils-2.27/gas/doc/c-arm.texi	2017-08-09 10:28:00.216732329 +0100
74659d
@@ -172,6 +172,7 @@ been added, again in ascending alphabeti
74659d
 The following extensions are currently supported:
74659d
 @code{crc}
74659d
 @code{crypto} (Cryptography Extensions for v8-A architecture, implies @code{fp+simd}),
74659d
+@code{dotprod} (Dot Product Extensions for v8.2-A architecture, implies @code{fp+simd}),
74659d
 @code{fp} (Floating Point Extensions for v8-A architecture),
74659d
 @code{idiv} (Integer Divide Extensions for v7-A and v7-R architectures),
74659d
 @code{iwmmxt},
74659d
@@ -185,7 +186,7 @@ architectures),
74659d
 @code{simd} (Advanced SIMD Extensions for v8-A architecture, implies @code{fp}),
74659d
 @code{virt} (Virtualization Extensions for v7-A architecture, implies
74659d
 @code{idiv}),
74659d
-@code{pan} (Priviliged Access Never Extensions for v8-A architecture),
74659d
+@code{pan} (Privileged Access Never Extensions for v8-A architecture),
74659d
 @code{ras} (Reliability, Availability and Serviceability extensions
74659d
 for v8-A architecture),
74659d
 @code{rdma} (ARMv8.1 Advanced SIMD extensions for v8-A architecture, implies
74659d
@@ -230,6 +231,8 @@ names are recognized:
74659d
 @code{armv8-a},
74659d
 @code{armv8.1-a},
74659d
 @code{armv8.2-a},
74659d
+@code{armv8.3-a},
74659d
+@code{armv8-r},
74659d
 @code{iwmmxt}
74659d
 @code{iwmmxt2}
74659d
 and
74659d
@@ -281,7 +284,7 @@ The following format options are recogni
74659d
 @code{arm1136jf-s},
74659d
 @code{maverick},
74659d
 @code{neon},
74659d
-@code{neon-vfpv4},
74659d
+@code{neon-vfpv3},
74659d
 @code{neon-fp-armv8},
74659d
 @code{crypto-neon-fp-armv8},
74659d
 @code{neon-fp-armv8.1}
74659d
@@ -293,7 +296,7 @@ also affects the way in which the @code{
74659d
 when assembling little-endian code.
74659d
 
74659d
 The default is dependent on the processor selected.  For Architecture 5 or
74659d
-later, the default is to assembler for VFP instructions; for earlier
74659d
+later, the default is to assemble for VFP instructions; for earlier
74659d
 architectures the default is to assemble for FPA instructions.
74659d
 
74659d
 @cindex @code{-mthumb} command line option, ARM
74659d
@@ -931,7 +934,7 @@ between Arm and Thumb instructions and s
74659d
 interworking is not going to be performed.  The presence of this
74659d
 directive also implies @code{.thumb}
74659d
 
74659d
-This directive is not neccessary when generating EABI objects.  On these
74659d
+This directive is not necessary when generating EABI objects.  On these
74659d
 targets the encoding is implicit when generating Thumb code.
74659d
 
74659d
 @cindex @code{.thumb_set} directive, ARM
74659d
@@ -966,7 +969,7 @@ should only be done if it is really nece
74659d
 
74659d
 @cindex @code{.unwind_raw} directive, ARM
74659d
 @item .unwind_raw @var{offset}, @var{byte1}, @dots{}
74659d
-Insert one of more arbitary unwind opcode bytes, which are known to adjust
74659d
+Insert one of more arbitrary unwind opcode bytes, which are known to adjust
74659d
 the stack pointer by @var{offset} bytes.
74659d
 
74659d
 For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d	2017-08-09 10:26:30.056741684 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr-base.d	2017-08-09 11:51:59.357287965 +0100
74659d
@@ -6,27 +6,71 @@
74659d
 .*: +file format .*arm.*
74659d
 
74659d
 Disassembly of section .text:
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d	2017-08-09 10:26:30.056741684 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr-main.d	2017-08-09 11:52:33.776902849 +0100
74659d
@@ -6,27 +6,71 @@
74659d
 .*: +file format .*arm.*
74659d
 
74659d
 Disassembly of section .text:
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr.s binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/archv8m-cmse-msr.s	2017-08-09 10:26:30.056741684 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/archv8m-cmse-msr.s	2017-08-09 11:50:44.728124484 +0100
74659d
@@ -1,25 +1,109 @@
74659d
 T:
74659d
-msr   MSP, r0
74659d
-msr   MSP_S, r0
74659d
-msr   MSP_NS, r0
74659d
-msr   PSP, r0
74659d
-msr   PSP_S, r0
74659d
-msr   PSP_NS, r0
74659d
-msr   msp, r0
74659d
-msr   msp_s, r0
74659d
-msr   msp_ns, r0
74659d
-msr   psp, r0
74659d
-msr   psp_s, r0
74659d
-msr   psp_ns, r0
74659d
+## MRS ##
74659d
+
74659d
+# MSP
74659d
 mrs   r0, MSP
74659d
-mrs   r0, MSP_S
74659d
 mrs   r0, MSP_NS
74659d
-mrs   r0, PSP
74659d
-mrs   r0, PSP_S
74659d
-mrs   r0, PSP_NS
74659d
 mrs   r0, msp
74659d
-mrs   r0, msp_s
74659d
 mrs   r0, msp_ns
74659d
-mrs   r0, psp
74659d
-mrs   r0, psp_s
74659d
-mrs   r0, psp_ns
74659d
+
74659d
+# PSP
74659d
+mrs   r1, PSP
74659d
+mrs   r1, PSP_NS
74659d
+mrs   r1, psp
74659d
+mrs   r1, psp_ns
74659d
+
74659d
+# MSPLIM
74659d
+mrs   r2, MSPLIM
74659d
+mrs   r2, MSPLIM_NS
74659d
+mrs   r2, msplim
74659d
+mrs   r2, msplim_ns
74659d
+
74659d
+# PSPLIM
74659d
+mrs   r3, PSPLIM
74659d
+mrs   r3, PSPLIM_NS
74659d
+mrs   r3, psplim
74659d
+mrs   r3, psplim_ns
74659d
+
74659d
+# PRIMASK
74659d
+mrs   r4, PRIMASK
74659d
+mrs   r4, PRIMASK_NS
74659d
+mrs   r4, primask
74659d
+mrs   r4, primask_ns
74659d
+
74659d
+# BASEPRI
74659d
+mrs   r5, BASEPRI
74659d
+mrs   r5, BASEPRI_NS
74659d
+mrs   r5, basepri
74659d
+mrs   r5, basepri_ns
74659d
+
74659d
+# FAULTMASK
74659d
+mrs   r6, FAULTMASK
74659d
+mrs   r6, FAULTMASK_NS
74659d
+mrs   r6, faultmask
74659d
+mrs   r6, faultmask_ns
74659d
+
74659d
+# CONTROL
74659d
+mrs   r7, CONTROL
74659d
+mrs   r7, CONTROL_NS
74659d
+mrs   r7, control
74659d
+mrs   r7, control_ns
74659d
+
74659d
+# SP_NS
74659d
+mrs   r8, SP_NS
74659d
+mrs   r8, sp_ns
74659d
+
74659d
+
74659d
+## MSR ##
74659d
+
74659d
+# MSP
74659d
+msr   MSP,	    r0
74659d
+msr   MSP_NS,	    r0
74659d
+msr   msp,	    r0
74659d
+msr   msp_ns,	    r0
74659d
+
74659d
+# PSP
74659d
+msr   PSP,	    r1
74659d
+msr   PSP_NS,	    r1
74659d
+msr   psp,	    r1
74659d
+msr   psp_ns,	    r1
74659d
+
74659d
+# MSPLIM
74659d
+msr   MSPLIM,	    r2
74659d
+msr   MSPLIM_NS,    r2
74659d
+msr   msplim,	    r2
74659d
+msr   msplim_ns,    r2
74659d
+
74659d
+# PSPLIM
74659d
+msr   PSPLIM,	    r3
74659d
+msr   PSPLIM_NS,    r3
74659d
+msr   psplim,	    r3
74659d
+msr   psplim_ns,    r3
74659d
+
74659d
+# PRIMASK
74659d
+msr   PRIMASK,	    r4
74659d
+msr   PRIMASK_NS,   r4
74659d
+msr   primask,	    r4
74659d
+msr   primask_ns,   r4
74659d
+
74659d
+# BASEPRI
74659d
+msr   BASEPRI,	    r5
74659d
+msr   BASEPRI_NS,   r5
74659d
+msr   basepri,	    r5
74659d
+msr   basepri_ns,   r5
74659d
+
74659d
+# FAULTMASK
74659d
+msr   FAULTMASK,    r6
74659d
+msr   FAULTMASK_NS, r6
74659d
+msr   faultmask,    r6
74659d
+msr   faultmask_ns, r6
74659d
+
74659d
+# CONTROL
74659d
+msr   CONTROL,	    r7
74659d
+msr   CONTROL_NS,   r7
74659d
+msr   control,	    r7
74659d
+msr   control_ns,   r7
74659d
+
74659d
+# SP_NS
74659d
+msr   SP_NS,	    r8
74659d
+msr   sp_ns,	    r8
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/archv8m-main-dsp-4.d binutils-2.27/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/archv8m-main-dsp-4.d	2017-08-09 10:26:30.056741684 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/archv8m-main-dsp-4.d	2017-08-09 11:54:37.162524973 +0100
74659d
@@ -6,27 +6,71 @@
74659d
 .*: +file format .*arm.*
74659d
 
74659d
 Disassembly of section .text:
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
-0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8809 	msr	PSP, r0
74659d
-0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
-0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
74659d
 0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
74659d
-0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 8109 	mrs	r1, PSP
74659d
+0+.* <[^>]*> f3ef 8189 	mrs	r1, PSP_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 820a 	mrs	r2, MSPLIM
74659d
+0+.* <[^>]*> f3ef 828a 	mrs	r2, MSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 830b 	mrs	r3, PSPLIM
74659d
+0+.* <[^>]*> f3ef 838b 	mrs	r3, PSPLIM_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8410 	mrs	r4, PRIMASK
74659d
+0+.* <[^>]*> f3ef 8490 	mrs	r4, PRIMASK_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8511 	mrs	r5, BASEPRI
74659d
+0+.* <[^>]*> f3ef 8591 	mrs	r5, BASEPRI_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8613 	mrs	r6, FAULTMASK
74659d
+0+.* <[^>]*> f3ef 8693 	mrs	r6, FAULTMASK_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8714 	mrs	r7, CONTROL
74659d
+0+.* <[^>]*> f3ef 8794 	mrs	r7, CONTROL_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f3ef 8898 	mrs	r8, SP_NS
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
74659d
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f381 8809 	msr	PSP, r1
74659d
+0+.* <[^>]*> f381 8889 	msr	PSP_NS, r1
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f382 880a 	msr	MSPLIM, r2
74659d
+0+.* <[^>]*> f382 888a 	msr	MSPLIM_NS, r2
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f383 880b 	msr	PSPLIM, r3
74659d
+0+.* <[^>]*> f383 888b 	msr	PSPLIM_NS, r3
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f384 8810 	msr	PRIMASK, r4
74659d
+0+.* <[^>]*> f384 8890 	msr	PRIMASK_NS, r4
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f385 8811 	msr	BASEPRI, r5
74659d
+0+.* <[^>]*> f385 8891 	msr	BASEPRI_NS, r5
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f386 8813 	msr	FAULTMASK, r6
74659d
+0+.* <[^>]*> f386 8893 	msr	FAULTMASK_NS, r6
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f387 8814 	msr	CONTROL, r7
74659d
+0+.* <[^>]*> f387 8894 	msr	CONTROL_NS, r7
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
+0+.* <[^>]*> f388 8898 	msr	SP_NS, r8
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv1.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv1.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv1.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv1.d	2017-08-09 11:56:00.992588823 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "1"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv2a.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2a.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv2a.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2a.d	2017-08-09 11:56:27.548292268 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "2A"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv2.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv2.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2.d	2017-08-09 11:56:09.713491434 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "2"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv2s.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2s.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv2s.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv2s.d	2017-08-09 11:56:35.794200184 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "2S"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv3.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv3.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv3.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv3.d	2017-08-09 11:56:52.435014353 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "3"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/attr-march-armv3m.d binutils-2.27/gas/testsuite/gas/arm/attr-march-armv3m.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/attr-march-armv3m.d	2017-08-09 10:26:30.058741661 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/attr-march-armv3m.d	2017-08-09 11:56:57.715955379 +0100
74659d
@@ -8,5 +8,4 @@
74659d
 Attribute Section: aeabi
74659d
 File Attributes
74659d
   Tag_CPU_name: "3M"
74659d
-  Tag_CPU_arch: v4
74659d
   Tag_ARM_ISA_use: Yes
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/ldr-bad.l binutils-2.27/gas/testsuite/gas/arm/ldr-bad.l
74659d
--- binutils.orig/gas/testsuite/gas/arm/ldr-bad.l	2017-08-09 10:26:30.062741616 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/ldr-bad.l	2017-08-09 11:59:45.777078600 +0100
74659d
@@ -1,7 +1,7 @@
74659d
 [^:]*: Assembler messages:
74659d
 [^:]*:5: Warning: destination register same as write-back base
74659d
-[^:]*:9: Error: ldr to register 15 must be 4-byte alligned -- `ldr r15,\[r15,#5\]'
74659d
-[^:]*:12: Error: ldr to register 15 must be 4-byte alligned -- `ldr r15,.-0xab7'
74659d
+[^:]*:9: Error: ldr to register 15 must be 4-byte aligned -- `ldr r15,\[r15,#5\]'
74659d
+[^:]*:12: Error: ldr to register 15 must be 4-byte aligned -- `ldr r15,.-0xab7'
74659d
 [^:]*:15: Warning: destination register same as write-back base
74659d
 [^:]*:16: Error: cannot use register index with PC-relative addressing -- `ldr r2,\[r15,r2\]!'
74659d
 [^:]*:19: Error: cannot use register index with PC-relative addressing -- `ldr r1,\[r1,r15\]'
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/ldr-t-bad.l binutils-2.27/gas/testsuite/gas/arm/ldr-t-bad.l
74659d
--- binutils.orig/gas/testsuite/gas/arm/ldr-t-bad.l	2017-08-09 10:26:30.062741616 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/ldr-t-bad.l	2017-08-09 12:00:06.268849764 +0100
74659d
@@ -1,9 +1,9 @@
74659d
 [^:]*: Assembler messages:
74659d
 [^:]*:8: Error: registers may not be the same -- `ldr r1,\[r1,#5\]!'
74659d
-[^:]*:12: Error: ldr to register 15 must be 4-byte alligned -- `ldr r15,\[r15,#5\]'
74659d
+[^:]*:12: Error: ldr to register 15 must be 4-byte aligned -- `ldr r15,\[r15,#5\]'
74659d
 [^:]*:16: Error: branch must be last instruction in IT block -- `ldrge r15,\[r15,#4\]'
74659d
 [^:]*:25: Error: branch must be last instruction in IT block -- `ldrge r15,.0x4'
74659d
-[^:]*:30: Error: ldr to register 15 must be 4-byte alligned -- `ldr r15,.-0xab7'
74659d
+[^:]*:30: Error: ldr to register 15 must be 4-byte aligned -- `ldr r15,.-0xab7'
74659d
 [^:]*:36: Error: branch must be last instruction in IT block -- `ldrge r15,\[r15,r1\]'
74659d
 [^:]*:41: Error: r13 not allowed here -- `ldr r1,\[r2,r13\]'
74659d
 [^:]*:42: Error: r15 not allowed here -- `ldr r2,\[r2,r15\]'
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/ld-sp-warn.l binutils-2.27/gas/testsuite/gas/arm/ld-sp-warn.l
74659d
--- binutils.orig/gas/testsuite/gas/arm/ld-sp-warn.l	2017-08-09 10:26:30.062741616 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/ld-sp-warn.l	2017-08-09 11:59:02.223564973 +0100
74659d
@@ -2,4 +2,3 @@
74659d
 [^:]*:3: Warning: This instruction may be unpredictable if executed on M-profile cores with interrupts enabled.
74659d
 [^:]*:4: Warning: This instruction may be unpredictable if executed on M-profile cores with interrupts enabled.
74659d
 [^:]*:7: Error: Thumb does not support register indexing with writeback -- `ldr r1,\[r0,r1\]!'
74659d
-[^:]*:8: Error: r13 not allowed here -- `ldrsb sp,\[r2,#16\]!'
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/strex-bad-t.d binutils-2.27/gas/testsuite/gas/arm/strex-bad-t.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/strex-bad-t.d	2017-08-09 10:26:30.066741571 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/strex-bad-t.d	2017-08-09 12:01:22.679996462 +0100
74659d
@@ -1,3 +1,4 @@
74659d
 # name: Bad addressing modes STREXH/STREXB. - THUMB
74659d
+# as: -march=armv7-a
74659d
 # error-output: strex-bad-t.l
74659d
 
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d binutils-2.27/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d	2017-08-09 10:26:30.067741560 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d	2017-08-09 11:57:45.943416812 +0100
74659d
@@ -6,19 +6,23 @@
74659d
 .*: +file format .*arm.*
74659d
 
74659d
 Disassembly of section \.text:
74659d
-0[0-9a-f]+ <[^>]+> 2000[[:space:]]+movs[[:space:]]+r0, #0.*
74659d
-0[0-9a-f]+ <[^>]+> 2108[[:space:]]+movs[[:space:]]+r1, #8.*
74659d
-0[0-9a-f]+ <[^>]+> 2251[[:space:]]+movs[[:space:]]+r2, #81.*
74659d
-0[0-9a-f]+ <[^>]+> 231f[[:space:]]+movs[[:space:]]+r3, #31.*
74659d
-0[0-9a-f]+ <[^>]+> 242f[[:space:]]+movs[[:space:]]+r4, #47.*
74659d
-0[0-9a-f]+ <[^>]+> 253f[[:space:]]+movs[[:space:]]+r5, #63.*
74659d
-0[0-9a-f]+ <[^>]+> 2680[[:space:]]+movs[[:space:]]+r6, #128.*
74659d
-0[0-9a-f]+ <[^>]+> 27ff[[:space:]]+movs[[:space:]]+r7, #255.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 0000[[:space:]]+mov\.w[[:space:]]+r0, #0.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 0108[[:space:]]+mov\.w[[:space:]]+r1, #8.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 0251[[:space:]]+mov\.w[[:space:]]+r2, #81.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 031f[[:space:]]+mov\.w[[:space:]]+r3, #31.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 042f[[:space:]]+mov\.w[[:space:]]+r4, #47.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 053f[[:space:]]+mov\.w[[:space:]]+r5, #63.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 0680[[:space:]]+mov\.w[[:space:]]+r6, #128.*
74659d
+0[0-9a-f]+ <[^>]+> f04f 07ff[[:space:]]+mov\.w[[:space:]]+r7, #255.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0800[[:space:]]+mov\.w[[:space:]]+r8, #0.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0908[[:space:]]+mov\.w[[:space:]]+r9, #8.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0a51[[:space:]]+mov\.w[[:space:]]+sl, #81.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0b1f[[:space:]]+mov\.w[[:space:]]+fp, #31.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0c2f[[:space:]]+mov\.w[[:space:]]+ip, #47.*
74659d
-0[0-9a-f]+ <[^>]+> f04f 0d3f[[:space:]]+mov\.w[[:space:]]+sp, #63.*
74659d
 0[0-9a-f]+ <[^>]+> f04f 0e80[[:space:]]+mov\.w[[:space:]]+lr, #128.*
74659d
-0[0-9a-f]+ <[^>]+> f04f 0fff[[:space:]]+mov\.w[[:space:]]+pc, #255.*
74659d
+0[0-9a-f]+ <[^>]+> f64f 78ff[[:space:]]+movw[[:space:]]+r8, #65535.*
74659d
+0[0-9a-f]+ <[^>]+> f24f 09f0[[:space:]]+movw[[:space:]]+r9, #61680.*
74659d
+0[0-9a-f]+ <[^>]+> f8df d004[[:space:]]+ldr\.w[[:space:]]+sp, \[pc, #4\].*
74659d
+0[0-9a-f]+ <[^>]+> f8df f004[[:space:]]+ldr\.w[[:space:]]+pc, \[pc, #4\].*
74659d
+0[0-9a-f]+ <[^>]+> 0000003f[[:space:]]+.word[[:space:]]+0x0000003f.*
74659d
+0[0-9a-f]+ <[^>]+> 000000ff[[:space:]]+.word[[:space:]]+0x000000ff.*
74659d
diff -rup binutils.orig/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.s binutils-2.27/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.s	2017-08-09 10:26:30.067741560 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.s	2017-08-09 11:58:27.561952048 +0100
74659d
@@ -2,8 +2,8 @@
74659d
 	.syntax unified
74659d
 	.thumb_func
74659d
 thumb2_ldr:
74659d
-	# These can be encoded into movs since constant is small
74659d
-	# And register can be encoded in 3 bits
74659d
+	# These must be encoded into mov.w despite constant and register being
74659d
+	# small enough as ldr should not generate a flag-setting instruction.
74659d
 	ldr r0,=0x00
74659d
 	ldr r1,=0x08
74659d
 	ldr r2,=0x51
74659d
@@ -12,13 +12,19 @@ thumb2_ldr:
74659d
 	ldr r5,=0x3F
74659d
 	ldr r6,=0x80
74659d
 	ldr r7,=0xFF
74659d
-	# These shall be encoded into mov.w
74659d
-	# Since register cannot be encoded in 3 bits
74659d
+	# These shall be encoded into mov.w since register cannot be encoded in
74659d
+	# 3 bits
74659d
 	ldr r8,=0x00
74659d
 	ldr r9,=0x08
74659d
 	ldr r10,=0x51
74659d
 	ldr r11,=0x1F
74659d
 	ldr r12,=0x2F
74659d
-	ldr r13,=0x3F
74659d
 	ldr r14,=0x80
74659d
+	# These shall be encoded into movw since immediate cannot be encoded
74659d
+	# with mov.w
74659d
+	ldr r8,=0xFFFF
74659d
+	ldr r9,=0xF0F0
74659d
+	# These should be encoded as ldr since mov immediate is unpredictable
74659d
+	# for sp and pc
74659d
+	ldr r13,=0x3F
74659d
 	ldr r15,=0xFF
74659d
diff -rup binutils.orig/include/opcode/arm.h binutils-2.27/include/opcode/arm.h
74659d
--- binutils.orig/include/opcode/arm.h	2017-08-09 10:26:30.209739969 +0100
74659d
+++ binutils-2.27/include/opcode/arm.h	2017-08-09 11:11:08.487736404 +0100
74659d
@@ -64,6 +64,8 @@
74659d
 #define ARM_EXT2_FP16_INST 0x00000020	/* ARM V8.2A FP16 instructions.  */
74659d
 #define ARM_EXT2_V8M_MAIN  0x00000040	/* ARMv8-M Mainline.  */
74659d
 #define ARM_EXT2_RAS	 0x00000080	/* RAS extension.  */
74659d
+#define ARM_EXT2_V8_3A	 0x00000100	/* ARM V8.3A.  */
74659d
+#define ARM_EXT2_V8A	 0x00000200	/* ARMv8-A.  */
74659d
 
74659d
 /* Co-processor space extensions.  */
74659d
 #define ARM_CEXT_XSCALE   0x00000001	/* Allow MIA etc.          */
74659d
@@ -92,6 +94,7 @@
74659d
 #define CRC_EXT_ARMV8	 0x00004000	/* CRC32 for ARMv8.  */
74659d
 #define FPU_VFP_EXT_ARMV8xD 0x00002000	/* Single-precision FP for ARMv8.  */
74659d
 #define FPU_NEON_EXT_RDMA 0x00001000     /* v8.1 Adv.SIMD extensions.  */
74659d
+#define FPU_NEON_EXT_DOTPROD 0x00000800	/* Dot Product extension.  */
74659d
 
74659d
 /* Architectures are the sum of the base and extensions.  The ARM ARM (rev E)
74659d
    defines the following: ARMv3, ARMv3M, ARMv4xM, ARMv4, ARMv4TxM, ARMv4T,
74659d
@@ -105,12 +108,14 @@
74659d
 #define ARM_AEXT_V3M	(ARM_AEXT_V3	| ARM_EXT_V3M)
74659d
 #define ARM_AEXT_V4xM	(ARM_AEXT_V3	| ARM_EXT_V4)
74659d
 #define ARM_AEXT_V4	(ARM_AEXT_V3M	| ARM_EXT_V4)
74659d
-#define ARM_AEXT_V4TxM	(ARM_AEXT_V4xM	| ARM_EXT_V4T)
74659d
-#define ARM_AEXT_V4T	(ARM_AEXT_V4	| ARM_EXT_V4T)
74659d
+#define ARM_AEXT_V4TxM	(ARM_AEXT_V4xM	| ARM_EXT_V4T | ARM_EXT_OS)
74659d
+#define ARM_AEXT_V4T	(ARM_AEXT_V4	| ARM_EXT_V4T | ARM_EXT_OS)
74659d
 #define ARM_AEXT_V5xM	(ARM_AEXT_V4xM	| ARM_EXT_V5)
74659d
 #define ARM_AEXT_V5	(ARM_AEXT_V4	| ARM_EXT_V5)
74659d
-#define ARM_AEXT_V5TxM	(ARM_AEXT_V5xM	| ARM_EXT_V4T | ARM_EXT_V5T)
74659d
-#define ARM_AEXT_V5T	(ARM_AEXT_V5	| ARM_EXT_V4T | ARM_EXT_V5T)
74659d
+#define ARM_AEXT_V5TxM	(ARM_AEXT_V5xM	| ARM_EXT_V4T | ARM_EXT_V5T \
74659d
+			 | ARM_EXT_OS)
74659d
+#define ARM_AEXT_V5T	(ARM_AEXT_V5	| ARM_EXT_V4T | ARM_EXT_V5T \
74659d
+			 | ARM_EXT_OS)
74659d
 #define ARM_AEXT_V5TExP	(ARM_AEXT_V5T	| ARM_EXT_V5ExP)
74659d
 #define ARM_AEXT_V5TE	(ARM_AEXT_V5TExP | ARM_EXT_V5E)
74659d
 #define ARM_AEXT_V5TEJ	(ARM_AEXT_V5TE	| ARM_EXT_V5J)
74659d
@@ -135,7 +140,7 @@
74659d
 #define ARM_AEXT_V6M_ONLY \
74659d
   ((ARM_EXT_BARRIER | ARM_EXT_V6M | ARM_EXT_THUMB_MSR) & ~(ARM_AEXT_NOTM))
74659d
 #define ARM_AEXT_V6M \
74659d
-  ((ARM_AEXT_V6K | ARM_AEXT_V6M_ONLY) & ~(ARM_AEXT_NOTM))
74659d
+  ((ARM_AEXT_V6K | ARM_AEXT_V6M_ONLY) & ~(ARM_AEXT_NOTM | ARM_EXT_OS))
74659d
 #define ARM_AEXT_V6SM (ARM_AEXT_V6M | ARM_EXT_OS)
74659d
 #define ARM_AEXT_V7M \
74659d
   ((ARM_AEXT_V7_ARM | ARM_EXT_V6M | ARM_EXT_V7M | ARM_EXT_DIV) \
74659d
@@ -146,13 +151,19 @@
74659d
 #define ARM_AEXT_V8A \
74659d
   (ARM_AEXT_V7A | ARM_EXT_MP | ARM_EXT_SEC | ARM_EXT_DIV | ARM_EXT_ADIV \
74659d
    | ARM_EXT_VIRT | ARM_EXT_V8)
74659d
-#define ARM_AEXT2_V8A	(ARM_EXT2_V6T2_V8M | ARM_EXT2_ATOMICS)
74659d
+#define ARM_AEXT2_V8AR	(ARM_EXT2_V6T2_V8M | ARM_EXT2_ATOMICS)
74659d
+#define ARM_AEXT2_V8A	(ARM_AEXT2_V8AR | ARM_EXT2_V8A)
74659d
 #define ARM_AEXT2_V8_1A	(ARM_AEXT2_V8A | ARM_EXT2_PAN)
74659d
 #define ARM_AEXT2_V8_2A	(ARM_AEXT2_V8_1A | ARM_EXT2_V8_2A | ARM_EXT2_RAS)
74659d
+#define ARM_AEXT2_V8_3A	(ARM_AEXT2_V8_2A | ARM_EXT2_V8_3A)
74659d
 #define ARM_AEXT_V8M_BASE (ARM_AEXT_V6SM | ARM_EXT_DIV)
74659d
 #define ARM_AEXT_V8M_MAIN ARM_AEXT_V7M
74659d
+#define ARM_AEXT_V8M_MAIN_DSP ARM_AEXT_V7EM
74659d
 #define ARM_AEXT2_V8M	(ARM_EXT2_V8M | ARM_EXT2_ATOMICS | ARM_EXT2_V6T2_V8M)
74659d
 #define ARM_AEXT2_V8M_MAIN (ARM_AEXT2_V8M | ARM_EXT2_V8M_MAIN)
74659d
+#define ARM_AEXT2_V8M_MAIN_DSP ARM_AEXT2_V8M_MAIN
74659d
+#define ARM_AEXT_V8R	ARM_AEXT_V8A
74659d
+#define ARM_AEXT2_V8R	ARM_AEXT2_V8AR
74659d
 
74659d
 /* Processors with specific extensions in the co-processor space.  */
74659d
 #define ARM_ARCH_XSCALE	ARM_FEATURE_LOW (ARM_AEXT_V5TE, ARM_CEXT_XSCALE)
74659d
@@ -224,6 +235,8 @@
74659d
 #define FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_1 \
74659d
   ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8 | FPU_NEON_ARMV8 | FPU_VFP_ARMV8 \
74659d
 		      | FPU_NEON_EXT_RDMA)
74659d
+#define FPU_ARCH_DOTPROD_NEON_VFP_ARMV8 \
74659d
+  ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD | FPU_NEON_ARMV8 | FPU_VFP_ARMV8)
74659d
 
74659d
 
74659d
 #define FPU_ARCH_ENDIAN_PURE ARM_FEATURE_COPROC (FPU_ENDIAN_PURE)
74659d
@@ -263,18 +276,26 @@
74659d
 #define ARM_ARCH_V7M	ARM_FEATURE_CORE (ARM_AEXT_V7M, ARM_EXT2_V6T2_V8M)
74659d
 #define ARM_ARCH_V7EM	ARM_FEATURE_CORE (ARM_AEXT_V7EM, ARM_EXT2_V6T2_V8M)
74659d
 #define ARM_ARCH_V8A	ARM_FEATURE_CORE (ARM_AEXT_V8A, ARM_AEXT2_V8A)
74659d
+#define ARM_ARCH_V8A_CRC ARM_FEATURE (ARM_AEXT_V8A, ARM_AEXT2_V8A, \
74659d
+				      CRC_EXT_ARMV8)
74659d
 #define ARM_ARCH_V8_1A	ARM_FEATURE (ARM_AEXT_V8A, ARM_AEXT2_V8_1A,	\
74659d
 				     CRC_EXT_ARMV8 | FPU_NEON_EXT_RDMA)
74659d
 #define ARM_ARCH_V8_2A	ARM_FEATURE (ARM_AEXT_V8A, ARM_AEXT2_V8_2A,	\
74659d
 				     CRC_EXT_ARMV8 | FPU_NEON_EXT_RDMA)
74659d
+#define ARM_ARCH_V8_3A	ARM_FEATURE (ARM_AEXT_V8A, ARM_AEXT2_V8_3A,	\
74659d
+				     CRC_EXT_ARMV8 | FPU_NEON_EXT_RDMA)
74659d
 #define ARM_ARCH_V8M_BASE ARM_FEATURE_CORE (ARM_AEXT_V8M_BASE, ARM_AEXT2_V8M)
74659d
 #define ARM_ARCH_V8M_MAIN ARM_FEATURE_CORE (ARM_AEXT_V8M_MAIN, \
74659d
 					    ARM_AEXT2_V8M_MAIN)
74659d
+#define ARM_ARCH_V8M_MAIN_DSP ARM_FEATURE_CORE (ARM_AEXT_V8M_MAIN_DSP, \
74659d
+						ARM_AEXT2_V8M_MAIN_DSP)
74659d
+#define ARM_ARCH_V8R	ARM_FEATURE_CORE (ARM_AEXT_V8R, ARM_AEXT2_V8R)
74659d
 
74659d
 /* Some useful combinations:  */
74659d
 #define ARM_ARCH_NONE	ARM_FEATURE_LOW (0, 0)
74659d
 #define FPU_NONE	ARM_FEATURE_LOW (0, 0)
74659d
 #define ARM_ANY		ARM_FEATURE (-1, -1, 0)	/* Any basic core.  */
74659d
+#define FPU_ANY		ARM_FEATURE_COPROC (-1) /* Any FPU.  */
74659d
 #define ARM_FEATURE_ALL	ARM_FEATURE (-1, -1, -1)/* All CPU and FPU features.  */
74659d
 #define FPU_ANY_HARD	ARM_FEATURE_COPROC (FPU_FPA | FPU_VFP_HARD | FPU_MAVERICK)
74659d
 /* Extensions containing some Thumb-2 instructions.  If any is present, Thumb
74659d
diff -rup binutils.orig/opcodes/arm-dis.c binutils-2.27/opcodes/arm-dis.c
74659d
--- binutils.orig/opcodes/arm-dis.c	2017-08-09 10:26:30.352738367 +0100
74659d
+++ binutils-2.27/opcodes/arm-dis.c	2017-08-09 11:44:50.913090391 +0100
74659d
@@ -26,6 +26,7 @@
74659d
 #include "opcode/arm.h"
74659d
 #include "opintl.h"
74659d
 #include "safe-ctype.h"
74659d
+#include "libiberty.h"
74659d
 #include "floatformat.h"
74659d
 
74659d
 /* FIXME: This shouldn't be done here.  */
74659d
@@ -41,10 +42,6 @@
74659d
 #define strneq(a,b,n)	(strncmp ((a), (b), (n)) == 0)
74659d
 #endif
74659d
 
74659d
-#ifndef NUM_ELEM
74659d
-#define NUM_ELEM(a)     (sizeof (a) / sizeof (a)[0])
74659d
-#endif
74659d
-
74659d
 /* Cached mapping symbol state.  */
74659d
 enum map_type
74659d
 {
74659d
@@ -116,6 +113,7 @@ struct opcode16
74659d
    %<bitfield>G         print as an iWMMXt general purpose or control register
74659d
    %<bitfield>D		print as a NEON D register
74659d
    %<bitfield>Q		print as a NEON Q register
74659d
+   %<bitfield>V		print as a NEON D or Q register
74659d
    %<bitfield>E		print a quarter-float immediate value
74659d
 
74659d
    %y		print a single precision VFP reg.
74659d
@@ -505,6 +503,8 @@ static const struct opcode32 coprocessor
74659d
     0x0ee60a10, 0x0fff0fff, "vmsr%c\tmvfr1, %12-15r"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
     0x0ee70a10, 0x0fff0fff, "vmsr%c\tmvfr0, %12-15r"},
74659d
+  {ARM_FEATURE_COPROC (FPU_VFP_EXT_ARMV8),
74659d
+    0x0ee50a10, 0x0fff0fff, "vmsr%c\tmvfr2, %12-15r"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
     0x0ee80a10, 0x0fff0fff, "vmsr%c\tfpexc, %12-15r"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
@@ -517,6 +517,8 @@ static const struct opcode32 coprocessor
74659d
     0x0ef1fa10, 0x0fffffff, "vmrs%c\tAPSR_nzcv, fpscr"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
     0x0ef10a10, 0x0fff0fff, "vmrs%c\t%12-15r, fpscr"},
74659d
+  {ARM_FEATURE_COPROC (FPU_VFP_EXT_ARMV8),
74659d
+    0x0ef50a10, 0x0fff0fff, "vmrs%c\t%12-15r, mvfr2"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
     0x0ef60a10, 0x0fff0fff, "vmrs%c\t%12-15r, mvfr1"},
74659d
   {ARM_FEATURE_COPROC (FPU_VFP_EXT_V1xD),
74659d
@@ -882,6 +884,34 @@ static const struct opcode32 coprocessor
74659d
     0xfc400000, 0xfff00000,
74659d
     "mcrr2%c\t%8-11d, %4-7d, %12-15R, %16-19R, cr%0-3d"},
74659d
 
74659d
+  /* ARMv8.3 AdvSIMD instructions in the space of coprocessor 8.  */
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfc800800, 0xfeb00f10, "vcadd%c.f16\t%12-15,22V, %16-19,7V, %0-3,5V, #%24?29%24'70"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfc900800, 0xfeb00f10, "vcadd%c.f32\t%12-15,22V, %16-19,7V, %0-3,5V, #%24?29%24'70"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfc200800, 0xff300f10, "vcmla%c.f16\t%12-15,22V, %16-19,7V, %0-3,5V, #%23'90"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfd200800, 0xff300f10, "vcmla%c.f16\t%12-15,22V, %16-19,7V, %0-3,5V, #%23?21%23?780"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfc300800, 0xff300f10, "vcmla%c.f32\t%12-15,22V, %16-19,7V, %0-3,5V, #%23'90"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfd300800, 0xff300f10, "vcmla%c.f32\t%12-15,22V, %16-19,7V, %0-3,5V, #%23?21%23?780"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfe000800, 0xffa00f10, "vcmla%c.f16\t%12-15,22V, %16-19,7V, %0-3D[%5?10], #%20'90"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfe200800, 0xffa00f10, "vcmla%c.f16\t%12-15,22V, %16-19,7V, %0-3D[%5?10], #%20?21%20?780"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfe800800, 0xffa00f10, "vcmla%c.f32\t%12-15,22V, %16-19,7V, %0-3,5D[0], #%20'90"},
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0xfea00800, 0xffa00f10, "vcmla%c.f32\t%12-15,22V, %16-19,7V, %0-3,5D[0], #%20?21%20?780"},
74659d
+
74659d
+  /* Dot Product instructions in the space of coprocessor 13.  */
74659d
+  {ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD),
74659d
+    0xfc200d00, 0xffb00f00, "v%4?usdot.%4?us8\t%12-15,22V, %16-19,7V, %0-3,5V"},
74659d
+  {ARM_FEATURE_COPROC (FPU_NEON_EXT_DOTPROD),
74659d
+    0xfe000d00, 0xff000f00, "v%4?usdot.%4?us8\t%12-15,22V, %16-19,7V, %0-3D[%5?10]"},
74659d
+
74659d
   /* V5 coprocessor instructions.  */
74659d
   {ARM_FEATURE_CORE_LOW (ARM_EXT_V5),
74659d
     0xfc100000, 0xfe100000, "ldc2%22'l%c\t%8-11d, cr%12-15d, %A"},
74659d
@@ -971,6 +1001,10 @@ static const struct opcode32 coprocessor
74659d
   {ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST),
74659d
     0x0e300940, 0x0fb00f50, "vsub%c.f16\t%y1, %y2, %y0"},
74659d
 
74659d
+  /* ARMv8.3 javascript conversion instruction.  */
74659d
+  {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A),
74659d
+    0x0eb90bc0, 0x0fbf0fd0, "vjcvt%c.s32.f64\t%y1, %z0"},
74659d
+
74659d
   {ARM_FEATURE_CORE_LOW (0), 0, 0, 0}
74659d
 };
74659d
 
74659d
@@ -2286,8 +2320,6 @@ static const struct opcode32 arm_opcodes
74659d
     0x01300000, 0x0ff00010, "teq%p%c\t%16-19r, %o"},
74659d
   {ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
74659d
     0x01300010, 0x0ff00010, "teq%p%c\t%16-19R, %o"},
74659d
-  {ARM_FEATURE_CORE_LOW (ARM_EXT_V5),
74659d
-    0x0130f000, 0x0ff0f010, "bx%c\t%0-3r"},
74659d
 
74659d
   {ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
74659d
     0x03400000, 0x0fe00000, "cmp%p%c\t%16-19r, %o"},
74659d
@@ -3171,18 +3203,20 @@ arm_regname;
74659d
 
74659d
 static const arm_regname regnames[] =
74659d
 {
74659d
-  { "raw" , "Select raw register names",
74659d
+  { "reg-names-raw", N_("Select raw register names"),
74659d
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}},
74659d
-  { "gcc",  "Select register names used by GCC",
74659d
+  { "reg-names-gcc", N_("Select register names used by GCC"),
74659d
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "sl",  "fp",  "ip",  "sp",  "lr",  "pc" }},
74659d
-  { "std",  "Select register names used in ARM's ISA documentation",
74659d
+  { "reg-names-std", N_("Select register names used in ARM's ISA documentation"),
74659d
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "sp",  "lr",  "pc" }},
74659d
-  { "apcs", "Select register names used in the APCS",
74659d
+  { "force-thumb", N_("Assume all insns are Thumb insns"), {NULL} },
74659d
+  { "no-force-thumb", N_("Examine preceding label to determine an insn's type"), {NULL} },
74659d
+  { "reg-names-apcs", N_("Select register names used in the APCS"),
74659d
     { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "sl",  "fp",  "ip",  "sp",  "lr",  "pc" }},
74659d
-  { "atpcs", "Select register names used in the ATPCS",
74659d
+  { "reg-names-atpcs", N_("Select register names used in the ATPCS"),
74659d
     { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7",  "v8",  "IP",  "SP",  "LR",  "PC" }},
74659d
-  { "special-atpcs", "Select special register names used in the ATPCS",
74659d
-    { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL",  "FP",  "IP",  "SP",  "LR",  "PC" }},
74659d
+  { "reg-names-special-atpcs", N_("Select special register names used in the ATPCS"),
74659d
+    { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL",  "FP",  "IP",  "SP",  "LR",  "PC" }}
74659d
 };
74659d
 
74659d
 static const char *const iwmmxt_wwnames[] =
74659d
@@ -3208,7 +3242,7 @@ static const char *const iwmmxt_cregname
74659d
 /* Default to GCC register name set.  */
74659d
 static unsigned int regname_selected = 1;
74659d
 
74659d
-#define NUM_ARM_REGNAMES  NUM_ELEM (regnames)
74659d
+#define NUM_ARM_REGNAMES  ARRAY_SIZE (regnames)
74659d
 #define arm_regnames      regnames[regname_selected].reg_names
74659d
 
74659d
 static bfd_boolean force_thumb = FALSE;
74659d
@@ -3227,31 +3261,6 @@ static bfd_vma ifthen_address;
74659d
 
74659d
 
74659d
 /* Functions.  */
74659d
-int
74659d
-get_arm_regname_num_options (void)
74659d
-{
74659d
-  return NUM_ARM_REGNAMES;
74659d
-}
74659d
-
74659d
-int
74659d
-set_arm_regname_option (int option)
74659d
-{
74659d
-  int old = regname_selected;
74659d
-  regname_selected = option;
74659d
-  return old;
74659d
-}
74659d
-
74659d
-int
74659d
-get_arm_regnames (int option,
74659d
-		  const char **setname,
74659d
-		  const char **setdescription,
74659d
-		  const char *const **register_names)
74659d
-{
74659d
-  *setname = regnames[option].name;
74659d
-  *setdescription = regnames[option].description;
74659d
-  *register_names = regnames[option].reg_names;
74659d
-  return 16;
74659d
-}
74659d
 
74659d
 /* Decode a bitfield of the form matching regexp (N(-N)?,)*N(-N)?.
74659d
    Returns pointer to following character of the format string and
74659d
@@ -3669,10 +3678,15 @@ print_insn_coprocessor (bfd_vma pc,
74659d
 			  }
74659d
 			func (stream, "%s", arm_regnames[value]);
74659d
 			break;
74659d
+		      case 'V':
74659d
+			if (given & (1 << 6))
74659d
+			  goto Q;
74659d
+			/* FALLTHROUGH */
74659d
 		      case 'D':
74659d
 			func (stream, "d%ld", value);
74659d
 			break;
74659d
 		      case 'Q':
74659d
+		      Q:
74659d
 			if (value & 1)
74659d
 			  func (stream, "<illegal reg q%ld.5>", value >> 1);
74659d
 			else
74659d
@@ -4686,6 +4700,7 @@ print_insn_arm (bfd_vma pc, struct disas
74659d
 
74659d
 		    case 'S':
74659d
 		      allow_unpredictable = TRUE;
74659d
+		      /* Fall through.  */
74659d
 		    case 's':
74659d
                       if ((given & 0x004f0000) == 0x004f0000)
74659d
 			{
74659d
@@ -5427,22 +5442,31 @@ psr_name (int regno)
74659d
 {
74659d
   switch (regno)
74659d
     {
74659d
-    case 0: return "APSR";
74659d
-    case 1: return "IAPSR";
74659d
-    case 2: return "EAPSR";
74659d
-    case 3: return "PSR";
74659d
-    case 5: return "IPSR";
74659d
-    case 6: return "EPSR";
74659d
-    case 7: return "IEPSR";
74659d
-    case 8: return "MSP";
74659d
-    case 9: return "PSP";
74659d
-    case 16: return "PRIMASK";
74659d
-    case 17: return "BASEPRI";
74659d
-    case 18: return "BASEPRI_MAX";
74659d
-    case 19: return "FAULTMASK";
74659d
-    case 20: return "CONTROL";
74659d
+    case 0x0: return "APSR";
74659d
+    case 0x1: return "IAPSR";
74659d
+    case 0x2: return "EAPSR";
74659d
+    case 0x3: return "PSR";
74659d
+    case 0x5: return "IPSR";
74659d
+    case 0x6: return "EPSR";
74659d
+    case 0x7: return "IEPSR";
74659d
+    case 0x8: return "MSP";
74659d
+    case 0x9: return "PSP";
74659d
+    case 0xa: return "MSPLIM";
74659d
+    case 0xb: return "PSPLIM";
74659d
+    case 0x10: return "PRIMASK";
74659d
+    case 0x11: return "BASEPRI";
74659d
+    case 0x12: return "BASEPRI_MAX";
74659d
+    case 0x13: return "FAULTMASK";
74659d
+    case 0x14: return "CONTROL";
74659d
     case 0x88: return "MSP_NS";
74659d
     case 0x89: return "PSP_NS";
74659d
+    case 0x8a: return "MSPLIM_NS";
74659d
+    case 0x8b: return "PSPLIM_NS";
74659d
+    case 0x90: return "PRIMASK_NS";
74659d
+    case 0x91: return "BASEPRI_NS";
74659d
+    case 0x93: return "FAULTMASK_NS";
74659d
+    case 0x94: return "CONTROL_NS";
74659d
+    case 0x98: return "SP_NS";
74659d
     default: return "<unknown>";
74659d
     }
74659d
 }
74659d
@@ -5717,7 +5741,7 @@ print_insn_thumb32 (bfd_vma pc, struct d
74659d
 		      if (off || !U)
74659d
 			{
74659d
 			  func (stream, ", #%c%u", U ? '+' : '-', off * 4);
74659d
-			  value_in_comment = off * 4 * U ? 1 : -1;
74659d
+			  value_in_comment = off * 4 * (U ? 1 : -1);
74659d
 			}
74659d
 		      func (stream, "]");
74659d
 		      if (W)
74659d
@@ -5729,7 +5753,7 @@ print_insn_thumb32 (bfd_vma pc, struct d
74659d
 		      if (W)
74659d
 			{
74659d
 			  func (stream, "#%c%u", U ? '+' : '-', off * 4);
74659d
-			  value_in_comment = off * 4 * U ? 1 : -1;
74659d
+			  value_in_comment = off * 4 * (U ? 1 : -1);
74659d
 			}
74659d
 		      else
74659d
 			{
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.d binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.d	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.d	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,2 @@
74659d
+#as: -march=armv8.3-a+fp
74659d
+#error-output: armv8_3-a-fp-bad.l
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.l binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.l
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.l	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.l	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,7 @@
74659d
+[^:]+: Assembler messages:
74659d
+[^:]+:3: Error: operand types can't be inferred -- `vjcvt s0,d1'
74659d
+[^:]+:4: Error: VFP single precision register expected -- `vjcvt\.s32\.f64 r0,d1'
74659d
+[^:]+:5: Error: VFP/Neon double precision register expected -- `vjcvt\.s32\.f64 s0,s1'
74659d
+[^:]+:6: Error: VFP/Neon double precision register expected -- `vjcvt\.s32\.f32 s0,s1'
74659d
+[^:]+:7: Error: bad type in Neon instruction -- `vjcvt\.s32\.f32 s0,d1'
74659d
+[^:]+:8: Error: bad type in Neon instruction -- `vjcvt\.f32\.f64 s0,d1'
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.s binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp-bad.s	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp-bad.s	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,8 @@
74659d
+	.text
74659d
+	.arm
74659d
+	vjcvt s0, d1
74659d
+	vjcvt.s32.f64 r0, d1
74659d
+	vjcvt.s32.f64 s0, s1
74659d
+	vjcvt.s32.f32 s0, s1
74659d
+	vjcvt.s32.f32 s0, d1
74659d
+	vjcvt.f32.f64 s0, d1
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp.d binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp.d	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp.d	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,15 @@
74659d
+#as: -march=armv8.3-a+fp
74659d
+#objdump: -dr
74659d
+#skip: *-*-pe *-wince-* *-*-coff
74659d
+
74659d
+.*: +file format .*arm.*
74659d
+
74659d
+Disassembly of section .text:
74659d
+
74659d
+[0-9a-f]+ <.*>:
74659d
+   [0-9a-f]+:	eef90bc7 	vjcvt.s32.f64	s1, d7
74659d
+   [0-9a-f]+:	eef90bc7 	vjcvt.s32.f64	s1, d7
74659d
+
74659d
+[0-9a-f]+ <.*>:
74659d
+   [0-9a-f]+:	eef9 0bc7 	vjcvt.s32.f64	s1, d7
74659d
+
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp.s binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-fp.s	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-fp.s	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,8 @@
74659d
+	.text
74659d
+A1:
74659d
+	.arm
74659d
+	vjcvt.s32.f64 s1, d7
74659d
+	vjcvtal.s32.f64 s1, d7
74659d
+T1:
74659d
+	.thumb
74659d
+	vjcvt.s32.f64 s1, d7
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.d binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.d	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.d	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,2 @@
74659d
+#as: -march=armv8.3-a+fp16+simd
74659d
+#error-output: armv8_3-a-simd-bad.l
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.l binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.l
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.l	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.l	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,39 @@
74659d
+[^:]+: Assembler messages:
74659d
+[^:]+:6: Error: operand types can't be inferred -- `vcadd d0,d1,d2,#90'
74659d
+[^:]+:7: Error: immediate out of range -- `vcadd\.f32 q0,q1,q2,#0'
74659d
+[^:]+:8: Error: immediate out of range -- `vcadd\.f32 q0,q1,q2,#180'
74659d
+[^:]+:9: Error: Neon double or quad precision register expected -- `vcadd\.f16 s0,s1,s2,#90'
74659d
+[^:]+:10: Error: bad type in Neon instruction -- `vcadd\.f64 d0,d1,d2,#90'
74659d
+[^:]+:11: Error: bad type in Neon instruction -- `vcadd\.f64 q0,q1,q2,#90'
74659d
+[^:]+:13: Error: operand types can't be inferred -- `vcmla d0,d1,d2,#90'
74659d
+[^:]+:14: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#-90'
74659d
+[^:]+:15: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#120'
74659d
+[^:]+:16: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#360'
74659d
+[^:]+:17: Error: Neon double or quad precision register expected -- `vcmla\.f16 s0,s1,s2,#90'
74659d
+[^:]+:18: Error: bad type in Neon instruction -- `vcmla\.f64 d0,d1,d2,#90'
74659d
+[^:]+:19: Error: bad type in Neon instruction -- `vcmla\.f64 q0,q1,q2,#90'
74659d
+[^:]+:21: Error: only D registers may be indexed -- `vcmla\.f16 q0,q1,q2\[0\],#90'
74659d
+[^:]+:22: Error: only D registers may be indexed -- `vcmla\.f32 q0,q1,q2\[0\],#90'
74659d
+[^:]+:23: Error: scalar out of range -- `vcmla\.f16 d0,d1,d2\[2\],#90'
74659d
+[^:]+:24: Error: scalar out of range -- `vcmla\.f16 q0,q1,d2\[2\],#90'
74659d
+[^:]+:25: Error: scalar out of range -- `vcmla\.f16 q0,q1,d16\[1\],#90'
74659d
+[^:]+:26: Error: scalar out of range -- `vcmla\.f32 q0,q1,d2\[1\],#90'
74659d
+[^:]+:31: Error: operand types can't be inferred -- `vcadd d0,d1,d2,#90'
74659d
+[^:]+:32: Error: immediate out of range -- `vcadd\.f32 q0,q1,q2,#0'
74659d
+[^:]+:33: Error: immediate out of range -- `vcadd\.f32 q0,q1,q2,#180'
74659d
+[^:]+:34: Error: Neon double or quad precision register expected -- `vcadd\.f16 s0,s1,s2,#90'
74659d
+[^:]+:35: Error: bad type in Neon instruction -- `vcadd\.f64 d0,d1,d2,#90'
74659d
+[^:]+:36: Error: bad type in Neon instruction -- `vcadd\.f64 q0,q1,q2,#90'
74659d
+[^:]+:38: Error: operand types can't be inferred -- `vcmla d0,d1,d2,#90'
74659d
+[^:]+:39: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#-90'
74659d
+[^:]+:40: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#120'
74659d
+[^:]+:41: Error: immediate out of range -- `vcmla\.f32 q0,q1,q2,#360'
74659d
+[^:]+:42: Error: Neon double or quad precision register expected -- `vcmla\.f16 s0,s1,s2,#90'
74659d
+[^:]+:43: Error: bad type in Neon instruction -- `vcmla\.f64 d0,d1,d2,#90'
74659d
+[^:]+:44: Error: bad type in Neon instruction -- `vcmla\.f64 q0,q1,q2,#90'
74659d
+[^:]+:46: Error: only D registers may be indexed -- `vcmla\.f16 q0,q1,q2\[0\],#90'
74659d
+[^:]+:47: Error: only D registers may be indexed -- `vcmla\.f32 q0,q1,q2\[0\],#90'
74659d
+[^:]+:48: Error: scalar out of range -- `vcmla\.f16 d0,d1,d2\[2\],#90'
74659d
+[^:]+:49: Error: scalar out of range -- `vcmla\.f16 q0,q1,d2\[2\],#90'
74659d
+[^:]+:50: Error: scalar out of range -- `vcmla\.f16 q0,q1,d16\[1\],#90'
74659d
+[^:]+:51: Error: scalar out of range -- `vcmla\.f32 q0,q1,d2\[1\],#90'
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.s binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd-bad.s	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd-bad.s	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,51 @@
74659d
+	.text
74659d
+
74659d
+A1:
74659d
+	.arm
74659d
+
74659d
+	vcadd d0,d1,d2,#90
74659d
+	vcadd.f32 q0,q1,q2,#0
74659d
+	vcadd.f32 q0,q1,q2,#180
74659d
+	vcadd.f16 s0,s1,s2,#90
74659d
+	vcadd.f64 d0,d1,d2,#90
74659d
+	vcadd.f64 q0,q1,q2,#90
74659d
+
74659d
+	vcmla d0,d1,d2,#90
74659d
+	vcmla.f32 q0,q1,q2,#-90
74659d
+	vcmla.f32 q0,q1,q2,#120
74659d
+	vcmla.f32 q0,q1,q2,#360
74659d
+	vcmla.f16 s0,s1,s2,#90
74659d
+	vcmla.f64 d0,d1,d2,#90
74659d
+	vcmla.f64 q0,q1,q2,#90
74659d
+
74659d
+	vcmla.f16 q0,q1,q2[0],#90
74659d
+	vcmla.f32 q0,q1,q2[0],#90
74659d
+	vcmla.f16 d0,d1,d2[2],#90
74659d
+	vcmla.f16 q0,q1,d2[2],#90
74659d
+	vcmla.f16 q0,q1,d16[1],#90
74659d
+	vcmla.f32 q0,q1,d2[1],#90
74659d
+
74659d
+T1:
74659d
+	.thumb
74659d
+
74659d
+	vcadd d0,d1,d2,#90
74659d
+	vcadd.f32 q0,q1,q2,#0
74659d
+	vcadd.f32 q0,q1,q2,#180
74659d
+	vcadd.f16 s0,s1,s2,#90
74659d
+	vcadd.f64 d0,d1,d2,#90
74659d
+	vcadd.f64 q0,q1,q2,#90
74659d
+
74659d
+	vcmla d0,d1,d2,#90
74659d
+	vcmla.f32 q0,q1,q2,#-90
74659d
+	vcmla.f32 q0,q1,q2,#120
74659d
+	vcmla.f32 q0,q1,q2,#360
74659d
+	vcmla.f16 s0,s1,s2,#90
74659d
+	vcmla.f64 d0,d1,d2,#90
74659d
+	vcmla.f64 q0,q1,q2,#90
74659d
+
74659d
+	vcmla.f16 q0,q1,q2[0],#90
74659d
+	vcmla.f32 q0,q1,q2[0],#90
74659d
+	vcmla.f16 d0,d1,d2[2],#90
74659d
+	vcmla.f16 q0,q1,d2[2],#90
74659d
+	vcmla.f16 q0,q1,d16[1],#90
74659d
+	vcmla.f32 q0,q1,d2[1],#90
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd.d binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd.d
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd.d	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd.d	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,59 @@
74659d
+#as: -march=armv8.3-a+fp16+simd
74659d
+#objdump: -dr
74659d
+#skip: *-*-pe *-wince-* *-*-coff
74659d
+
74659d
+.*: +file format .*arm.*
74659d
+
74659d
+Disassembly of section .text:
74659d
+
74659d
+[0-9a-f]+ <.*>:
74659d
+ +[0-9a-f]+:	fc942846 	vcadd.f32	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fd942846 	vcadd.f32	q1, q2, q3, #270
74659d
+ +[0-9a-f]+:	fcc658a7 	vcadd.f16	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fc842846 	vcadd.f16	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fcd658a7 	vcadd.f32	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fc342846 	vcmla.f32	q1, q2, q3, #0
74659d
+ +[0-9a-f]+:	fcb42846 	vcmla.f32	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fd342846 	vcmla.f32	q1, q2, q3, #180
74659d
+ +[0-9a-f]+:	fdb42846 	vcmla.f32	q1, q2, q3, #270
74659d
+ +[0-9a-f]+:	fce658a7 	vcmla.f16	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fca42846 	vcmla.f16	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fcf658a7 	vcmla.f32	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fe565883 	vcmla.f16	d21, d22, d3\[0\], #90
74659d
+ +[0-9a-f]+:	fe5658a3 	vcmla.f16	d21, d22, d3\[1\], #90
74659d
+ +[0-9a-f]+:	fe142843 	vcmla.f16	q1, q2, d3\[0\], #90
74659d
+ +[0-9a-f]+:	fe142863 	vcmla.f16	q1, q2, d3\[1\], #90
74659d
+ +[0-9a-f]+:	fed658a7 	vcmla.f32	d21, d22, d23\[0\], #90
74659d
+ +[0-9a-f]+:	fe942867 	vcmla.f32	q1, q2, d23\[0\], #90
74659d
+ +[0-9a-f]+:	fe042863 	vcmla.f16	q1, q2, d3\[1\], #0
74659d
+ +[0-9a-f]+:	fe242863 	vcmla.f16	q1, q2, d3\[1\], #180
74659d
+ +[0-9a-f]+:	fe342863 	vcmla.f16	q1, q2, d3\[1\], #270
74659d
+ +[0-9a-f]+:	fe842843 	vcmla.f32	q1, q2, d3\[0\], #0
74659d
+ +[0-9a-f]+:	fea42843 	vcmla.f32	q1, q2, d3\[0\], #180
74659d
+ +[0-9a-f]+:	feb42843 	vcmla.f32	q1, q2, d3\[0\], #270
74659d
+
74659d
+[0-9a-f]+ <.*>:
74659d
+ +[0-9a-f]+:	fc94 2846 	vcadd.f32	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fd94 2846 	vcadd.f32	q1, q2, q3, #270
74659d
+ +[0-9a-f]+:	fcc6 58a7 	vcadd.f16	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fc84 2846 	vcadd.f16	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fcd6 58a7 	vcadd.f32	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fc34 2846 	vcmla.f32	q1, q2, q3, #0
74659d
+ +[0-9a-f]+:	fcb4 2846 	vcmla.f32	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fd34 2846 	vcmla.f32	q1, q2, q3, #180
74659d
+ +[0-9a-f]+:	fdb4 2846 	vcmla.f32	q1, q2, q3, #270
74659d
+ +[0-9a-f]+:	fce6 58a7 	vcmla.f16	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fca4 2846 	vcmla.f16	q1, q2, q3, #90
74659d
+ +[0-9a-f]+:	fcf6 58a7 	vcmla.f32	d21, d22, d23, #90
74659d
+ +[0-9a-f]+:	fe56 5883 	vcmla.f16	d21, d22, d3\[0\], #90
74659d
+ +[0-9a-f]+:	fe56 58a3 	vcmla.f16	d21, d22, d3\[1\], #90
74659d
+ +[0-9a-f]+:	fe14 2843 	vcmla.f16	q1, q2, d3\[0\], #90
74659d
+ +[0-9a-f]+:	fe14 2863 	vcmla.f16	q1, q2, d3\[1\], #90
74659d
+ +[0-9a-f]+:	fed6 58a7 	vcmla.f32	d21, d22, d23\[0\], #90
74659d
+ +[0-9a-f]+:	fe94 2867 	vcmla.f32	q1, q2, d23\[0\], #90
74659d
+ +[0-9a-f]+:	fe04 2863 	vcmla.f16	q1, q2, d3\[1\], #0
74659d
+ +[0-9a-f]+:	fe24 2863 	vcmla.f16	q1, q2, d3\[1\], #180
74659d
+ +[0-9a-f]+:	fe34 2863 	vcmla.f16	q1, q2, d3\[1\], #270
74659d
+ +[0-9a-f]+:	fe84 2843 	vcmla.f32	q1, q2, d3\[0\], #0
74659d
+ +[0-9a-f]+:	fea4 2843 	vcmla.f32	q1, q2, d3\[0\], #180
74659d
+ +[0-9a-f]+:	feb4 2843 	vcmla.f32	q1, q2, d3\[0\], #270
74659d
diff -rupN binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd.s binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd.s
74659d
--- binutils.orig/gas/testsuite/gas/arm/armv8_3-a-simd.s	1970-01-01 01:00:00.000000000 +0100
74659d
+++ binutils-2.27/gas/testsuite/gas/arm/armv8_3-a-simd.s	2017-08-09 12:10:22.428965485 +0100
74659d
@@ -0,0 +1,63 @@
74659d
+	.text
74659d
+
74659d
+A1:
74659d
+	.arm
74659d
+
74659d
+	vcadd.f32 q1,q2,q3,#90
74659d
+	vcadd.f32 q1,q2,q3,#270
74659d
+	vcadd.f16 d21,d22,d23,#90
74659d
+	vcadd.f16 q1,q2,q3,#90
74659d
+	vcadd.f32 d21,d22,d23,#90
74659d
+
74659d
+	vcmla.f32 q1,q2,q3,#0
74659d
+	vcmla.f32 q1,q2,q3,#90
74659d
+	vcmla.f32 q1,q2,q3,#180
74659d
+	vcmla.f32 q1,q2,q3,#270
74659d
+	vcmla.f16 d21,d22,d23,#90
74659d
+	vcmla.f16 q1,q2,q3,#90
74659d
+	vcmla.f32 d21,d22,d23,#90
74659d
+
74659d
+	vcmla.f16 d21,d22,d3[0],#90
74659d
+	vcmla.f16 d21,d22,d3[1],#90
74659d
+	vcmla.f16 q1,q2,d3[0],#90
74659d
+	vcmla.f16 q1,q2,d3[1],#90
74659d
+	vcmla.f32 d21,d22,d23[0],#90
74659d
+	vcmla.f32 q1,q2,d23[0],#90
74659d
+
74659d
+	vcmla.f16 q1,q2,d3[1],#0
74659d
+	vcmla.f16 q1,q2,d3[1],#180
74659d
+	vcmla.f16 q1,q2,d3[1],#270
74659d
+	vcmla.f32 q1,q2,d3[0],#0
74659d
+	vcmla.f32 q1,q2,d3[0],#180
74659d
+	vcmla.f32 q1,q2,d3[0],#270
74659d
+
74659d
+T1:
74659d
+	.thumb
74659d
+
74659d
+	vcadd.f32 q1,q2,q3,#90
74659d
+	vcadd.f32 q1,q2,q3,#270
74659d
+	vcadd.f16 d21,d22,d23,#90
74659d
+	vcadd.f16 q1,q2,q3,#90
74659d
+	vcadd.f32 d21,d22,d23,#90
74659d
+
74659d
+	vcmla.f32 q1,q2,q3,#0
74659d
+	vcmla.f32 q1,q2,q3,#90
74659d
+	vcmla.f32 q1,q2,q3,#180
74659d
+	vcmla.f32 q1,q2,q3,#270
74659d
+	vcmla.f16 d21,d22,d23,#90
74659d
+	vcmla.f16 q1,q2,q3,#90
74659d
+	vcmla.f32 d21,d22,d23,#90
74659d
+
74659d
+	vcmla.f16 d21,d22,d3[0],#90
74659d
+	vcmla.f16 d21,d22,d3[1],#90
74659d
+	vcmla.f16 q1,q2,d3[0],#90
74659d
+	vcmla.f16 q1,q2,d3[1],#90
74659d
+	vcmla.f32 d21,d22,d23[0],#90
74659d
+	vcmla.f32 q1,q2,d23[0],#90
74659d
+
74659d
+	vcmla.f16 q1,q2,d3[1],#0
74659d
+	vcmla.f16 q1,q2,d3[1],#180
74659d
+	vcmla.f16 q1,q2,d3[1],#270
74659d
+	vcmla.f32 q1,q2,d3[0],#0
74659d
+	vcmla.f32 q1,q2,d3[0],#180
74659d
+	vcmla.f32 q1,q2,d3[0],#270