Blame SOURCES/binutils-x86-JCC-Erratum.patch

73f23b
diff -rup binutils-2.27/gas/config/tc-i386.c binutils.new/gas/config/tc-i386.c
73f23b
--- binutils-2.27/gas/config/tc-i386.c	2019-11-25 12:53:16.612870233 +0000
73f23b
+++ binutils.new/gas/config/tc-i386.c	2019-11-25 12:52:22.173195742 +0000
73f23b
@@ -379,6 +379,9 @@ struct _i386_insn
73f23b
 
73f23b
     /* Error message.  */
73f23b
     enum i386_error error;
73f23b
+
73f23b
+    /* Has GOTPC relocation.  */
73f23b
+    bfd_boolean has_gotpc_reloc;
73f23b
   };
73f23b
 
73f23b
 typedef struct _i386_insn i386_insn;
73f23b
@@ -508,6 +511,8 @@ static enum flag_code flag_code;
73f23b
 static unsigned int object_64bit;
73f23b
 static unsigned int disallow_64bit_reloc;
73f23b
 static int use_rela_relocations = 0;
73f23b
+/* __tls_get_addr/___tls_get_addr symbol for TLS.  */
73f23b
+static const char *tls_get_addr;
73f23b
 
73f23b
 #if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
73f23b
      || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
73f23b
@@ -571,6 +576,21 @@ static int omit_lock_prefix = 0;
73f23b
    "lock addl $0, (%{re}sp)".  */
73f23b
 static int avoid_fence = 0;
73f23b
 
73f23b
+/* Type of the previous instruction.  */
73f23b
+static struct
73f23b
+{
73f23b
+  segT seg;
73f23b
+  const char *file;
73f23b
+  const char *name;
73f23b
+  unsigned int line;
73f23b
+  enum last_insn_kind
73f23b
+    {
73f23b
+      last_insn_other = 0,
73f23b
+      last_insn_directive,
73f23b
+      last_insn_prefix
73f23b
+    } kind;
73f23b
+} last_insn;
73f23b
+
73f23b
 /* 1 if the assembler should generate relax relocations.  */
73f23b
 
73f23b
 static int generate_relax_relocations
73f23b
@@ -584,6 +604,31 @@ static enum check_kind
73f23b
   }
73f23b
 sse_check, operand_check = check_warning;
73f23b
 
73f23b
+/* Non-zero if branches should be aligned within power of 2 boundary.  */
73f23b
+static int align_branch_power = 0;
73f23b
+
73f23b
+/* Types of branches to align.  */
73f23b
+enum align_branch_kind
73f23b
+  {
73f23b
+    align_branch_none = 0,
73f23b
+    align_branch_jcc = 1 << 0,
73f23b
+    align_branch_fused = 1 << 1,
73f23b
+    align_branch_jmp = 1 << 2,
73f23b
+    align_branch_call = 1 << 3,
73f23b
+    align_branch_indirect = 1 << 4,
73f23b
+    align_branch_ret = 1 << 5
73f23b
+  };
73f23b
+
73f23b
+static unsigned int align_branch = (align_branch_jcc
73f23b
+				    | align_branch_fused
73f23b
+				    | align_branch_jmp);
73f23b
+
73f23b
+/* The maximum padding size for fused jcc.  */
73f23b
+#define MAX_FUSED_JCC_PADDING_SIZE 20
73f23b
+
73f23b
+/* The maximum number of prefixes added for an instruction.  */
73f23b
+static unsigned int align_branch_prefix_size = 5;
73f23b
+
73f23b
 /* Register prefix used for error message.  */
73f23b
 static const char *register_prefix = "%";
73f23b
 
73f23b
@@ -664,12 +709,19 @@ int x86_cie_data_alignment;
73f23b
 /* Interface to relax_segment.
73f23b
    There are 3 major relax states for 386 jump insns because the
73f23b
    different types of jumps add different sizes to frags when we're
73f23b
-   figuring out what sort of jump to choose to reach a given label.  */
73f23b
+   figuring out what sort of jump to choose to reach a given label.
73f23b
+
73f23b
+   BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING are used to align
73f23b
+   branches which are handled by md_estimate_size_before_relax() and
73f23b
+   i386_generic_table_relax_frag().  */
73f23b
 
73f23b
 /* Types.  */
73f23b
 #define UNCOND_JUMP 0
73f23b
 #define COND_JUMP 1
73f23b
 #define COND_JUMP86 2
73f23b
+#define BRANCH_PADDING 3
73f23b
+#define BRANCH_PREFIX 4
73f23b
+#define FUSED_JCC_PADDING 5
73f23b
 
73f23b
 /* Sizes.  */
73f23b
 #define CODE16	1
73f23b
@@ -1361,7 +1413,9 @@ i386_align_code (fragS *fragP, int count
73f23b
 		    patt [padding - 1], padding);
73f23b
 	}
73f23b
     }
73f23b
-  fragP->fr_var = count;
73f23b
+
73f23b
+  if (fragP->fr_type != rs_machine_dependent)
73f23b
+    fragP->fr_var = count;
73f23b
 }
73f23b
 
73f23b
 static INLINE int
73f23b
@@ -2705,6 +2759,11 @@ md_begin (void)
73f23b
       x86_dwarf2_return_column = 8;
73f23b
       x86_cie_data_alignment = -4;
73f23b
     }
73f23b
+
73f23b
+  /* NB: FUSED_JCC_PADDING frag must have sufficient room so that it
73f23b
+     can be turned into BRANCH_PREFIX frag.  */
73f23b
+  if (align_branch_prefix_size > MAX_FUSED_JCC_PADDING_SIZE)
73f23b
+    abort ();
73f23b
 }
73f23b
 
73f23b
 void
73f23b
@@ -3814,6 +3873,17 @@ md_assemble (char *line)
73f23b
 
73f23b
   /* We are ready to output the insn.  */
73f23b
   output_insn ();
73f23b
+
73f23b
+  last_insn.seg = now_seg;
73f23b
+
73f23b
+  if (i.tm.opcode_modifier.isprefix)
73f23b
+    {
73f23b
+      last_insn.kind = last_insn_prefix;
73f23b
+      last_insn.name = i.tm.name;
73f23b
+      last_insn.file = as_where (&last_insn.line);
73f23b
+    }
73f23b
+  else
73f23b
+    last_insn.kind = last_insn_other;
73f23b
 }
73f23b
 
73f23b
 static char *
73f23b
@@ -7049,11 +7119,204 @@ output_interseg_jump (void)
73f23b
   md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
73f23b
 }
73f23b
 
73f23b
+/* Return TRUE for test, and, cmp, add, sub, inc and dec which may
73f23b
+   be macro-fused with conditional jumps.  */
73f23b
+
73f23b
+static bfd_boolean
73f23b
+maybe_fused_with_jcc_p (void)
73f23b
+{
73f23b
+  /* No RIP address.  */
73f23b
+  if (i.base_reg && i.base_reg->reg_num == RegRip)
73f23b
+    return FALSE;
73f23b
+
73f23b
+  /* and, add, sub with destination register.  */
73f23b
+  if (!strcmp (i.tm.name, "and")
73f23b
+      || !strcmp (i.tm.name, "add")
73f23b
+      || !strcmp (i.tm.name, "sub"))
73f23b
+    return i.types[1].bitfield.reg32 || i.types[1].bitfield.reg64;
73f23b
+
73f23b
+  /* test, cmp with any register.  */
73f23b
+  if (!strcmp (i.tm.name, "test") || !strcmp (i.tm.name, "cmp"))
73f23b
+    return (i.types[0].bitfield.reg32
73f23b
+	    || i.types[0].bitfield.reg64
73f23b
+	    || i.types[1].bitfield.reg32
73f23b
+	    || i.types[1].bitfield.reg64);
73f23b
+
73f23b
+  /* inc, dec with 16/32/64-bit register.   */
73f23b
+  if (!strcmp (i.tm.name, "inc") || !strcmp (i.tm.name, "dec"))
73f23b
+    return i.types[0].bitfield.reg32 || i.types[0].bitfield.reg64;
73f23b
+
73f23b
+  return FALSE;
73f23b
+}
73f23b
+
73f23b
+/* Return TRUE if a FUSED_JCC_PADDING frag should be generated.  */
73f23b
+
73f23b
+static bfd_boolean
73f23b
+add_fused_jcc_padding_frag_p (void)
73f23b
+{
73f23b
+  if (!align_branch_power
73f23b
+      || now_seg == absolute_section
73f23b
+      || !cpu_arch_flags.bitfield.cpui386
73f23b
+      || !(align_branch & align_branch_fused))
73f23b
+    return FALSE;
73f23b
+
73f23b
+  if (maybe_fused_with_jcc_p ())
73f23b
+    {
73f23b
+      if (last_insn.kind != last_insn_other
73f23b
+	  && last_insn.seg == now_seg)
73f23b
+	{
73f23b
+	  if (flag_debug)
73f23b
+	    as_warn_where (last_insn.file, last_insn.line,
73f23b
+			   _("`%s` skips -malign-branch-boundary on `%s`"),
73f23b
+			   last_insn.name, i.tm.name);
73f23b
+	  return FALSE;
73f23b
+	}
73f23b
+      return TRUE;
73f23b
+    }
73f23b
+
73f23b
+  return FALSE;
73f23b
+}
73f23b
+
73f23b
+/* Return TRUE if a BRANCH_PREFIX frag should be generated.  */
73f23b
+
73f23b
+static bfd_boolean
73f23b
+add_branch_prefix_frag_p (void)
73f23b
+{
73f23b
+  if (!align_branch_power
73f23b
+      || now_seg == absolute_section
73f23b
+      || i.tm.cpu_flags.bitfield.cpupadlock
73f23b
+      || !cpu_arch_flags.bitfield.cpui386)
73f23b
+    return FALSE;
73f23b
+
73f23b
+  /* Don't add prefix if it is a prefix or there is no operand.  */
73f23b
+  if (!i.operands || i.tm.opcode_modifier.isprefix)
73f23b
+    return FALSE;
73f23b
+
73f23b
+  if (last_insn.kind != last_insn_other
73f23b
+      && last_insn.seg == now_seg)
73f23b
+    {
73f23b
+      if (flag_debug)
73f23b
+	as_warn_where (last_insn.file, last_insn.line,
73f23b
+		       _("`%s` skips -malign-branch-boundary on `%s`"),
73f23b
+		       last_insn.name, i.tm.name);
73f23b
+      return FALSE;
73f23b
+    }
73f23b
+
73f23b
+  return TRUE;
73f23b
+}
73f23b
+
73f23b
+/* Return TRUE if a BRANCH_PADDING frag should be generated.  */
73f23b
+
73f23b
+static int
73f23b
+add_branch_padding_frag_p (enum align_branch_kind *branch_p)
73f23b
+{
73f23b
+  bfd_boolean add_padding;
73f23b
+
73f23b
+  if (!align_branch_power
73f23b
+      || now_seg == absolute_section
73f23b
+      || !cpu_arch_flags.bitfield.cpui386)
73f23b
+    return FALSE;
73f23b
+
73f23b
+  add_padding = FALSE;
73f23b
+
73f23b
+  /* Check for jcc and direct jmp.  */
73f23b
+  if (i.tm.opcode_modifier.jump)
73f23b
+    {
73f23b
+      if (i.tm.base_opcode == JUMP_PC_RELATIVE)
73f23b
+	{
73f23b
+	  *branch_p = align_branch_jmp;
73f23b
+	  add_padding = align_branch & align_branch_jmp;
73f23b
+	}
73f23b
+      else
73f23b
+	{
73f23b
+	  *branch_p = align_branch_jcc;
73f23b
+	  if ((align_branch & align_branch_jcc))
73f23b
+	    add_padding = TRUE;
73f23b
+	}
73f23b
+    }
73f23b
+  else if (i.tm.base_opcode == 0xc2
73f23b
+	   || i.tm.base_opcode == 0xc3
73f23b
+	   || i.tm.base_opcode == 0xca
73f23b
+	   || i.tm.base_opcode == 0xcb)
73f23b
+    {
73f23b
+      *branch_p = align_branch_ret;
73f23b
+      if ((align_branch & align_branch_ret))
73f23b
+	add_padding = TRUE;
73f23b
+    }
73f23b
+  else
73f23b
+    {
73f23b
+      if (i.tm.base_opcode == 0xe8)
73f23b
+	{
73f23b
+	  *branch_p = align_branch_call;
73f23b
+	  if ((align_branch & align_branch_call))
73f23b
+	    add_padding = TRUE;
73f23b
+	}
73f23b
+      else if (i.tm.base_opcode == 0xff
73f23b
+	       && (i.rm.reg == 2 || i.rm.reg == 4))
73f23b
+	{
73f23b
+	  *branch_p = align_branch_indirect;
73f23b
+	  if ((align_branch & align_branch_indirect))
73f23b
+	    add_padding = TRUE;
73f23b
+	}
73f23b
+
73f23b
+      /* Check for indirect jmp, direct and indirect calls.  */
73f23b
+      if (add_padding
73f23b
+	  && i.disp_operands
73f23b
+	  && tls_get_addr
73f23b
+	  && (i.op[0].disps->X_op == O_symbol
73f23b
+	      || (i.op[0].disps->X_op == O_subtract
73f23b
+		  && i.op[0].disps->X_op_symbol == GOT_symbol)))
73f23b
+	{
73f23b
+	  symbolS *s = i.op[0].disps->X_add_symbol;
73f23b
+	  /* No padding to call to global or undefined tls_get_addr.  */
73f23b
+	  if ((S_IS_EXTERNAL (s) || !S_IS_DEFINED (s))
73f23b
+	      && strcmp (S_GET_NAME (s), tls_get_addr) == 0)
73f23b
+	    return FALSE;
73f23b
+	}
73f23b
+    }
73f23b
+
73f23b
+  if (add_padding
73f23b
+      && last_insn.kind != last_insn_other
73f23b
+      && last_insn.seg == now_seg)
73f23b
+    {
73f23b
+      if (flag_debug)
73f23b
+	as_warn_where (last_insn.file, last_insn.line,
73f23b
+		       _("`%s` skips -malign-branch-boundary on `%s`"),
73f23b
+		       last_insn.name, i.tm.name);
73f23b
+      return FALSE;
73f23b
+    }
73f23b
+
73f23b
+  return add_padding;
73f23b
+}
73f23b
+
73f23b
+static unsigned int
73f23b
+encoding_length (const fragS *start_frag, offsetT start_off,
73f23b
+		 const char *frag_now_ptr)
73f23b
+{
73f23b
+  unsigned int len = 0;
73f23b
+
73f23b
+  if (start_frag != frag_now)
73f23b
+    {
73f23b
+      const fragS *fr = start_frag;
73f23b
+
73f23b
+      do
73f23b
+	{
73f23b
+	  len += fr->fr_fix;
73f23b
+	  fr = fr->fr_next;
73f23b
+	}
73f23b
+      while (fr && fr != frag_now);
73f23b
+    }
73f23b
+
73f23b
+  return len - start_off + (frag_now_ptr - frag_now->fr_literal);
73f23b
+}
73f23b
+
73f23b
 static void
73f23b
 output_insn (void)
73f23b
 {
73f23b
   fragS *insn_start_frag;
73f23b
   offsetT insn_start_off;
73f23b
+  fragS *fragP = NULL;
73f23b
+  enum align_branch_kind branch = align_branch_none;
73f23b
 
73f23b
   /* Tie dwarf2 debug info to the address at the start of the insn.
73f23b
      We can't do this after the insn has been output as the current
73f23b
@@ -7063,6 +7326,30 @@ output_insn (void)
73f23b
   insn_start_frag = frag_now;
73f23b
   insn_start_off = frag_now_fix ();
73f23b
 
73f23b
+  if (add_branch_padding_frag_p (&branch))
73f23b
+    {
73f23b
+      char *p;
73f23b
+      unsigned int max_branch_padding_size = 14;
73f23b
+
73f23b
+      /* Align section to boundary.  */
73f23b
+      record_alignment (now_seg, align_branch_power);
73f23b
+
73f23b
+      /* Make room for padding.  */
73f23b
+      frag_grow (max_branch_padding_size);
73f23b
+
73f23b
+      /* Start of the padding.  */
73f23b
+      p = frag_more (0);
73f23b
+
73f23b
+      fragP = frag_now;
73f23b
+
73f23b
+      frag_var (rs_machine_dependent, max_branch_padding_size, 0,
73f23b
+		ENCODE_RELAX_STATE (BRANCH_PADDING, 0),
73f23b
+		NULL, 0, p);
73f23b
+
73f23b
+      fragP->tc_frag_data.branch_type = branch;
73f23b
+      fragP->tc_frag_data.max_bytes = max_branch_padding_size;
73f23b
+    }
73f23b
+
73f23b
   /* Output jumps.  */
73f23b
   if (i.tm.opcode_modifier.jump)
73f23b
     output_branch ();
73f23b
@@ -7104,6 +7391,44 @@ output_insn (void)
73f23b
 	  i.prefix[LOCK_PREFIX] = 0;
73f23b
 	}
73f23b
 
73f23b
+      if (branch)
73f23b
+	/* Skip if this is a branch.  */
73f23b
+	;
73f23b
+      else if (add_fused_jcc_padding_frag_p ())
73f23b
+	{
73f23b
+	  unsigned int max_fused_padding_size
73f23b
+	    = MAX_FUSED_JCC_PADDING_SIZE;
73f23b
+
73f23b
+	  /* Make room for padding.  */
73f23b
+	  frag_grow (max_fused_padding_size);
73f23b
+	  p = frag_more (0);
73f23b
+
73f23b
+	  fragP = frag_now;
73f23b
+
73f23b
+	  frag_var (rs_machine_dependent, max_fused_padding_size, 0,
73f23b
+		    ENCODE_RELAX_STATE (FUSED_JCC_PADDING, 0),
73f23b
+		    NULL, 0, p);
73f23b
+
73f23b
+	  fragP->tc_frag_data.branch_type = align_branch_fused;
73f23b
+	  fragP->tc_frag_data.max_bytes = max_fused_padding_size;
73f23b
+	}
73f23b
+      else if (add_branch_prefix_frag_p ())
73f23b
+	{
73f23b
+	  unsigned int max_prefix_size = align_branch_prefix_size;
73f23b
+
73f23b
+	  /* Make room for padding.  */
73f23b
+	  frag_grow (max_prefix_size);
73f23b
+	  p = frag_more (0);
73f23b
+
73f23b
+	  fragP = frag_now;
73f23b
+
73f23b
+	  frag_var (rs_machine_dependent, max_prefix_size, 0,
73f23b
+		    ENCODE_RELAX_STATE (BRANCH_PREFIX, 0),
73f23b
+		    NULL, 0, p);
73f23b
+
73f23b
+	  fragP->tc_frag_data.max_bytes = max_prefix_size;
73f23b
+	}
73f23b
+
73f23b
       /* Since the VEX/EVEX prefix contains the implicit prefix, we
73f23b
 	 don't need the explicit prefix.  */
73f23b
       if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex)
73f23b
@@ -7239,6 +7564,83 @@ check_prefix:
73f23b
 
73f23b
       if (i.imm_operands)
73f23b
 	output_imm (insn_start_frag, insn_start_off);
73f23b
+
73f23b
+      if (now_seg != absolute_section)
73f23b
+	{
73f23b
+	  j = encoding_length (insn_start_frag, insn_start_off, frag_more (0));
73f23b
+	  if (fragP)
73f23b
+	    {
73f23b
+	      /* NB: Don't add prefix with GOTPC relocation since
73f23b
+		 output_disp() above depends on the fixed encoding
73f23b
+		 length.  */
73f23b
+	      unsigned int max = i.has_gotpc_reloc ? 0 : 15 - j;
73f23b
+	      /* Prefix count on the current instruction.  */
73f23b
+	      unsigned int count = 0;
73f23b
+	      unsigned int k;
73f23b
+	      for (k = 0; k < ARRAY_SIZE (i.prefix); k++)
73f23b
+		if (i.prefix[k])
73f23b
+		  count++;
73f23b
+
73f23b
+	      /* NB: prefix count + instruction size must be <= 15.  */
73f23b
+	      if (j > 15)
73f23b
+		as_fatal (_("instruction length of %u bytes exceeds the limit of 15"),
73f23b
+			  j);
73f23b
+
73f23b
+	      if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype)
73f23b
+		  == BRANCH_PREFIX)
73f23b
+		{
73f23b
+		  /* Set the maximum prefix size in BRANCH_PREFIX
73f23b
+		     frag.  */
73f23b
+		  if (fragP->tc_frag_data.max_bytes > max)
73f23b
+		    fragP->tc_frag_data.max_bytes = max;
73f23b
+		  if (fragP->tc_frag_data.max_bytes > count)
73f23b
+		    fragP->tc_frag_data.max_bytes -= count;
73f23b
+		  else
73f23b
+		    fragP->tc_frag_data.max_bytes = 0;
73f23b
+		}
73f23b
+	      else
73f23b
+		{
73f23b
+		  /* Remember the maximum prefix size in FUSED_JCC_PADDING
73f23b
+		     frag.  */
73f23b
+		  unsigned int max_prefix_size;
73f23b
+		  if (align_branch_prefix_size > max)
73f23b
+		    max_prefix_size = max;
73f23b
+		  else
73f23b
+		    max_prefix_size = align_branch_prefix_size;
73f23b
+		  if (max_prefix_size > count)
73f23b
+		    fragP->tc_frag_data.max_prefix_length
73f23b
+		      = max_prefix_size - count;
73f23b
+		}
73f23b
+
73f23b
+	      /* Use existing segment prefix if possible.  Use CS
73f23b
+		 segment prefix in 64-bit mode.  In 32-bit mode, use SS
73f23b
+		 segment prefix with ESP/EBP base register and use DS
73f23b
+		 segment prefix without ESP/EBP base register.  */
73f23b
+	      if (i.prefix[SEG_PREFIX])
73f23b
+		fragP->tc_frag_data.default_prefix = i.prefix[SEG_PREFIX];
73f23b
+	      else if (flag_code == CODE_64BIT)
73f23b
+		fragP->tc_frag_data.default_prefix = CS_PREFIX_OPCODE;
73f23b
+	      else if (i.base_reg
73f23b
+		       && (i.base_reg->reg_num == 4
73f23b
+			   || i.base_reg->reg_num == 5))
73f23b
+		fragP->tc_frag_data.default_prefix = SS_PREFIX_OPCODE;
73f23b
+	      else
73f23b
+		fragP->tc_frag_data.default_prefix = DS_PREFIX_OPCODE;
73f23b
+	    }
73f23b
+	  else if (j > 15)
73f23b
+	    as_warn (_("instruction length of %u bytes exceeds the limit of 15"),
73f23b
+		     j);
73f23b
+	}
73f23b
+    }
73f23b
+
73f23b
+  if (align_branch_power
73f23b
+      && now_seg != absolute_section
73f23b
+      && cpu_arch_flags.bitfield.cpui386)
73f23b
+    {
73f23b
+      /* Terminate each frag so that we can add prefix and check for
73f23b
+         fused jcc.  */
73f23b
+      frag_wane (frag_now);
73f23b
+      frag_new (0);
73f23b
     }
73f23b
 
73f23b
 #ifdef DEBUG386
73f23b
@@ -7371,6 +7773,7 @@ output_disp (fragS *insn_start_frag, off
73f23b
 		    {
73f23b
 		      reloc_type = BFD_RELOC_386_GOTPC;
73f23b
 		      i.op[n].imms->X_add_number += add;
73f23b
+		      i.has_gotpc_reloc = TRUE;
73f23b
 		    }
73f23b
 		  else if (reloc_type == BFD_RELOC_64)
73f23b
 		    reloc_type = BFD_RELOC_X86_64_GOTPC64;
73f23b
@@ -7536,6 +7939,7 @@ output_imm (fragS *insn_start_frag, offs
73f23b
 		    reloc_type = BFD_RELOC_X86_64_GOTPC32;
73f23b
 		  else if (size == 8)
73f23b
 		    reloc_type = BFD_RELOC_X86_64_GOTPC64;
73f23b
+		  i.has_gotpc_reloc = TRUE;
73f23b
 		  i.op[n].imms->X_add_number += add;
73f23b
 		}
73f23b
 	      fix_new_exp (frag_now, p - frag_now->fr_literal, size,
73f23b
@@ -9133,6 +9537,355 @@ elf_symbol_resolved_in_segment_p (symbol
73f23b
 }
73f23b
 #endif
73f23b
 
73f23b
+/* Return the next non-empty frag.  */
73f23b
+
73f23b
+static fragS *
73f23b
+i386_next_non_empty_frag (fragS *fragP)
73f23b
+{
73f23b
+  /* There may be a frag with a ".fill 0" when there is no room in
73f23b
+     the current frag for frag_grow in output_insn.  */
73f23b
+  for (fragP = fragP->fr_next;
73f23b
+       (fragP != NULL
73f23b
+	&& fragP->fr_type == rs_fill
73f23b
+	&& fragP->fr_fix == 0);
73f23b
+       fragP = fragP->fr_next)
73f23b
+    ;
73f23b
+  return fragP;
73f23b
+}
73f23b
+
73f23b
+/* Return the next jcc frag after BRANCH_PADDING.  */
73f23b
+
73f23b
+static fragS *
73f23b
+i386_next_jcc_frag (fragS *fragP)
73f23b
+{
73f23b
+  if (!fragP)
73f23b
+    return NULL;
73f23b
+
73f23b
+  if (fragP->fr_type == rs_machine_dependent
73f23b
+      && (TYPE_FROM_RELAX_STATE (fragP->fr_subtype)
73f23b
+	  == BRANCH_PADDING))
73f23b
+    {
73f23b
+      fragP = i386_next_non_empty_frag (fragP);
73f23b
+      if (fragP->fr_type != rs_machine_dependent)
73f23b
+	return NULL;
73f23b
+      if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == COND_JUMP)
73f23b
+	return fragP;
73f23b
+    }
73f23b
+
73f23b
+  return NULL;
73f23b
+}
73f23b
+
73f23b
+/* Classify BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags.  */
73f23b
+
73f23b
+static void
73f23b
+i386_classify_machine_dependent_frag (fragS *fragP)
73f23b
+{
73f23b
+  fragS *cmp_fragP;
73f23b
+  fragS *pad_fragP;
73f23b
+  fragS *branch_fragP;
73f23b
+  fragS *next_fragP;
73f23b
+  unsigned int max_prefix_length;
73f23b
+
73f23b
+  if (fragP->tc_frag_data.classified)
73f23b
+    return;
73f23b
+
73f23b
+  /* First scan for BRANCH_PADDING and FUSED_JCC_PADDING.  Convert
73f23b
+     FUSED_JCC_PADDING and merge BRANCH_PADDING.  */
73f23b
+  for (next_fragP = fragP;
73f23b
+       next_fragP != NULL;
73f23b
+       next_fragP = next_fragP->fr_next)
73f23b
+    {
73f23b
+      next_fragP->tc_frag_data.classified = 1;
73f23b
+      if (next_fragP->fr_type == rs_machine_dependent)
73f23b
+	switch (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype))
73f23b
+	  {
73f23b
+	  case BRANCH_PADDING:
73f23b
+	    /* The BRANCH_PADDING frag must be followed by a branch
73f23b
+	       frag.  */
73f23b
+	    branch_fragP = i386_next_non_empty_frag (next_fragP);
73f23b
+	    next_fragP->tc_frag_data.u.branch_fragP = branch_fragP;
73f23b
+	    break;
73f23b
+	  case FUSED_JCC_PADDING:
73f23b
+	    /* Check if this is a fused jcc:
73f23b
+	       FUSED_JCC_PADDING
73f23b
+	       CMP
73f23b
+	       BRANCH_PADDING
73f23b
+	       COND_JUMP
73f23b
+	       */
73f23b
+	    cmp_fragP = i386_next_non_empty_frag (next_fragP);
73f23b
+	    pad_fragP = i386_next_non_empty_frag (cmp_fragP);
73f23b
+	    branch_fragP = i386_next_jcc_frag (pad_fragP);
73f23b
+	    if (branch_fragP)
73f23b
+	      {
73f23b
+		/* The BRANCH_PADDING frag is merged with the
73f23b
+		   FUSED_JCC_PADDING frag.  */
73f23b
+		next_fragP->tc_frag_data.u.branch_fragP = branch_fragP;
73f23b
+		/* CMP instruction size.  */
73f23b
+		next_fragP->tc_frag_data.cmp_size = cmp_fragP->fr_fix;
73f23b
+		frag_wane (pad_fragP);
73f23b
+		/* Skip to branch_fragP.  */
73f23b
+		next_fragP = branch_fragP;
73f23b
+	      }
73f23b
+	    else if (next_fragP->tc_frag_data.max_prefix_length)
73f23b
+	      {
73f23b
+		/* Turn FUSED_JCC_PADDING into BRANCH_PREFIX if it isn't
73f23b
+		   a fused jcc.  */
73f23b
+		next_fragP->fr_subtype
73f23b
+		  = ENCODE_RELAX_STATE (BRANCH_PREFIX, 0);
73f23b
+		next_fragP->tc_frag_data.max_bytes
73f23b
+		  = next_fragP->tc_frag_data.max_prefix_length;
73f23b
+		/* This will be updated in the BRANCH_PREFIX scan.  */
73f23b
+		next_fragP->tc_frag_data.max_prefix_length = 0;
73f23b
+	      }
73f23b
+	    else
73f23b
+	      frag_wane (next_fragP);
73f23b
+	    break;
73f23b
+	  }
73f23b
+    }
73f23b
+
73f23b
+  /* Scan for BRANCH_PREFIX.  */
73f23b
+  for (; fragP != NULL; fragP = fragP->fr_next)
73f23b
+    if (fragP->fr_type == rs_machine_dependent
73f23b
+	&& (TYPE_FROM_RELAX_STATE (fragP->fr_subtype)
73f23b
+	    == BRANCH_PREFIX))
73f23b
+      {
73f23b
+	/* Count all BRANCH_PREFIX frags before BRANCH_PADDING and
73f23b
+	   COND_JUMP_PREFIX.  */
73f23b
+	max_prefix_length = 0;
73f23b
+	for (next_fragP = fragP;
73f23b
+	     next_fragP != NULL;
73f23b
+	     next_fragP = next_fragP->fr_next)
73f23b
+	  {
73f23b
+	    if (next_fragP->fr_type == rs_fill)
73f23b
+	      /* Skip rs_fill frags.  */
73f23b
+	      ;
73f23b
+	    else if (next_fragP->fr_type == rs_machine_dependent)
73f23b
+	      {
73f23b
+		if (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)
73f23b
+		    == BRANCH_PREFIX)
73f23b
+		  {
73f23b
+		    /* Count BRANCH_PREFIX frags.  */
73f23b
+		    if (max_prefix_length >= MAX_FUSED_JCC_PADDING_SIZE)
73f23b
+		      {
73f23b
+			max_prefix_length = MAX_FUSED_JCC_PADDING_SIZE;
73f23b
+			frag_wane (next_fragP);
73f23b
+		      }
73f23b
+		    else
73f23b
+		      max_prefix_length
73f23b
+			+= next_fragP->tc_frag_data.max_bytes;
73f23b
+		  }
73f23b
+		else if ((TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)
73f23b
+			  == BRANCH_PADDING)
73f23b
+			 || (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)
73f23b
+			     == FUSED_JCC_PADDING))
73f23b
+		  {
73f23b
+		    /* Stop at BRANCH_PADDING and FUSED_JCC_PADDING.  */
73f23b
+		    fragP->tc_frag_data.u.padding_fragP = next_fragP;
73f23b
+		    break;
73f23b
+		  }
73f23b
+		else
73f23b
+		  /* Stop for other rs_machine_dependent frags.  */
73f23b
+		  break;
73f23b
+	      }
73f23b
+	    else
73f23b
+	      /* Stop for all other frags.  */
73f23b
+	      break;
73f23b
+	  }
73f23b
+
73f23b
+	fragP->tc_frag_data.max_prefix_length = max_prefix_length;
73f23b
+
73f23b
+	/* Skip to the next frag.  */
73f23b
+	fragP = next_fragP;
73f23b
+      }
73f23b
+}
73f23b
+
73f23b
+/* Compute padding size for
73f23b
+
73f23b
+	FUSED_JCC_PADDING
73f23b
+	CMP
73f23b
+	BRANCH_PADDING
73f23b
+	COND_JUMP/UNCOND_JUMP
73f23b
+
73f23b
+   or
73f23b
+
73f23b
+	BRANCH_PADDING
73f23b
+	COND_JUMP/UNCOND_JUMP
73f23b
+ */
73f23b
+
73f23b
+static int
73f23b
+i386_branch_padding_size (fragS *fragP, offsetT address)
73f23b
+{
73f23b
+  unsigned int offset, size, padding_size;
73f23b
+  fragS *branch_fragP = fragP->tc_frag_data.u.branch_fragP;
73f23b
+
73f23b
+  /* The start address of the BRANCH_PADDING or FUSED_JCC_PADDING frag.  */
73f23b
+  if (!address)
73f23b
+    address = fragP->fr_address;
73f23b
+  address += fragP->fr_fix;
73f23b
+
73f23b
+  /* CMP instrunction size.  */
73f23b
+  size = fragP->tc_frag_data.cmp_size;
73f23b
+
73f23b
+  /* The base size of the branch frag.  */
73f23b
+  size += branch_fragP->fr_fix;
73f23b
+
73f23b
+  /* Add opcode and displacement bytes for the rs_machine_dependent
73f23b
+     branch frag.  */
73f23b
+  if (branch_fragP->fr_type == rs_machine_dependent)
73f23b
+    size += md_relax_table[branch_fragP->fr_subtype].rlx_length;
73f23b
+
73f23b
+  /* Check if branch is within boundary and doesn't end at the last
73f23b
+     byte.  */
73f23b
+  offset = address & ((1U << align_branch_power) - 1);
73f23b
+  if ((offset + size) >= (1U << align_branch_power))
73f23b
+    /* Padding needed to avoid crossing boundary.  */
73f23b
+    padding_size = (1 << align_branch_power) - offset;
73f23b
+  else
73f23b
+    /* No padding needed.  */
73f23b
+    padding_size = 0;
73f23b
+
73f23b
+  if (!fits_in_signed_byte (padding_size))
73f23b
+    abort ();
73f23b
+
73f23b
+  return padding_size;
73f23b
+}
73f23b
+
73f23b
+/* i386_generic_table_relax_frag()
73f23b
+
73f23b
+   Handle BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags to
73f23b
+   grow/shrink padding to align branch frags.  Hand others to
73f23b
+   relax_frag().  */
73f23b
+
73f23b
+long
73f23b
+i386_generic_table_relax_frag (segT segment, fragS *fragP, long stretch)
73f23b
+{
73f23b
+  if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING
73f23b
+      || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING)
73f23b
+    {
73f23b
+      long padding_size = i386_branch_padding_size (fragP, 0);
73f23b
+      long grow = padding_size - fragP->tc_frag_data.length;
73f23b
+
73f23b
+      /* When the BRANCH_PREFIX frag is used, the computed address
73f23b
+         must match the actual address and there should be no padding.  */
73f23b
+      if (fragP->tc_frag_data.padding_address
73f23b
+	  && (fragP->tc_frag_data.padding_address != fragP->fr_address
73f23b
+	      || padding_size))
73f23b
+	abort ();
73f23b
+
73f23b
+      /* Update the padding size.  */
73f23b
+      if (grow)
73f23b
+	fragP->tc_frag_data.length = padding_size;
73f23b
+
73f23b
+      return grow;
73f23b
+    }
73f23b
+  else if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX)
73f23b
+    {
73f23b
+      fragS *padding_fragP, *next_fragP;
73f23b
+      long padding_size, left_size, last_size;
73f23b
+
73f23b
+      padding_fragP = fragP->tc_frag_data.u.padding_fragP;
73f23b
+      if (!padding_fragP)
73f23b
+	/* Use the padding set by the leading BRANCH_PREFIX frag.  */
73f23b
+	return (fragP->tc_frag_data.length
73f23b
+		- fragP->tc_frag_data.last_length);
73f23b
+
73f23b
+      /* Compute the relative address of the padding frag in the very
73f23b
+        first time where the BRANCH_PREFIX frag sizes are zero.  */
73f23b
+      if (!fragP->tc_frag_data.padding_address)
73f23b
+	fragP->tc_frag_data.padding_address
73f23b
+	  = padding_fragP->fr_address - (fragP->fr_address - stretch);
73f23b
+
73f23b
+      /* First update the last length from the previous interation.  */
73f23b
+      left_size = fragP->tc_frag_data.prefix_length;
73f23b
+      for (next_fragP = fragP;
73f23b
+	   next_fragP != padding_fragP;
73f23b
+	   next_fragP = next_fragP->fr_next)
73f23b
+	if (next_fragP->fr_type == rs_machine_dependent
73f23b
+	    && (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)
73f23b
+		== BRANCH_PREFIX))
73f23b
+	  {
73f23b
+	    if (left_size)
73f23b
+	      {
73f23b
+		int max = next_fragP->tc_frag_data.max_bytes;
73f23b
+		if (max)
73f23b
+		  {
73f23b
+		    int size;
73f23b
+		    if (max > left_size)
73f23b
+		      size = left_size;
73f23b
+		    else
73f23b
+		      size = max;
73f23b
+		    left_size -= size;
73f23b
+		    next_fragP->tc_frag_data.last_length = size;
73f23b
+		  }
73f23b
+	      }
73f23b
+	    else
73f23b
+	      next_fragP->tc_frag_data.last_length = 0;
73f23b
+	  }
73f23b
+
73f23b
+      /* Check the padding size for the padding frag.  */
73f23b
+      padding_size = i386_branch_padding_size
73f23b
+	(padding_fragP, (fragP->fr_address
73f23b
+			 + fragP->tc_frag_data.padding_address));
73f23b
+
73f23b
+      last_size = fragP->tc_frag_data.prefix_length;
73f23b
+      /* Check if there is change from the last interation.  */
73f23b
+      if (padding_size == last_size)
73f23b
+	{
73f23b
+	  /* Update the expected address of the padding frag.  */
73f23b
+	  padding_fragP->tc_frag_data.padding_address
73f23b
+	    = (fragP->fr_address + padding_size
73f23b
+	       + fragP->tc_frag_data.padding_address);
73f23b
+	  return 0;
73f23b
+	}
73f23b
+
73f23b
+      if (padding_size > fragP->tc_frag_data.max_prefix_length)
73f23b
+	{
73f23b
+	  /* No padding if there is no sufficient room.  Clear the
73f23b
+	     expected address of the padding frag.  */
73f23b
+	  padding_fragP->tc_frag_data.padding_address = 0;
73f23b
+	  padding_size = 0;
73f23b
+	}
73f23b
+      else
73f23b
+	/* Store the expected address of the padding frag.  */
73f23b
+	padding_fragP->tc_frag_data.padding_address
73f23b
+	  = (fragP->fr_address + padding_size
73f23b
+	     + fragP->tc_frag_data.padding_address);
73f23b
+
73f23b
+      fragP->tc_frag_data.prefix_length = padding_size;
73f23b
+
73f23b
+      /* Update the length for the current interation.  */
73f23b
+      left_size = padding_size;
73f23b
+      for (next_fragP = fragP;
73f23b
+	   next_fragP != padding_fragP;
73f23b
+	   next_fragP = next_fragP->fr_next)
73f23b
+	if (next_fragP->fr_type == rs_machine_dependent
73f23b
+	    && (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)
73f23b
+		== BRANCH_PREFIX))
73f23b
+	  {
73f23b
+	    if (left_size)
73f23b
+	      {
73f23b
+		int max = next_fragP->tc_frag_data.max_bytes;
73f23b
+		if (max)
73f23b
+		  {
73f23b
+		    int size;
73f23b
+		    if (max > left_size)
73f23b
+		      size = left_size;
73f23b
+		    else
73f23b
+		      size = max;
73f23b
+		    left_size -= size;
73f23b
+		    next_fragP->tc_frag_data.length = size;
73f23b
+		  }
73f23b
+	      }
73f23b
+	    else
73f23b
+	      next_fragP->tc_frag_data.length = 0;
73f23b
+	  }
73f23b
+
73f23b
+      return (fragP->tc_frag_data.length
73f23b
+	      - fragP->tc_frag_data.last_length);
73f23b
+    }
73f23b
+  return relax_frag (segment, fragP, stretch);
73f23b
+}
73f23b
+
73f23b
 /* md_estimate_size_before_relax()
73f23b
 
73f23b
    Called just before relax() for rs_machine_dependent frags.  The x86
73f23b
@@ -9149,6 +9902,14 @@ elf_symbol_resolved_in_segment_p (symbol
73f23b
 int
73f23b
 md_estimate_size_before_relax (fragS *fragP, segT segment)
73f23b
 {
73f23b
+  if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING
73f23b
+      || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX
73f23b
+      || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING)
73f23b
+    {
73f23b
+      i386_classify_machine_dependent_frag (fragP);
73f23b
+      return fragP->tc_frag_data.length;
73f23b
+    }
73f23b
+
73f23b
   /* We've already got fragP->fr_subtype right;  all we have to do is
73f23b
      check for un-relaxable symbols.  On an ELF system, we can't relax
73f23b
      an externally visible symbol, because it may be overridden by a
73f23b
@@ -9278,6 +10039,109 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNU
73f23b
   unsigned int extension = 0;
73f23b
   offsetT displacement_from_opcode_start;
73f23b
 
73f23b
+  if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING
73f23b
+      || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING
73f23b
+      || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX)
73f23b
+    {
73f23b
+      /* Generate nop padding.  */
73f23b
+      unsigned int size = fragP->tc_frag_data.length;
73f23b
+
73f23b
+      if (size == 0)
73f23b
+	return;
73f23b
+
73f23b
+      if (size > fragP->tc_frag_data.max_bytes)
73f23b
+	abort ();
73f23b
+
73f23b
+      if (flag_debug)
73f23b
+	{
73f23b
+	  const char *msg;
73f23b
+	  const char *branch = "branch";
73f23b
+	  const char *prefix = "";
73f23b
+	  fragS *padding_fragP;
73f23b
+
73f23b
+	  if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype)
73f23b
+	      == BRANCH_PREFIX)
73f23b
+	    {
73f23b
+	      padding_fragP = fragP->tc_frag_data.u.padding_fragP;
73f23b
+	      switch (fragP->tc_frag_data.default_prefix)
73f23b
+		{
73f23b
+		default:
73f23b
+		  abort ();
73f23b
+		  break;
73f23b
+		case CS_PREFIX_OPCODE:
73f23b
+		  prefix = " cs";
73f23b
+		  break;
73f23b
+		case DS_PREFIX_OPCODE:
73f23b
+		  prefix = " ds";
73f23b
+		  break;
73f23b
+		case ES_PREFIX_OPCODE:
73f23b
+		  prefix = " es";
73f23b
+		  break;
73f23b
+		case FS_PREFIX_OPCODE:
73f23b
+		  prefix = " fs";
73f23b
+		  break;
73f23b
+		case GS_PREFIX_OPCODE:
73f23b
+		  prefix = " gs";
73f23b
+		  break;
73f23b
+		case SS_PREFIX_OPCODE:
73f23b
+		  prefix = " ss";
73f23b
+		  break;
73f23b
+		}
73f23b
+	      if (padding_fragP)
73f23b
+		msg = _("%s:%u: add %d%s at 0x%llx to align "
73f23b
+			"%s within %d-byte boundary\n");
73f23b
+	      else
73f23b
+		msg = _("%s:%u: add additional %d%s at 0x%llx to "
73f23b
+			"align %s within %d-byte boundary\n");
73f23b
+	    }
73f23b
+	  else
73f23b
+	    {
73f23b
+	      padding_fragP = fragP;
73f23b
+	      msg = _("%s:%u: add %d%s-byte nop at 0x%llx to align "
73f23b
+		      "%s within %d-byte boundary\n");
73f23b
+	    }
73f23b
+
73f23b
+	  if (padding_fragP)
73f23b
+	    switch (padding_fragP->tc_frag_data.branch_type)
73f23b
+	      {
73f23b
+	      case align_branch_jcc:
73f23b
+		branch = "jcc";
73f23b
+		break;
73f23b
+	      case align_branch_fused:
73f23b
+		branch = "fused jcc";
73f23b
+		break;
73f23b
+	      case align_branch_jmp:
73f23b
+		branch = "jmp";
73f23b
+		break;
73f23b
+	      case align_branch_call:
73f23b
+		branch = "call";
73f23b
+		break;
73f23b
+	      case align_branch_indirect:
73f23b
+		branch = "indiret branch";
73f23b
+		break;
73f23b
+	      case align_branch_ret:
73f23b
+		branch = "ret";
73f23b
+		break;
73f23b
+	      default:
73f23b
+		break;
73f23b
+	      }
73f23b
+
73f23b
+	  fprintf (stdout, msg,
73f23b
+		   fragP->fr_file, fragP->fr_line, size, prefix,
73f23b
+		   (long long) fragP->fr_address, branch,
73f23b
+		   1 << align_branch_power);
73f23b
+	}
73f23b
+
73f23b
+      if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX)
73f23b
+	memset (fragP->fr_opcode,
73f23b
+		fragP->tc_frag_data.default_prefix, size);
73f23b
+      else
73f23b
+	i386_align_code (fragP, size);
73f23b
+      fragP->fr_fix += size;
73f23b
+
73f23b
+      return;
73f23b
+    }
73f23b
+
73f23b
   opcode = (unsigned char *) fragP->fr_opcode;
73f23b
 
73f23b
   /* Address we want to reach in file space.  */
73f23b
@@ -9830,6 +10694,10 @@ const char *md_shortopts = "qn";
73f23b
 #define OPTION_MINTEL64 (OPTION_MD_BASE + 23)
73f23b
 #define OPTION_MFENCE_AS_LOCK_ADD (OPTION_MD_BASE + 24)
73f23b
 #define OPTION_MRELAX_RELOCATIONS (OPTION_MD_BASE + 25)
73f23b
+#define OPTION_MALIGN_BRANCH_BOUNDARY (OPTION_MD_BASE + 27)
73f23b
+#define OPTION_MALIGN_BRANCH_PREFIX_SIZE (OPTION_MD_BASE + 28)
73f23b
+#define OPTION_MALIGN_BRANCH (OPTION_MD_BASE + 29)
73f23b
+#define OPTION_MBRANCHES_WITH_32B_BOUNDARIES (OPTION_MD_BASE + 30)
73f23b
 
73f23b
 struct option md_longopts[] =
73f23b
 {
73f23b
@@ -9864,6 +10732,10 @@ struct option md_longopts[] =
73f23b
   {"mfence-as-lock-add", required_argument, NULL, OPTION_MFENCE_AS_LOCK_ADD},
73f23b
   {"mrelax-relocations", required_argument, NULL, OPTION_MRELAX_RELOCATIONS},
73f23b
   {"mevexrcig", required_argument, NULL, OPTION_MEVEXRCIG},
73f23b
+  {"malign-branch-boundary", required_argument, NULL, OPTION_MALIGN_BRANCH_BOUNDARY},
73f23b
+  {"malign-branch-prefix-size", required_argument, NULL, OPTION_MALIGN_BRANCH_PREFIX_SIZE},
73f23b
+  {"malign-branch", required_argument, NULL, OPTION_MALIGN_BRANCH},
73f23b
+  {"mbranches-within-32B-boundaries", no_argument, NULL, OPTION_MBRANCHES_WITH_32B_BOUNDARIES},
73f23b
   {"mamd64", no_argument, NULL, OPTION_MAMD64},
73f23b
   {"mintel64", no_argument, NULL, OPTION_MINTEL64},
73f23b
   {NULL, no_argument, NULL, 0}
73f23b
@@ -9874,7 +10746,7 @@ int
73f23b
 md_parse_option (int c, const char *arg)
73f23b
 {
73f23b
   unsigned int j;
73f23b
-  char *arch, *next, *saved;
73f23b
+  char *arch, *next, *saved, *type;
73f23b
 
73f23b
   switch (c)
73f23b
     {
73f23b
@@ -9977,6 +10849,82 @@ md_parse_option (int c, const char *arg)
73f23b
 #endif
73f23b
       break;
73f23b
 
73f23b
+    case OPTION_MALIGN_BRANCH_BOUNDARY:
73f23b
+      {
73f23b
+	char *end;
73f23b
+	int align = strtoul (arg, &end, 0);
73f23b
+
73f23b
+	if (*end == '\0')
73f23b
+	  {
73f23b
+	    if (align == 0)
73f23b
+	      {
73f23b
+		align_branch_power = 0;
73f23b
+		break;
73f23b
+	      }
73f23b
+	    else if (align >= 32)
73f23b
+	      {
73f23b
+		int align_power;
73f23b
+
73f23b
+		for (align_power = 0;
73f23b
+		     (align & 1) == 0;
73f23b
+		     align >>= 1, align_power++)
73f23b
+		  continue;
73f23b
+
73f23b
+		if (align == 1)
73f23b
+		  {
73f23b
+		    align_branch_power = align_power;
73f23b
+		    break;
73f23b
+		  }
73f23b
+	      }
73f23b
+	  }
73f23b
+	as_fatal (_("invalid -malign-branch-boundary= value: %s"), arg);
73f23b
+      }
73f23b
+      break;
73f23b
+
73f23b
+    case OPTION_MALIGN_BRANCH_PREFIX_SIZE:
73f23b
+      {
73f23b
+	char *end;
73f23b
+	int align = strtoul (arg, &end, 0);
73f23b
+
73f23b
+	if (*end == '\0' && align >= 0 && align < 6)
73f23b
+	  {
73f23b
+	    align_branch_prefix_size = align;
73f23b
+	    break;
73f23b
+	  }
73f23b
+	as_fatal (_("invalid -malign-branch-prefix-size= value: %s"),
73f23b
+		  arg);
73f23b
+      }
73f23b
+      break;
73f23b
+
73f23b
+    case OPTION_MALIGN_BRANCH:
73f23b
+      align_branch = 0;
73f23b
+      saved = xstrdup (arg);
73f23b
+      type = saved;
73f23b
+      do
73f23b
+	{
73f23b
+	  next = strchr (type, '+');
73f23b
+	  if (next)
73f23b
+	    *next++ = '\0';
73f23b
+	  if (strcasecmp (type, "jcc") == 0)
73f23b
+	    align_branch |= align_branch_jcc;
73f23b
+	  else if (strcasecmp (type, "fused") == 0)
73f23b
+	    align_branch |= align_branch_fused;
73f23b
+	  else if (strcasecmp (type, "jmp") == 0)
73f23b
+	    align_branch |= align_branch_jmp;
73f23b
+	  else if (strcasecmp (type, "call") == 0)
73f23b
+	    align_branch |= align_branch_call;
73f23b
+	  else if (strcasecmp (type, "ret") == 0)
73f23b
+	    align_branch |= align_branch_ret;
73f23b
+	  else if (strcasecmp (type, "indirect") == 0)
73f23b
+	    align_branch |= align_branch_indirect;
73f23b
+	  else
73f23b
+	    as_fatal (_("invalid -malign-branch= option: `%s'"), arg);
73f23b
+	  type = next;
73f23b
+	}
73f23b
+      while (next != NULL);
73f23b
+      free (saved);
73f23b
+      break;
73f23b
+
73f23b
     case OPTION_MARCH:
73f23b
       saved = xstrdup (arg);
73f23b
       arch = saved;
73f23b
@@ -10232,6 +11180,14 @@ md_parse_option (int c, const char *arg)
73f23b
         as_fatal (_("invalid -mrelax-relocations= option: `%s'"), arg);
73f23b
       break;
73f23b
 
73f23b
+    case OPTION_MBRANCHES_WITH_32B_BOUNDARIES:
73f23b
+      align_branch_power = 5;
73f23b
+      align_branch_prefix_size = 5;
73f23b
+      align_branch = (align_branch_jcc
73f23b
+		      | align_branch_fused
73f23b
+		      | align_branch_jmp);
73f23b
+      break;
73f23b
+
73f23b
     case OPTION_MAMD64:
73f23b
       intel64 = 0;
73f23b
       break;
73f23b
@@ -10436,6 +11392,20 @@ md_show_usage (FILE *stream)
73f23b
   -mrelax-relocations=[no|yes]\n\
73f23b
                           generate relax relocations\n"));
73f23b
   fprintf (stream, _("\
73f23b
+  -malign-branch-boundary=NUM (default: 0)\n\
73f23b
+                          align branches within NUM byte boundary\n"));
73f23b
+  fprintf (stream, _("\
73f23b
+  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)\n\
73f23b
+                          TYPE is combination of jcc, fused, jmp, call, ret,\n\
73f23b
+                           indirect\n\
73f23b
+                          specify types of branches to align\n"));
73f23b
+  fprintf (stream, _("\
73f23b
+  -malign-branch-prefix-size=NUM (default: 5)\n\
73f23b
+                          align branches with NUM prefixes per instruction\n"));
73f23b
+  fprintf (stream, _("\
73f23b
+  -mbranches-within-32B-boundaries\n\
73f23b
+                          align branches within 32 byte boundary\n"));
73f23b
+  fprintf (stream, _("\
73f23b
   -mamd64                 accept only AMD64 ISA\n"));
73f23b
   fprintf (stream, _("\
73f23b
   -mintel64               accept only Intel64 ISA\n"));
73f23b
@@ -10519,17 +11489,26 @@ i386_target_format (void)
73f23b
 	  {
73f23b
 	  default:
73f23b
 	    format = ELF_TARGET_FORMAT;
73f23b
+#ifndef TE_SOLARIS
73f23b
+	    tls_get_addr = "___tls_get_addr";
73f23b
+#endif
73f23b
 	    break;
73f23b
 	  case X86_64_ABI:
73f23b
 	    use_rela_relocations = 1;
73f23b
 	    object_64bit = 1;
73f23b
 	    format = ELF_TARGET_FORMAT64;
73f23b
+#ifndef TE_SOLARIS
73f23b
+	    tls_get_addr = "__tls_get_addr";
73f23b
+#endif
73f23b
 	    break;
73f23b
 	  case X86_64_X32_ABI:
73f23b
 	    use_rela_relocations = 1;
73f23b
 	    object_64bit = 1;
73f23b
 	    disallow_64bit_reloc = 1;
73f23b
 	    format = ELF_TARGET_FORMAT32;
73f23b
+#ifndef TE_SOLARIS
73f23b
+	    tls_get_addr = "__tls_get_addr";
73f23b
+#endif
73f23b
 	    break;
73f23b
 	  }
73f23b
 	if (cpu_arch_isa == PROCESSOR_L1OM)
73f23b
@@ -10644,6 +11623,21 @@ s_bss (int ignore ATTRIBUTE_UNUSED)
73f23b
 
73f23b
 #endif
73f23b
 
73f23b
+/* Remember constant diretive.  */
73f23b
+
73f23b
+void
73f23b
+i386_cons_worker (int ignore ATTRIBUTE_UNUSED)
73f23b
+{
73f23b
+  if (last_insn.kind != last_insn_directive
73f23b
+      && (bfd_get_section_flags (NULL, now_seg) & SEC_CODE))
73f23b
+    {
73f23b
+      last_insn.seg = now_seg;
73f23b
+      last_insn.kind = last_insn_directive;
73f23b
+      last_insn.name = "constant diretive";
73f23b
+      last_insn.file = as_where (&last_insn.line);
73f23b
+    }
73f23b
+}
73f23b
+
73f23b
 void
73f23b
 i386_validate_fix (fixS *fixp)
73f23b
 {
73f23b
diff -rup binutils-2.27/gas/config/tc-i386.h binutils.new/gas/config/tc-i386.h
73f23b
--- binutils-2.27/gas/config/tc-i386.h	2016-08-03 08:36:51.000000000 +0100
73f23b
+++ binutils.new/gas/config/tc-i386.h	2019-11-25 12:52:22.213195504 +0000
73f23b
@@ -216,12 +216,19 @@ if (fragP->fr_type == rs_align_code)
73f23b
 			   - fragP->fr_address				\
73f23b
 			   - fragP->fr_fix));
73f23b
 
73f23b
+extern void i386_cons_worker (int);
73f23b
+#define md_cons_align(nbytes) i386_cons_worker (nbytes)
73f23b
+
73f23b
 void i386_print_statistics (FILE *);
73f23b
 #define tc_print_statistics i386_print_statistics
73f23b
 
73f23b
 extern unsigned int i386_frag_max_var (fragS *);
73f23b
 #define md_frag_max_var i386_frag_max_var
73f23b
 
73f23b
+extern long i386_generic_table_relax_frag (segT, fragS *, long);
73f23b
+#define md_generic_table_relax_frag(segment, fragP, stretch) \
73f23b
+  i386_generic_table_relax_frag (segment, fragP, stretch)
73f23b
+
73f23b
 #define md_number_to_chars number_to_chars_littleendian
73f23b
 
73f23b
 enum processor_type
73f23b
@@ -256,9 +263,24 @@ extern i386_cpu_flags cpu_arch_isa_flags
73f23b
 
73f23b
 struct i386_tc_frag_data
73f23b
 {
73f23b
+  union
73f23b
+    {
73f23b
+      fragS *padding_fragP;
73f23b
+      fragS *branch_fragP;
73f23b
+    } u;
73f23b
+  addressT padding_address;
73f23b
   enum processor_type isa;
73f23b
   i386_cpu_flags isa_flags;
73f23b
+  unsigned int max_bytes;
73f23b
   enum processor_type tune;
73f23b
+  signed char length;
73f23b
+  signed char last_length;
73f23b
+  signed char max_prefix_length;
73f23b
+  signed char prefix_length;
73f23b
+  signed char default_prefix;
73f23b
+  signed char cmp_size;
73f23b
+  unsigned int classified : 1;
73f23b
+  unsigned int branch_type : 7;
73f23b
 };
73f23b
 
73f23b
 /* We need to emit the right NOP pattern in .align frags.  This is
73f23b
@@ -269,9 +291,20 @@ struct i386_tc_frag_data
73f23b
 #define TC_FRAG_INIT(FRAGP)					\
73f23b
  do								\
73f23b
    {								\
73f23b
+     (FRAGP)->tc_frag_data.u.padding_fragP = NULL;		\
73f23b
+     (FRAGP)->tc_frag_data.padding_address = 0;			\
73f23b
      (FRAGP)->tc_frag_data.isa = cpu_arch_isa;			\
73f23b
      (FRAGP)->tc_frag_data.isa_flags = cpu_arch_isa_flags;	\
73f23b
      (FRAGP)->tc_frag_data.tune = cpu_arch_tune;		\
73f23b
+     (FRAGP)->tc_frag_data.length = 0;				\
73f23b
+     (FRAGP)->tc_frag_data.max_bytes = max_chars;		\
73f23b
+     (FRAGP)->tc_frag_data.last_length = 0;			\
73f23b
+     (FRAGP)->tc_frag_data.max_prefix_length = 0;		\
73f23b
+     (FRAGP)->tc_frag_data.prefix_length = 0;			\
73f23b
+     (FRAGP)->tc_frag_data.default_prefix = 0;			\
73f23b
+     (FRAGP)->tc_frag_data.cmp_size = 0;			\
73f23b
+     (FRAGP)->tc_frag_data.classified = 0;			\
73f23b
+     (FRAGP)->tc_frag_data.branch_type = 0;			\
73f23b
    }								\
73f23b
  while (0)
73f23b
 
73f23b
diff -rup binutils-2.27/gas/doc/c-i386.texi binutils.new/gas/doc/c-i386.texi
73f23b
--- binutils-2.27/gas/doc/c-i386.texi	2016-08-03 08:36:51.000000000 +0100
73f23b
+++ binutils.new/gas/doc/c-i386.texi	2019-11-25 12:52:22.309194929 +0000
73f23b
@@ -372,6 +372,43 @@ R_X86_64_REX_GOTPCRELX, in 64-bit mode.
73f23b
 relocations.  The default can be controlled by a configure option
73f23b
 @option{--enable-x86-relax-relocations}.
73f23b
 
73f23b
+@cindex @samp{-malign-branch-boundary=} option, i386
73f23b
+@cindex @samp{-malign-branch-boundary=} option, x86-64
73f23b
+@item -malign-branch-boundary=@var{NUM}
73f23b
+This option controls how the assembler should align branches with segment
73f23b
+prefixes or NOP.  @var{NUM} must be a power of 2.  It should be 0 or
73f23b
+no less than 32.  Branches will be aligned within @var{NUM} byte
73f23b
+boundary.  @option{-malign-branch-boundary=0}, which is the default,
73f23b
+doesn't align branches.
73f23b
+
73f23b
+@cindex @samp{-malign-branch=} option, i386
73f23b
+@cindex @samp{-malign-branch=} option, x86-64
73f23b
+@item -malign-branch=@var{TYPE}[+@var{TYPE}...]
73f23b
+This option specifies types of branches to align. @var{TYPE} is
73f23b
+combination of @samp{jcc}, which aligns conditional jumps,
73f23b
+@samp{fused}, which aligns fused conditional jumps, @samp{jmp},
73f23b
+which aligns unconditional jumps, @samp{call} which aligns calls,
73f23b
+@samp{ret}, which aligns rets, @samp{indirect}, which aligns indirect
73f23b
+jumps and calls.  The default is @option{-malign-branch=jcc+fused+jmp}.
73f23b
+
73f23b
+@cindex @samp{-malign-branch-prefix-size=} option, i386
73f23b
+@cindex @samp{-malign-branch-prefix-size=} option, x86-64
73f23b
+@item -malign-branch-prefix-size=@var{NUM}
73f23b
+This option specifies the maximum number of prefixes on an instruction
73f23b
+to align branches.  @var{NUM} should be between 0 and 5.  The default
73f23b
+@var{NUM} is 5.
73f23b
+
73f23b
+@cindex @samp{-mbranches-within-32B-boundaries} option, i386
73f23b
+@cindex @samp{-mbranches-within-32B-boundaries} option, x86-64
73f23b
+@item -mbranches-within-32B-boundaries
73f23b
+This option aligns conditional jumps, fused conditional jumps and
73f23b
+unconditional jumps within 32 byte boundary with up to 5 segment prefixes
73f23b
+on an instruction.  It is equivalent to
73f23b
+@option{-malign-branch-boundary=32}
73f23b
+@option{-malign-branch=jcc+fused+jmp}
73f23b
+@option{-malign-branch-prefix-size=5}.
73f23b
+The default doesn't align branches.
73f23b
+
73f23b
 @cindex @samp{-mevexrcig=} option, i386
73f23b
 @cindex @samp{-mevexrcig=} option, x86-64
73f23b
 @item -mevexrcig=@var{rne}
73f23b
diff -rup binutils-2.27/gas/testsuite/gas/i386/i386.exp binutils.new/gas/testsuite/gas/i386/i386.exp
73f23b
--- binutils-2.27/gas/testsuite/gas/i386/i386.exp	2016-08-03 08:36:51.000000000 +0100
73f23b
+++ binutils.new/gas/testsuite/gas/i386/i386.exp	2019-11-25 12:52:23.314188920 +0000
73f23b
@@ -368,6 +368,20 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
73f23b
     run_dump_test "rdpid-intel"
73f23b
     run_list_test "avx512vl-1" "-al"
73f23b
     run_list_test "avx512vl-2" "-al"
73f23b
+    run_dump_test "align-branch-1a"
73f23b
+    run_dump_test "align-branch-1b"
73f23b
+    run_dump_test "align-branch-1c"
73f23b
+    run_dump_test "align-branch-1d"
73f23b
+    run_dump_test "align-branch-1e"
73f23b
+    run_dump_test "align-branch-1f"
73f23b
+    run_dump_test "align-branch-1g"
73f23b
+    run_dump_test "align-branch-1h"
73f23b
+    run_dump_test "align-branch-2a"
73f23b
+    run_dump_test "align-branch-2b"
73f23b
+    run_dump_test "align-branch-2c"
73f23b
+    run_dump_test "align-branch-4a"
73f23b
+    run_dump_test "align-branch-4b"
73f23b
+    run_dump_test "align-branch-5"
73f23b
 
73f23b
     # These tests require support for 8 and 16 bit relocs,
73f23b
     # so we only run them for ELF and COFF targets.
73f23b
@@ -829,6 +843,24 @@ if [expr ([istarget "i*86-*-*"] || [ista
73f23b
 	run_dump_test "x86-64-gotpcrel-no-relax"
73f23b
 
73f23b
 	run_dump_test "x86-64-addend"
73f23b
+
73f23b
+	if {[istarget "*-*-linux*"]} then {
73f23b
+	    run_dump_test "x86-64-align-branch-1a"
73f23b
+	    run_dump_test "x86-64-align-branch-1b"
73f23b
+	    run_dump_test "x86-64-align-branch-1c"
73f23b
+	    run_dump_test "x86-64-align-branch-1d"
73f23b
+	    run_dump_test "x86-64-align-branch-1e"
73f23b
+	    run_dump_test "x86-64-align-branch-1f"
73f23b
+	    run_dump_test "x86-64-align-branch-1g"
73f23b
+	    run_dump_test "x86-64-align-branch-1h"
73f23b
+	    run_dump_test "x86-64-align-branch-2a"
73f23b
+	    run_dump_test "x86-64-align-branch-2b"
73f23b
+	    run_dump_test "x86-64-align-branch-2c"
73f23b
+	    run_dump_test "x86-64-align-branch-3"
73f23b
+	    run_dump_test "x86-64-align-branch-4a"
73f23b
+	    run_dump_test "x86-64-align-branch-4b"
73f23b
+	    run_dump_test "x86-64-align-branch-5"
73f23b
+	}
73f23b
     }
73f23b
 
73f23b
     set ASFLAGS "$old_ASFLAGS"
73f23b
diff -rup binutils-2.27/gas/write.c binutils.new/gas/write.c
73f23b
--- binutils-2.27/gas/write.c	2016-08-03 08:36:51.000000000 +0100
73f23b
+++ binutils.new/gas/write.c	2019-11-25 12:52:21.804197949 +0000
73f23b
@@ -2773,7 +2773,12 @@ relax_segment (struct frag *segment_frag
73f23b
 #ifdef TC_GENERIC_RELAX_TABLE
73f23b
 		/* The default way to relax a frag is to look through
73f23b
 		   TC_GENERIC_RELAX_TABLE.  */
73f23b
+#ifdef md_generic_table_relax_frag
73f23b
+		growth = md_generic_table_relax_frag (segment, fragP,
73f23b
+						      stretch);
73f23b
+#else
73f23b
 		growth = relax_frag (segment, fragP, stretch);
73f23b
+#endif /* md_generic_table_relax_frag */
73f23b
 #endif /* TC_GENERIC_RELAX_TABLE  */
73f23b
 #endif
73f23b
 		break;
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1a.d	2019-11-20 14:09:25.593915106 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 65 65 a3 01 00 00 00 	gs gs mov %eax,%gs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	39 c5                	cmp    %eax,%ebp
73f23b
+  22:	74 5e                	je     82 <foo\+0x82>
73f23b
+  24:	3e 89 73 f4          	mov    %esi,%ds:-0xc\(%ebx\)
73f23b
+  28:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	5d                   	pop    %ebp
73f23b
+  3e:	5d                   	pop    %ebp
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %ebp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	36 89 44 24 fc       	mov    %eax,%ss:-0x4\(%esp\)
73f23b
+  4a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4d:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  50:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  53:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  56:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  59:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5f:	5d                   	pop    %ebp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  78:	5d                   	pop    %ebp
73f23b
+  79:	5d                   	pop    %ebp
73f23b
+  7a:	39 c5                	cmp    %eax,%ebp
73f23b
+  7c:	74 04                	je     82 <foo\+0x82>
73f23b
+  7e:	66 90                	xchg   %ax,%ax
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a0:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a3:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  c0:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c3:	74 c3                	je     88 <foo\+0x88>
73f23b
+  c5:	74 c1                	je     88 <foo\+0x88>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1b.d	2019-11-20 14:09:25.593915106 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 65 65 a3 01 00 00 00 	gs gs mov %eax,%gs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	39 c5                	cmp    %eax,%ebp
73f23b
+  22:	74 5e                	je     82 <foo\+0x82>
73f23b
+  24:	3e 89 73 f4          	mov    %esi,%ds:-0xc\(%ebx\)
73f23b
+  28:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	5d                   	pop    %ebp
73f23b
+  3e:	5d                   	pop    %ebp
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %ebp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	36 89 44 24 fc       	mov    %eax,%ss:-0x4\(%esp\)
73f23b
+  4a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4d:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  50:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  53:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  56:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  59:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5f:	5d                   	pop    %ebp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  78:	5d                   	pop    %ebp
73f23b
+  79:	5d                   	pop    %ebp
73f23b
+  7a:	39 c5                	cmp    %eax,%ebp
73f23b
+  7c:	74 04                	je     82 <foo\+0x82>
73f23b
+  7e:	66 90                	xchg   %ax,%ax
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a0:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a3:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  c0:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c3:	74 c3                	je     88 <foo\+0x88>
73f23b
+  c5:	74 c1                	je     88 <foo\+0x88>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1c.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1c.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1c.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1c.d	2019-11-20 14:09:25.594915098 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 a3 01 00 00 00    	mov    %eax,%gs:0x1
73f23b
+   6:	3e 55                	ds push %ebp
73f23b
+   8:	3e 55                	ds push %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	39 c5                	cmp    %eax,%ebp
73f23b
+  22:	74 5e                	je     82 <foo\+0x82>
73f23b
+  24:	3e 89 73 f4          	mov    %esi,%ds:-0xc\(%ebx\)
73f23b
+  28:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	5d                   	pop    %ebp
73f23b
+  3e:	5d                   	pop    %ebp
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %ebp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	36 89 44 24 fc       	mov    %eax,%ss:-0x4\(%esp\)
73f23b
+  4a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4d:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  50:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  53:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  56:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  59:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5f:	5d                   	pop    %ebp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  78:	5d                   	pop    %ebp
73f23b
+  79:	5d                   	pop    %ebp
73f23b
+  7a:	39 c5                	cmp    %eax,%ebp
73f23b
+  7c:	74 04                	je     82 <foo\+0x82>
73f23b
+  7e:	66 90                	xchg   %ax,%ax
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a0:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a3:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  c0:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c3:	74 c3                	je     88 <foo\+0x88>
73f23b
+  c5:	74 c1                	je     88 <foo\+0x88>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1d.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1d.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1d.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1d.d	2019-11-20 14:09:25.594915098 +0000
73f23b
@@ -0,0 +1,76 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 65 65 a3 01 00 00 00 	gs gs mov %eax,%gs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	39 c5                	cmp    %eax,%ebp
73f23b
+  22:	74 5b                	je     7f <foo\+0x7f>
73f23b
+  24:	3e 89 73 f4          	mov    %esi,%ds:-0xc\(%ebx\)
73f23b
+  28:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	5d                   	pop    %ebp
73f23b
+  3e:	5d                   	pop    %ebp
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 3d                	je     7f <foo\+0x7f>
73f23b
+  42:	5d                   	pop    %ebp
73f23b
+  43:	74 3a                	je     7f <foo\+0x7f>
73f23b
+  45:	89 44 24 fc          	mov    %eax,-0x4\(%esp\)
73f23b
+  49:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5e:	5d                   	pop    %ebp
73f23b
+  5f:	eb 24                	jmp    85 <foo\+0x85>
73f23b
+  61:	eb 22                	jmp    85 <foo\+0x85>
73f23b
+  63:	eb 20                	jmp    85 <foo\+0x85>
73f23b
+  65:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  68:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  74:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  77:	5d                   	pop    %ebp
73f23b
+  78:	5d                   	pop    %ebp
73f23b
+  79:	39 c5                	cmp    %eax,%ebp
73f23b
+  7b:	74 02                	je     7f <foo\+0x7f>
73f23b
+  7d:	eb 06                	jmp    85 <foo\+0x85>
73f23b
+  7f:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  82:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  85:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8b:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  91:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  97:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9d:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a0:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a5:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ab:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b1:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b7:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  bd:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c0:	74 c3                	je     85 <foo\+0x85>
73f23b
+  c2:	74 c1                	je     85 <foo\+0x85>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1e.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1e.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1e.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1e.d	2019-11-20 14:09:25.594915098 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 a3 01 00 00 00    	mov    %eax,%gs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	89 e5                	mov    %esp,%ebp
73f23b
+   c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1e:	39 c5                	cmp    %eax,%ebp
73f23b
+  20:	74 5a                	je     7c <foo\+0x7c>
73f23b
+  22:	89 73 f4             	mov    %esi,-0xc\(%ebx\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	5d                   	pop    %ebp
73f23b
+  3b:	5d                   	pop    %ebp
73f23b
+  3c:	5d                   	pop    %ebp
73f23b
+  3d:	74 3d                	je     7c <foo\+0x7c>
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 3a                	je     7c <foo\+0x7c>
73f23b
+  42:	89 44 24 fc          	mov    %eax,-0x4\(%esp\)
73f23b
+  46:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  49:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  4c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5b:	5d                   	pop    %ebp
73f23b
+  5c:	eb 24                	jmp    82 <foo\+0x82>
73f23b
+  5e:	eb 22                	jmp    82 <foo\+0x82>
73f23b
+  60:	eb 20                	jmp    82 <foo\+0x82>
73f23b
+  62:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  65:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  68:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  74:	5d                   	pop    %ebp
73f23b
+  75:	5d                   	pop    %ebp
73f23b
+  76:	39 c5                	cmp    %eax,%ebp
73f23b
+  78:	74 02                	je     7c <foo\+0x7c>
73f23b
+  7a:	eb 06                	jmp    82 <foo\+0x82>
73f23b
+  7c:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  7f:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  82:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  9d:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  bd:	74 c3                	je     82 <foo\+0x82>
73f23b
+  bf:	90                   	nop
73f23b
+  c0:	74 c0                	je     82 <foo\+0x82>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1f.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1f.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1f.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1f.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 a3 01 00 00 00    	mov    %eax,%gs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	89 e5                	mov    %esp,%ebp
73f23b
+   c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1e:	39 c5                	cmp    %eax,%ebp
73f23b
+  20:	74 5c                	je     7e <foo\+0x7e>
73f23b
+  22:	89 73 f4             	mov    %esi,-0xc\(%ebx\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	5d                   	pop    %ebp
73f23b
+  3b:	5d                   	pop    %ebp
73f23b
+  3c:	5d                   	pop    %ebp
73f23b
+  3d:	74 3f                	je     7e <foo\+0x7e>
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 3c                	je     7e <foo\+0x7e>
73f23b
+  42:	89 44 24 fc          	mov    %eax,-0x4\(%esp\)
73f23b
+  46:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  49:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  4c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5b:	5d                   	pop    %ebp
73f23b
+  5c:	eb 27                	jmp    85 <foo\+0x85>
73f23b
+  5e:	66 90                	xchg   %ax,%ax
73f23b
+  60:	eb 23                	jmp    85 <foo\+0x85>
73f23b
+  62:	eb 21                	jmp    85 <foo\+0x85>
73f23b
+  64:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  67:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6a:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  70:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  73:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  76:	5d                   	pop    %ebp
73f23b
+  77:	5d                   	pop    %ebp
73f23b
+  78:	39 c5                	cmp    %eax,%ebp
73f23b
+  7a:	74 02                	je     7e <foo\+0x7e>
73f23b
+  7c:	eb 07                	jmp    85 <foo\+0x85>
73f23b
+  7e:	36 8b 45 f4          	mov    %ss:-0xc\(%ebp\),%eax
73f23b
+  82:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  85:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8b:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  91:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  97:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9d:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a0:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a5:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ab:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b1:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b7:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  bd:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c0:	74 c3                	je     85 <foo\+0x85>
73f23b
+  c2:	74 c1                	je     85 <foo\+0x85>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1g.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1g.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1g.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1g.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,77 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -mbranches-within-32B-boundaries
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 65 65 a3 01 00 00 00 	gs gs mov %eax,%gs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	39 c5                	cmp    %eax,%ebp
73f23b
+  22:	74 5e                	je     82 <foo\+0x82>
73f23b
+  24:	3e 89 73 f4          	mov    %esi,%ds:-0xc\(%ebx\)
73f23b
+  28:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2b:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	5d                   	pop    %ebp
73f23b
+  3e:	5d                   	pop    %ebp
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %ebp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	36 89 44 24 fc       	mov    %eax,%ss:-0x4\(%esp\)
73f23b
+  4a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4d:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  50:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  53:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  56:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  59:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5f:	5d                   	pop    %ebp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  78:	5d                   	pop    %ebp
73f23b
+  79:	5d                   	pop    %ebp
73f23b
+  7a:	39 c5                	cmp    %eax,%ebp
73f23b
+  7c:	74 04                	je     82 <foo\+0x82>
73f23b
+  7e:	66 90                	xchg   %ax,%ax
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a0:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  a3:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  c0:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  c3:	74 c3                	je     88 <foo\+0x88>
73f23b
+  c5:	74 c1                	je     88 <foo\+0x88>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1h.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1h.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1h.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1h.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,76 @@
73f23b
+#source: align-branch-1.s
73f23b
+#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	65 a3 01 00 00 00    	mov    %eax,%gs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	89 e5                	mov    %esp,%ebp
73f23b
+   c:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1e:	39 c5                	cmp    %eax,%ebp
73f23b
+  20:	74 5a                	je     7c <foo\+0x7c>
73f23b
+  22:	89 73 f4             	mov    %esi,-0xc\(%ebx\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	5d                   	pop    %ebp
73f23b
+  3b:	5d                   	pop    %ebp
73f23b
+  3c:	5d                   	pop    %ebp
73f23b
+  3d:	74 3d                	je     7c <foo\+0x7c>
73f23b
+  3f:	5d                   	pop    %ebp
73f23b
+  40:	74 3a                	je     7c <foo\+0x7c>
73f23b
+  42:	89 44 24 fc          	mov    %eax,-0x4\(%esp\)
73f23b
+  46:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  49:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  4c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5b:	5d                   	pop    %ebp
73f23b
+  5c:	eb 24                	jmp    82 <foo\+0x82>
73f23b
+  5e:	eb 22                	jmp    82 <foo\+0x82>
73f23b
+  60:	eb 20                	jmp    82 <foo\+0x82>
73f23b
+  62:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  65:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  68:	89 7d f8             	mov    %edi,-0x8\(%ebp\)
73f23b
+  6b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  74:	5d                   	pop    %ebp
73f23b
+  75:	5d                   	pop    %ebp
73f23b
+  76:	39 c5                	cmp    %eax,%ebp
73f23b
+  78:	74 02                	je     7c <foo\+0x7c>
73f23b
+  7a:	eb 06                	jmp    82 <foo\+0x82>
73f23b
+  7c:	8b 45 f4             	mov    -0xc\(%ebp\),%eax
73f23b
+  7f:	89 45 fc             	mov    %eax,-0x4\(%ebp\)
73f23b
+  82:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  9a:	89 75 0c             	mov    %esi,0xc\(%ebp\)
73f23b
+  9d:	e9 [0-9a-f ]+       	jmp    .*
73f23b
+  a2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  a8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ae:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  b4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%ebp\)
73f23b
+  ba:	89 75 00             	mov    %esi,0x0\(%ebp\)
73f23b
+  bd:	74 c3                	je     82 <foo\+0x82>
73f23b
+  bf:	74 c1                	je     82 <foo\+0x82>
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1.s binutils-2.30/gas/testsuite/gas/i386/align-branch-1.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-1.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1.s	2019-11-20 14:09:25.592915114 +0000
73f23b
@@ -0,0 +1,72 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl	%eax, %gs:0x1
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %edi, -8(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  cmp  %eax, %ebp
73f23b
+  je  .L_2
73f23b
+  movl  %esi, -12(%ebx)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %edi, -8(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  popl  %ebp
73f23b
+  popl  %ebp
73f23b
+  popl  %ebp
73f23b
+  je  .L_2
73f23b
+  popl  %ebp
73f23b
+  je  .L_2
73f23b
+  movl  %eax, -4(%esp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %edi, -8(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  popl  %ebp
73f23b
+  jmp  .L_3
73f23b
+  jmp  .L_3
73f23b
+  jmp  .L_3
73f23b
+  movl  %eax, -4(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %edi, -8(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  popl  %ebp
73f23b
+  popl  %ebp
73f23b
+  cmp  %eax, %ebp
73f23b
+  je  .L_2
73f23b
+  jmp  .L_3
73f23b
+.L_2:
73f23b
+  movl  -12(%ebp), %eax
73f23b
+  movl  %eax, -4(%ebp)
73f23b
+.L_3:
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, 12(%ebp)
73f23b
+  jmp  bar
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, -1200(%ebp)
73f23b
+  movl  %esi, (%ebp)
73f23b
+  je .L_3
73f23b
+  je .L_3
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-2a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2a.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,55 @@
73f23b
+#source: align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	89 e5                	mov    %esp,%ebp
73f23b
+   c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1e:	ff e0                	jmp    \*%eax
73f23b
+  20:	55                   	push   %ebp
73f23b
+  21:	55                   	push   %ebp
73f23b
+  22:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  28:	89 e5                	mov    %esp,%ebp
73f23b
+  2a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  30:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  33:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  36:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  39:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3c:	ff d0                	call   \*%eax
73f23b
+  3e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  41:	55                   	push   %ebp
73f23b
+  42:	55                   	push   %ebp
73f23b
+  43:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  49:	89 e5                	mov    %esp,%ebp
73f23b
+  4b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  4e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  51:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  57:	e8 [0-9a-f ]+       	call   .*
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5f:	55                   	push   %ebp
73f23b
+  60:	55                   	push   %ebp
73f23b
+  61:	55                   	push   %ebp
73f23b
+  62:	55                   	push   %ebp
73f23b
+  63:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  69:	89 e5                	mov    %esp,%ebp
73f23b
+  6b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  71:	ff 15 00 00 00 00    	call   \*0x0
73f23b
+  77:	55                   	push   %ebp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-2b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2b.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,55 @@
73f23b
+#source: align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 a3 01 00 00 00 	fs fs mov %eax,%fs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	ff e0                	jmp    \*%eax
73f23b
+  22:	3e 3e 55             	ds ds push %ebp
73f23b
+  25:	55                   	push   %ebp
73f23b
+  26:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  2c:	89 e5                	mov    %esp,%ebp
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  40:	ff d0                	call   \*%eax
73f23b
+  42:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  45:	55                   	push   %ebp
73f23b
+  46:	55                   	push   %ebp
73f23b
+  47:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  4d:	89 e5                	mov    %esp,%ebp
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5b:	e8 [0-9a-f ]+       	call   .*
73f23b
+  60:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  63:	55                   	push   %ebp
73f23b
+  64:	55                   	push   %ebp
73f23b
+  65:	55                   	push   %ebp
73f23b
+  66:	55                   	push   %ebp
73f23b
+  67:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  6d:	89 e5                	mov    %esp,%ebp
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  75:	ff 15 00 00 00 00    	call   \*0x0
73f23b
+  7b:	55                   	push   %ebp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2c.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2c.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-2c.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2c.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,55 @@
73f23b
+#source: align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 a3 01 00 00 00 	fs fs mov %eax,%fs:0x1
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	ff e0                	jmp    \*%eax
73f23b
+  22:	3e 3e 55             	ds ds push %ebp
73f23b
+  25:	55                   	push   %ebp
73f23b
+  26:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  2c:	89 e5                	mov    %esp,%ebp
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  40:	ff d0                	call   \*%eax
73f23b
+  42:	36 36 36 36 36 89 75 f4 	ss ss ss ss mov %esi,%ss:-0xc\(%ebp\)
73f23b
+  4a:	55                   	push   %ebp
73f23b
+  4b:	55                   	push   %ebp
73f23b
+  4c:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  52:	89 e5                	mov    %esp,%ebp
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  57:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  5d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  60:	e8 [0-9a-f ]+       	call   .*
73f23b
+  65:	36 36 36 36 36 89 75 f4 	ss ss ss ss mov %esi,%ss:-0xc\(%ebp\)
73f23b
+  6d:	3e 55                	ds push %ebp
73f23b
+  6f:	55                   	push   %ebp
73f23b
+  70:	55                   	push   %ebp
73f23b
+  71:	55                   	push   %ebp
73f23b
+  72:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  78:	89 e5                	mov    %esp,%ebp
73f23b
+  7a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  7d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  80:	ff 15 00 00 00 00    	call   \*0x0
73f23b
+  86:	55                   	push   %ebp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2.s binutils-2.30/gas/testsuite/gas/i386/align-branch-2.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-2.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2.s	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,49 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  jmp  *%eax
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  call *%eax
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  call  foo
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  call  *foo
73f23b
+  pushl  %ebp
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-3.d binutils-2.30/gas/testsuite/gas/i386/align-branch-3.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-3.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-3.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,33 @@
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	89 e5                	mov    %esp,%ebp
73f23b
+   c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1e:	e8 fc ff ff ff       	call   1f <foo\+0x1f>
73f23b
+  23:	55                   	push   %ebp
73f23b
+  24:	55                   	push   %ebp
73f23b
+  25:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  2b:	89 e5                	mov    %esp,%ebp
73f23b
+  2d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  30:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  33:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  36:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  39:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3c:	ff 91 00 00 00 00    	call   \*0x0\(%ecx\)
73f23b
+  42:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-3.s binutils-2.30/gas/testsuite/gas/i386/align-branch-3.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-3.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-3.s	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,28 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  call	___tls_get_addr
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  call *___tls_get_addr@GOT(%ecx)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-4a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-4a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4a.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,36 @@
73f23b
+#source: align-branch-4.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+   6:	55                   	push   %ebp
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	89 e5                	mov    %esp,%ebp
73f23b
+   d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  10:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  13:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  16:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  19:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1c:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1f:	c3                   	ret    
73f23b
+  20:	55                   	push   %ebp
73f23b
+  21:	55                   	push   %ebp
73f23b
+  22:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  28:	89 e5                	mov    %esp,%ebp
73f23b
+  2a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  2d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  30:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  33:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  36:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  39:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3c:	c2 1e 00             	ret    \$0x1e
73f23b
+  3f:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-4b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-4b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4b.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,36 @@
73f23b
+#source: align-branch-4.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=ret
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 a3 01 00 00 00 	fs mov %eax,%fs:0x1
73f23b
+   7:	55                   	push   %ebp
73f23b
+   8:	55                   	push   %ebp
73f23b
+   9:	55                   	push   %ebp
73f23b
+   a:	55                   	push   %ebp
73f23b
+   b:	55                   	push   %ebp
73f23b
+   c:	89 e5                	mov    %esp,%ebp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  20:	c3                   	ret    
73f23b
+  21:	3e 3e 3e 55          	ds ds ds push %ebp
73f23b
+  25:	55                   	push   %ebp
73f23b
+  26:	64 a3 01 00 00 00    	mov    %eax,%fs:0x1
73f23b
+  2c:	89 e5                	mov    %esp,%ebp
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+  40:	c2 1e 00             	ret    \$0x1e
73f23b
+  43:	89 75 f4             	mov    %esi,-0xc\(%ebp\)
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4.s binutils-2.30/gas/testsuite/gas/i386/align-branch-4.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-4.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4.s	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,30 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  ret
73f23b
+  pushl  %ebp
73f23b
+  pushl  %ebp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movl  %esp, %ebp
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  movl  %esi, -12(%ebp)
73f23b
+  ret	$30
73f23b
+  movl  %esi, -12(%ebp)
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-5.d binutils-2.30/gas/testsuite/gas/i386/align-branch-5.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-5.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-5.d	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,36 @@
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   3:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   6:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   9:	89 d1                	mov    %edx,%ecx
73f23b
+   b:	31 c0                	xor    %eax,%eax
73f23b
+   d:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  10:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  13:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  16:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  19:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  1c:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  1f:	f6 c2 02             	test   \$0x2,%dl
73f23b
+  22:	f3 ab                	rep stos %eax,%es:\(%edi\)
73f23b
+  24:	75 dd                	jne    3 <foo\+0x3>
73f23b
+  26:	31 c0                	xor    %eax,%eax
73f23b
+  28:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  2b:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  2e:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  31:	89 d1                	mov    %edx,%ecx
73f23b
+  33:	31 c0                	xor    %eax,%eax
73f23b
+  35:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  38:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  3b:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  3e:	f6 c2 02             	test   \$0x2,%dl
73f23b
+  41:	e8 [0-9a-f ]+       	call   .*
73f23b
+  46:	75 e3                	jne    2b <foo\+0x2b>
73f23b
+  48:	31 c0                	xor    %eax,%eax
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-5.s binutils-2.30/gas/testsuite/gas/i386/align-branch-5.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/align-branch-5.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/align-branch-5.s	2019-11-20 14:09:25.595915091 +0000
73f23b
@@ -0,0 +1,32 @@
73f23b
+	.text
73f23b
+	.p2align 4,,15
73f23b
+foo:
73f23b
+	shrl	$2, %ecx
73f23b
+.L1:
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	movl	%edx, %ecx
73f23b
+	xorl	%eax, %eax
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	testb	$2, %dl
73f23b
+	rep stosl
73f23b
+	jne	.L1
73f23b
+	xorl	%eax, %eax
73f23b
+	shrl	$2, %ecx
73f23b
+.L2:
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	movl	%edx, %ecx
73f23b
+	xorl	%eax, %eax
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	shrl	$2, %ecx
73f23b
+	testb	$2, %dl
73f23b
+	call	bar
73f23b
+	jne	.L2
73f23b
+	xorl	%eax, %eax
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1a.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,75 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 64 89 04 25 01 00 00 00 	fs fs fs mov %eax,%fs:0x1
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  23:	74 5d                	je     82 <foo\+0x82>
73f23b
+  25:	2e 89 75 f4          	mov    %esi,%cs:-0xc\(%rbp\)
73f23b
+  29:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  32:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  35:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  38:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	5d                   	pop    %rbp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %rbp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	2e 89 45 fc          	mov    %eax,%cs:-0x4\(%rbp\)
73f23b
+  49:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5e:	5d                   	pop    %rbp
73f23b
+  5f:	5d                   	pop    %rbp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  78:	5d                   	pop    %rbp
73f23b
+  79:	5d                   	pop    %rbp
73f23b
+  7a:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7d:	74 03                	je     82 <foo\+0x82>
73f23b
+  7f:	90                   	nop
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ac:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  be:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c4:	eb c2                	jmp    88 <foo\+0x88>
73f23b
+  c6:	5d                   	pop    %rbp
73f23b
+  c7:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1b.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,75 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 64 89 04 25 01 00 00 00 	fs fs fs mov %eax,%fs:0x1
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  23:	74 5d                	je     82 <foo\+0x82>
73f23b
+  25:	2e 89 75 f4          	mov    %esi,%cs:-0xc\(%rbp\)
73f23b
+  29:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  32:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  35:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  38:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	5d                   	pop    %rbp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %rbp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	2e 89 45 fc          	mov    %eax,%cs:-0x4\(%rbp\)
73f23b
+  49:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5e:	5d                   	pop    %rbp
73f23b
+  5f:	5d                   	pop    %rbp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  78:	5d                   	pop    %rbp
73f23b
+  79:	5d                   	pop    %rbp
73f23b
+  7a:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7d:	74 03                	je     82 <foo\+0x82>
73f23b
+  7f:	90                   	nop
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ac:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  be:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c4:	eb c2                	jmp    88 <foo\+0x88>
73f23b
+  c6:	5d                   	pop    %rbp
73f23b
+  c7:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1c.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1c.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1c.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1c.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,75 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	2e 55                	cs push %rbp
73f23b
+   a:	2e 55                	cs push %rbp
73f23b
+   c:	2e 55                	cs push %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  23:	74 5d                	je     82 <foo\+0x82>
73f23b
+  25:	2e 89 75 f4          	mov    %esi,%cs:-0xc\(%rbp\)
73f23b
+  29:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  32:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  35:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  38:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	5d                   	pop    %rbp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %rbp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	2e 89 45 fc          	mov    %eax,%cs:-0x4\(%rbp\)
73f23b
+  49:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5e:	5d                   	pop    %rbp
73f23b
+  5f:	5d                   	pop    %rbp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  78:	5d                   	pop    %rbp
73f23b
+  79:	5d                   	pop    %rbp
73f23b
+  7a:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7d:	74 03                	je     82 <foo\+0x82>
73f23b
+  7f:	90                   	nop
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ac:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  be:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c4:	eb c2                	jmp    88 <foo\+0x88>
73f23b
+  c6:	5d                   	pop    %rbp
73f23b
+  c7:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1d.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1d.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1d.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,74 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 64 89 04 25 01 00 00 00 	fs fs fs mov %eax,%fs:0x1
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  23:	74 5b                	je     80 <foo\+0x80>
73f23b
+  25:	2e 89 75 f4          	mov    %esi,%cs:-0xc\(%rbp\)
73f23b
+  29:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  32:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  35:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  38:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	5d                   	pop    %rbp
73f23b
+  40:	74 3e                	je     80 <foo\+0x80>
73f23b
+  42:	5d                   	pop    %rbp
73f23b
+  43:	74 3b                	je     80 <foo\+0x80>
73f23b
+  45:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  48:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4b:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  51:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  57:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5d:	5d                   	pop    %rbp
73f23b
+  5e:	5d                   	pop    %rbp
73f23b
+  5f:	eb 25                	jmp    86 <foo\+0x86>
73f23b
+  61:	eb 23                	jmp    86 <foo\+0x86>
73f23b
+  63:	eb 21                	jmp    86 <foo\+0x86>
73f23b
+  65:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  68:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6b:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  74:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  77:	5d                   	pop    %rbp
73f23b
+  78:	5d                   	pop    %rbp
73f23b
+  79:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7c:	74 02                	je     80 <foo\+0x80>
73f23b
+  7e:	eb 06                	jmp    86 <foo\+0x86>
73f23b
+  80:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  83:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  86:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8c:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  92:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  98:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a4:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  aa:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  bc:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c2:	eb c2                	jmp    86 <foo\+0x86>
73f23b
+  c4:	5d                   	pop    %rbp
73f23b
+  c5:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1e.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1e.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1e.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1e.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,74 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  20:	74 5b                	je     7d <foo\+0x7d>
73f23b
+  22:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	5d                   	pop    %rbp
73f23b
+  3b:	5d                   	pop    %rbp
73f23b
+  3c:	74 3f                	je     7d <foo\+0x7d>
73f23b
+  3e:	2e 5d                	cs pop %rbp
73f23b
+  40:	74 3b                	je     7d <foo\+0x7d>
73f23b
+  42:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  45:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  48:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  51:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  57:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5a:	5d                   	pop    %rbp
73f23b
+  5b:	5d                   	pop    %rbp
73f23b
+  5c:	eb 25                	jmp    83 <foo\+0x83>
73f23b
+  5e:	eb 23                	jmp    83 <foo\+0x83>
73f23b
+  60:	eb 21                	jmp    83 <foo\+0x83>
73f23b
+  62:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  65:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  68:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  74:	5d                   	pop    %rbp
73f23b
+  75:	5d                   	pop    %rbp
73f23b
+  76:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  79:	74 02                	je     7d <foo\+0x7d>
73f23b
+  7b:	eb 06                	jmp    83 <foo\+0x83>
73f23b
+  7d:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  80:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  83:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  89:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8f:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  95:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9b:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a1:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a7:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ad:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b3:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b9:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  bf:	eb c2                	jmp    83 <foo\+0x83>
73f23b
+  c1:	5d                   	pop    %rbp
73f23b
+  c2:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1f.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1f.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1f.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,75 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  20:	74 5d                	je     7f <foo\+0x7f>
73f23b
+  22:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	5d                   	pop    %rbp
73f23b
+  3b:	5d                   	pop    %rbp
73f23b
+  3c:	74 41                	je     7f <foo\+0x7f>
73f23b
+  3e:	2e 5d                	cs pop %rbp
73f23b
+  40:	74 3d                	je     7f <foo\+0x7f>
73f23b
+  42:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  45:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  48:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  51:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  57:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5a:	5d                   	pop    %rbp
73f23b
+  5b:	5d                   	pop    %rbp
73f23b
+  5c:	eb 27                	jmp    85 <foo\+0x85>
73f23b
+  5e:	66 90                	xchg   %ax,%ax
73f23b
+  60:	eb 23                	jmp    85 <foo\+0x85>
73f23b
+  62:	eb 21                	jmp    85 <foo\+0x85>
73f23b
+  64:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  67:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6a:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  70:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  73:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  76:	5d                   	pop    %rbp
73f23b
+  77:	5d                   	pop    %rbp
73f23b
+  78:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7b:	74 02                	je     7f <foo\+0x7f>
73f23b
+  7d:	eb 06                	jmp    85 <foo\+0x85>
73f23b
+  7f:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  82:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  85:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8b:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  91:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  97:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9d:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a3:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a9:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  af:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b5:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  bb:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c1:	eb c2                	jmp    85 <foo\+0x85>
73f23b
+  c3:	5d                   	pop    %rbp
73f23b
+  c4:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1g.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1g.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1g.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1g.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,75 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -mbranches-within-32B-boundaries
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 64 89 04 25 01 00 00 00 	fs fs fs mov %eax,%fs:0x1
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  23:	74 5d                	je     82 <foo\+0x82>
73f23b
+  25:	2e 89 75 f4          	mov    %esi,%cs:-0xc\(%rbp\)
73f23b
+  29:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  32:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  35:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  38:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	5d                   	pop    %rbp
73f23b
+  40:	74 40                	je     82 <foo\+0x82>
73f23b
+  42:	5d                   	pop    %rbp
73f23b
+  43:	74 3d                	je     82 <foo\+0x82>
73f23b
+  45:	2e 89 45 fc          	mov    %eax,%cs:-0x4\(%rbp\)
73f23b
+  49:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5e:	5d                   	pop    %rbp
73f23b
+  5f:	5d                   	pop    %rbp
73f23b
+  60:	eb 26                	jmp    88 <foo\+0x88>
73f23b
+  62:	eb 24                	jmp    88 <foo\+0x88>
73f23b
+  64:	eb 22                	jmp    88 <foo\+0x88>
73f23b
+  66:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  69:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6c:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  72:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  75:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  78:	5d                   	pop    %rbp
73f23b
+  79:	5d                   	pop    %rbp
73f23b
+  7a:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  7d:	74 03                	je     82 <foo\+0x82>
73f23b
+  7f:	90                   	nop
73f23b
+  80:	eb 06                	jmp    88 <foo\+0x88>
73f23b
+  82:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  85:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ac:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  be:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  c4:	eb c2                	jmp    88 <foo\+0x88>
73f23b
+  c6:	5d                   	pop    %rbp
73f23b
+  c7:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1h.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1h.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1h.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1h.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,74 @@
73f23b
+#source: x86-64-align-branch-1.s
73f23b
+#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  20:	74 5a                	je     7c <foo\+0x7c>
73f23b
+  22:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  25:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  28:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	5d                   	pop    %rbp
73f23b
+  3b:	5d                   	pop    %rbp
73f23b
+  3c:	74 3e                	je     7c <foo\+0x7c>
73f23b
+  3e:	5d                   	pop    %rbp
73f23b
+  3f:	74 3b                	je     7c <foo\+0x7c>
73f23b
+  41:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  44:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  47:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  4a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  4d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  50:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  53:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  56:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  59:	5d                   	pop    %rbp
73f23b
+  5a:	5d                   	pop    %rbp
73f23b
+  5b:	eb 25                	jmp    82 <foo\+0x82>
73f23b
+  5d:	eb 23                	jmp    82 <foo\+0x82>
73f23b
+  5f:	eb 21                	jmp    82 <foo\+0x82>
73f23b
+  61:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  64:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  67:	89 7d f8             	mov    %edi,-0x8\(%rbp\)
73f23b
+  6a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  6d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  70:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  73:	5d                   	pop    %rbp
73f23b
+  74:	5d                   	pop    %rbp
73f23b
+  75:	48 39 c5             	cmp    %rax,%rbp
73f23b
+  78:	74 02                	je     7c <foo\+0x7c>
73f23b
+  7a:	eb 06                	jmp    82 <foo\+0x82>
73f23b
+  7c:	8b 45 f4             	mov    -0xc\(%rbp\),%eax
73f23b
+  7f:	89 45 fc             	mov    %eax,-0x4\(%rbp\)
73f23b
+  82:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  88:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  8e:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  94:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  9a:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a0:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  a6:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  ac:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b2:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  b8:	89 b5 50 fb ff ff    	mov    %esi,-0x4b0\(%rbp\)
73f23b
+  be:	eb c2                	jmp    82 <foo\+0x82>
73f23b
+  c0:	5d                   	pop    %rbp
73f23b
+  c1:	c3                   	retq   
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1.s	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,70 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  cmp  %rax, %rbp
73f23b
+  je  .L_2
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %edi, -8(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  popq  %rbp
73f23b
+  popq  %rbp
73f23b
+  je  .L_2
73f23b
+  popq  %rbp
73f23b
+  je  .L_2
73f23b
+  movl  %eax, -4(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %edi, -8(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  popq  %rbp
73f23b
+  popq  %rbp
73f23b
+  jmp  .L_3
73f23b
+  jmp  .L_3
73f23b
+  jmp  .L_3
73f23b
+  movl  %eax, -4(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %edi, -8(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  popq  %rbp
73f23b
+  popq  %rbp
73f23b
+  cmp  %rax, %rbp
73f23b
+  je  .L_2
73f23b
+  jmp  .L_3
73f23b
+.L_2:
73f23b
+  movl  -12(%rbp), %eax
73f23b
+  movl  %eax, -4(%rbp)
73f23b
+.L_3:
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  movl  %esi, -1200(%rbp)
73f23b
+  jmp  .L_3
73f23b
+  popq  %rbp
73f23b
+  retq
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2a.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,50 @@
73f23b
+#source: x86-64-align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1e:	ff e0                	jmpq   \*%rax
73f23b
+  20:	55                   	push   %rbp
73f23b
+  21:	55                   	push   %rbp
73f23b
+  22:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  2a:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  2d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  30:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  33:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  36:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  39:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3c:	ff d0                	callq  \*%rax
73f23b
+  3e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  41:	55                   	push   %rbp
73f23b
+  42:	55                   	push   %rbp
73f23b
+  43:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  4b:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  4e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  51:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  54:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  57:	e8 [0-9a-f ]+       	callq  .*
73f23b
+  5c:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5f:	55                   	push   %rbp
73f23b
+  60:	55                   	push   %rbp
73f23b
+  61:	55                   	push   %rbp
73f23b
+  62:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  6a:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  6d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  70:	ff 14 25 00 00 00 00 	callq  \*0x0
73f23b
+  77:	55                   	push   %rbp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2b.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,50 @@
73f23b
+#source: x86-64-align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 89 04 25 01 00 00 00 	fs fs mov %eax,%fs:0x1
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	ff e0                	jmpq   \*%rax
73f23b
+  22:	2e 2e 55             	cs cs push %rbp
73f23b
+  25:	55                   	push   %rbp
73f23b
+  26:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  2e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  40:	ff d0                	callq  \*%rax
73f23b
+  42:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  45:	55                   	push   %rbp
73f23b
+  46:	55                   	push   %rbp
73f23b
+  47:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  4f:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  52:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  55:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  58:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5b:	e8 [0-9a-f ]+       	callq  .*
73f23b
+  60:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  63:	55                   	push   %rbp
73f23b
+  64:	55                   	push   %rbp
73f23b
+  65:	55                   	push   %rbp
73f23b
+  66:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  6e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  71:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  74:	ff 14 25 00 00 00 00 	callq  \*0x0
73f23b
+  7b:	55                   	push   %rbp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2c.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2c.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2c.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,50 @@
73f23b
+#source: x86-64-align-branch-2.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 64 89 04 25 01 00 00 00 	fs fs mov %eax,%fs:0x1
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	55                   	push   %rbp
73f23b
+   d:	55                   	push   %rbp
73f23b
+   e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	ff e0                	jmpq   \*%rax
73f23b
+  22:	2e 2e 55             	cs cs push %rbp
73f23b
+  25:	55                   	push   %rbp
73f23b
+  26:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  2e:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  40:	ff d0                	callq  \*%rax
73f23b
+  42:	2e 2e 2e 2e 2e 89 75 f4 	cs cs cs cs mov %esi,%cs:-0xc\(%rbp\)
73f23b
+  4a:	55                   	push   %rbp
73f23b
+  4b:	55                   	push   %rbp
73f23b
+  4c:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  54:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  57:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  5d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  60:	e8 [0-9a-f ]+       	callq  .*
73f23b
+  65:	2e 2e 2e 2e 2e 89 75 f4 	cs cs cs cs mov %esi,%cs:-0xc\(%rbp\)
73f23b
+  6d:	2e 2e 55             	cs cs push %rbp
73f23b
+  70:	55                   	push   %rbp
73f23b
+  71:	55                   	push   %rbp
73f23b
+  72:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  7a:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  7d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  80:	ff 14 25 00 00 00 00 	callq  \*0x0
73f23b
+  87:	55                   	push   %rbp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2.s	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,44 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  jmp  *%rax
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  call *%rax
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  call  foo
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  call  *foo
73f23b
+  pushq  %rbp
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.d	2019-11-20 14:09:25.596915083 +0000
73f23b
@@ -0,0 +1,32 @@
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	55                   	push   %rbp
73f23b
+   c:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   f:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  12:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  15:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  18:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1e:	e8 00 00 00 00       	callq  23 <foo\+0x23>
73f23b
+  23:	55                   	push   %rbp
73f23b
+  24:	55                   	push   %rbp
73f23b
+  25:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  2d:	48 89 e5             	mov    %rsp,%rbp
73f23b
+  30:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  33:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  36:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  39:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3c:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3f:	ff 15 00 00 00 00    	callq  \*0x0\(%rip\)        # 45 <foo\+0x45>
73f23b
+  45:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.s	2019-11-20 14:09:25.597915075 +0000
73f23b
@@ -0,0 +1,27 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  call	__tls_get_addr
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  call	*__tls_get_addr@GOTPCREL(%rip)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4a.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4a.d	2019-11-20 14:09:25.597915075 +0000
73f23b
@@ -0,0 +1,33 @@
73f23b
+#source: x86-64-align-branch-4.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+   8:	55                   	push   %rbp
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  10:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  13:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  16:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  19:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1c:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1f:	c3                   	retq   
73f23b
+  20:	55                   	push   %rbp
73f23b
+  21:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  29:	55                   	push   %rbp
73f23b
+  2a:	55                   	push   %rbp
73f23b
+  2b:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3d:	c2 1e 00             	retq   \$0x1e
73f23b
+  40:	55                   	push   %rbp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4b.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4b.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4b.d	2019-11-20 14:09:25.597915075 +0000
73f23b
@@ -0,0 +1,33 @@
73f23b
+#source: x86-64-align-branch-4.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=ret
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	64 64 89 04 25 01 00 00 00 	fs mov %eax,%fs:0x1
73f23b
+   9:	55                   	push   %rbp
73f23b
+   a:	55                   	push   %rbp
73f23b
+   b:	48 89 e5             	mov    %rsp,%rbp
73f23b
+   e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  11:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  14:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  17:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  1d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  20:	c3                   	retq   
73f23b
+  21:	2e 2e 55             	cs cs push %rbp
73f23b
+  24:	64 89 04 25 01 00 00 00 	mov    %eax,%fs:0x1
73f23b
+  2c:	55                   	push   %rbp
73f23b
+  2d:	55                   	push   %rbp
73f23b
+  2e:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  31:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  34:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  37:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3a:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  3d:	89 75 f4             	mov    %esi,-0xc\(%rbp\)
73f23b
+  40:	c2 1e 00             	retq   \$0x1e
73f23b
+  43:	55                   	push   %rbp
73f23b
+#pass
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4.s
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4.s	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4.s	2019-11-20 14:09:25.597915075 +0000
73f23b
@@ -0,0 +1,27 @@
73f23b
+  .text
73f23b
+  .globl  foo
73f23b
+  .p2align  4
73f23b
+foo:
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movq  %rsp, %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  ret
73f23b
+  pushq  %rbp
73f23b
+  movl  %eax, %fs:0x1
73f23b
+  pushq  %rbp
73f23b
+  pushq  %rbp
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  movl  %esi, -12(%rbp)
73f23b
+  ret $30
73f23b
+  pushq  %rbp
73f23b
diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-5.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-5.d
73f23b
--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-5.d	1970-01-01 01:00:00.000000000 +0100
73f23b
+++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-5.d	2019-11-20 14:09:25.597915075 +0000
73f23b
@@ -0,0 +1,37 @@
73f23b
+#source: align-branch-5.s
73f23b
+#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
73f23b
+#objdump: -dw
73f23b
+
73f23b
+.*: +file format .*
73f23b
+
73f23b
+Disassembly of section .text:
73f23b
+
73f23b
+0+ <foo>:
73f23b
+   0:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   3:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   6:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+   9:	89 d1                	mov    %edx,%ecx
73f23b
+   b:	31 c0                	xor    %eax,%eax
73f23b
+   d:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  10:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  13:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  16:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  19:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  1c:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  1f:	f6 c2 02             	test   \$0x2,%dl
73f23b
+  22:	f3 ab                	rep stos %eax,%es:\(%rdi\)
73f23b
+  24:	75 dd                	jne    3 <foo\+0x3>
73f23b
+  26:	31 c0                	xor    %eax,%eax
73f23b
+  28:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  2b:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  2e:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  31:	89 d1                	mov    %edx,%ecx
73f23b
+  33:	31 c0                	xor    %eax,%eax
73f23b
+  35:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  38:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  3b:	c1 e9 02             	shr    \$0x2,%ecx
73f23b
+  3e:	f6 c2 02             	test   \$0x2,%dl
73f23b
+  41:	e8 00 00 00 00       	callq  46 <foo\+0x46>
73f23b
+  46:	75 e3                	jne    2b <foo\+0x2b>
73f23b
+  48:	31 c0                	xor    %eax,%eax
73f23b
+#pass