aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-12-12 11:58:50 -0800
committerH.J. Lu <hjl.tools@gmail.com>2019-12-12 12:03:45 -0800
commit8493b6651af3d2130d5f5f050905cd3d6e8a9c27 (patch)
tree8cde2b4c28190828a65d46ffa34a7cc5debd7c8e
parent76cf450b4ce818b298451619e80e041e6eb4ec24 (diff)
downloadgdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.zip
gdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.tar.gz
gdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.tar.bz2
i386: Add tests for -malign-branch-boundary and -malign-branch
Add tests for -malign-branch-boundary, -malign-branch and -mbranches-within-32B-boundaries. gas/ * testsuite/gas/i386/align-branch-1.s: New file. * testsuite/gas/i386/align-branch-1a.d: Likewise. * testsuite/gas/i386/align-branch-1b.d: Likewise. * testsuite/gas/i386/align-branch-1c.d: Likewise. * testsuite/gas/i386/align-branch-1d.d: Likewise. * testsuite/gas/i386/align-branch-1e.d: Likewise. * testsuite/gas/i386/align-branch-1f.d: Likewise. * testsuite/gas/i386/align-branch-1g.d: Likewise. * testsuite/gas/i386/align-branch-1h.d: Likewise. * testsuite/gas/i386/align-branch-2.s: Likewise. * testsuite/gas/i386/align-branch-2a.d: Likewise. * testsuite/gas/i386/align-branch-2b.d: Likewise. * testsuite/gas/i386/align-branch-2c.d: Likewise. * testsuite/gas/i386/align-branch-3.d: Likewise. * testsuite/gas/i386/align-branch-3.s: Likewise. * testsuite/gas/i386/align-branch-4.s: Likewise. * testsuite/gas/i386/align-branch-4a.d: Likewise. * testsuite/gas/i386/align-branch-4b.d: Likewise. * testsuite/gas/i386/align-branch-5.d: Likewise. * testsuite/gas/i386/align-branch-5.s: Likewise. * testsuite/gas/i386/align-branch-6.d: Likewise. * testsuite/gas/i386/align-branch-6.s: Likewise. * testsuite/gas/i386/align-branch-7.d: Likewise. * testsuite/gas/i386/align-branch-7.s: Likewise. * testsuite/gas/i386/align-branch-8.d: Likewise. * testsuite/gas/i386/align-branch-8.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-1.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-3.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-3.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-4.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-4b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-5.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-6.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.s: Likewise. * testsuite/gas/i386/i386.exp: Run new tests. ld/ * testsuite/ld-i386/align-branch-1.d: New file. * testsuite/ld-i386/align-branch-1.s: Likewise. * testsuite/ld-x86-64/align-branch-1.d: Likewise. * testsuite/ld-x86-64/align-branch-1.3: Likewise. * testsuite/ld-i386/i386.exp: Run the new test. * testsuite/ld-x86-64/x86-64.exp: Likewise.
-rw-r--r--gas/ChangeLog54
-rw-r--r--gas/testsuite/gas/i386/align-branch-1.s72
-rw-r--r--gas/testsuite/gas/i386/align-branch-1a.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1b.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1c.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1d.d76
-rw-r--r--gas/testsuite/gas/i386/align-branch-1e.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1f.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1g.d77
-rw-r--r--gas/testsuite/gas/i386/align-branch-1h.d76
-rw-r--r--gas/testsuite/gas/i386/align-branch-1i.d80
-rw-r--r--gas/testsuite/gas/i386/align-branch-2.s49
-rw-r--r--gas/testsuite/gas/i386/align-branch-2a.d55
-rw-r--r--gas/testsuite/gas/i386/align-branch-2b.d55
-rw-r--r--gas/testsuite/gas/i386/align-branch-2c.d55
-rw-r--r--gas/testsuite/gas/i386/align-branch-3.d33
-rw-r--r--gas/testsuite/gas/i386/align-branch-3.s28
-rw-r--r--gas/testsuite/gas/i386/align-branch-4.s30
-rw-r--r--gas/testsuite/gas/i386/align-branch-4a.d36
-rw-r--r--gas/testsuite/gas/i386/align-branch-4b.d36
-rw-r--r--gas/testsuite/gas/i386/align-branch-5.d36
-rw-r--r--gas/testsuite/gas/i386/align-branch-5.s32
-rw-r--r--gas/testsuite/gas/i386/align-branch-6.d22
-rw-r--r--gas/testsuite/gas/i386/align-branch-6.e2
-rw-r--r--gas/testsuite/gas/i386/align-branch-6.s7
-rw-r--r--gas/testsuite/gas/i386/align-branch-7.d18
-rw-r--r--gas/testsuite/gas/i386/align-branch-7.s14
-rw-r--r--gas/testsuite/gas/i386/align-branch-8.d18
-rw-r--r--gas/testsuite/gas/i386/align-branch-8.s14
-rw-r--r--gas/testsuite/gas/i386/i386.exp45
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1.s70
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1a.d75
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1b.d75
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1c.d75
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1d.d74
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1e.d74
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1f.d75
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1g.d75
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1h.d74
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-1i.d78
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-2.s44
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-2a.d50
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-2b.d50
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-2c.d50
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-3.d32
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-3.s27
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-4.s27
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-4a.d33
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-4b.d33
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-5.d37
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-6.d19
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-7.d18
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-7.s14
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-8.d18
-rw-r--r--gas/testsuite/gas/i386/x86-64-align-branch-8.s14
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-i386/align-branch-1.d25
-rw-r--r--ld/testsuite/ld-i386/align-branch-1.s19
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-x86-64/align-branch-1.d21
-rw-r--r--ld/testsuite/ld-x86-64/align-branch-1.s17
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
62 files changed, 2709 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c6f776c..4675ec8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,59 @@
2019-12-12 H.J. Lu <hongjiu.lu@intel.com>
+ * testsuite/gas/i386/align-branch-1.s: New file.
+ * testsuite/gas/i386/align-branch-1a.d: Likewise.
+ * testsuite/gas/i386/align-branch-1b.d: Likewise.
+ * testsuite/gas/i386/align-branch-1c.d: Likewise.
+ * testsuite/gas/i386/align-branch-1d.d: Likewise.
+ * testsuite/gas/i386/align-branch-1e.d: Likewise.
+ * testsuite/gas/i386/align-branch-1f.d: Likewise.
+ * testsuite/gas/i386/align-branch-1g.d: Likewise.
+ * testsuite/gas/i386/align-branch-1h.d: Likewise.
+ * testsuite/gas/i386/align-branch-2.s: Likewise.
+ * testsuite/gas/i386/align-branch-2a.d: Likewise.
+ * testsuite/gas/i386/align-branch-2b.d: Likewise.
+ * testsuite/gas/i386/align-branch-2c.d: Likewise.
+ * testsuite/gas/i386/align-branch-3.d: Likewise.
+ * testsuite/gas/i386/align-branch-3.s: Likewise.
+ * testsuite/gas/i386/align-branch-4.s: Likewise.
+ * testsuite/gas/i386/align-branch-4a.d: Likewise.
+ * testsuite/gas/i386/align-branch-4b.d: Likewise.
+ * testsuite/gas/i386/align-branch-5.d: Likewise.
+ * testsuite/gas/i386/align-branch-5.s: Likewise.
+ * testsuite/gas/i386/align-branch-6.d: Likewise.
+ * testsuite/gas/i386/align-branch-6.s: Likewise.
+ * testsuite/gas/i386/align-branch-7.d: Likewise.
+ * testsuite/gas/i386/align-branch-7.s: Likewise.
+ * testsuite/gas/i386/align-branch-8.d: Likewise.
+ * testsuite/gas/i386/align-branch-8.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-2.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-2b.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-3.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-3.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-4.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-4b.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-6.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-7.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-7.s: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-8.d: Likewise.
+ * testsuite/gas/i386/x86-64-align-branch-8.s: Likewise.
+ * testsuite/gas/i386/i386.exp: Run new tests.
+
+2019-12-12 H.J. Lu <hongjiu.lu@intel.com>
+
* config/tc-i386.c (OPTION_MBRANCHES_WITH_32B_BOUNDARIES): New.
(md_longopts): Add -mbranches-within-32B-boundaries.
(md_parse_option): Handle -mbranches-within-32B-boundaries.
diff --git a/gas/testsuite/gas/i386/align-branch-1.s b/gas/testsuite/gas/i386/align-branch-1.s
new file mode 100644
index 0000000..06bf98a
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1.s
@@ -0,0 +1,72 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %gs:0x1
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ movl %esp, %ebp
+ movl %edi, -8(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ cmp %eax, %ebp
+ je .L_2
+ movl %esi, -12(%ebx)
+ movl %esi, -12(%ebp)
+ movl %edi, -8(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ popl %ebp
+ popl %ebp
+ popl %ebp
+ je .L_2
+ popl %ebp
+ je .L_2
+ movl %eax, -4(%esp)
+ movl %esi, -12(%ebp)
+ movl %edi, -8(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ popl %ebp
+ jmp .L_3
+ jmp .L_3
+ jmp .L_3
+ movl %eax, -4(%ebp)
+ movl %esi, -12(%ebp)
+ movl %edi, -8(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ popl %ebp
+ popl %ebp
+ cmp %eax, %ebp
+ je .L_2
+ jmp .L_3
+.L_2:
+ movl -12(%ebp), %eax
+ movl %eax, -4(%ebp)
+.L_3:
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, 12(%ebp)
+ jmp bar
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, -1200(%ebp)
+ movl %esi, (%ebp)
+ je .L_3
+ je .L_3
diff --git a/gas/testsuite/gas/i386/align-branch-1a.d b/gas/testsuite/gas/i386/align-branch-1a.d
new file mode 100644
index 0000000..46b7921
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1a.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5e je 82 <foo\+0x82>
+ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\)
+ 28: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 5d pop %ebp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %ebp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\)
+ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 50: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 53: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 56: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 59: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5f: 5d pop %ebp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 78: 5d pop %ebp
+ 79: 5d pop %ebp
+ 7a: 39 c5 cmp %eax,%ebp
+ 7c: 74 04 je 82 <foo\+0x82>
+ 7e: 66 90 xchg %ax,%ax
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a0: 89 75 0c mov %esi,0xc\(%ebp\)
+ a3: e9 [0-9a-f ]+ jmp .*
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ c0: 89 75 00 mov %esi,0x0\(%ebp\)
+ c3: 74 c3 je 88 <foo\+0x88>
+ c5: 74 c1 je 88 <foo\+0x88>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1b.d b/gas/testsuite/gas/i386/align-branch-1b.d
new file mode 100644
index 0000000..b3f0e72
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1b.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5e je 82 <foo\+0x82>
+ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\)
+ 28: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 5d pop %ebp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %ebp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\)
+ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 50: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 53: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 56: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 59: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5f: 5d pop %ebp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 78: 5d pop %ebp
+ 79: 5d pop %ebp
+ 7a: 39 c5 cmp %eax,%ebp
+ 7c: 74 04 je 82 <foo\+0x82>
+ 7e: 66 90 xchg %ax,%ax
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a0: 89 75 0c mov %esi,0xc\(%ebp\)
+ a3: e9 [0-9a-f ]+ jmp .*
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ c0: 89 75 00 mov %esi,0x0\(%ebp\)
+ c3: 74 c3 je 88 <foo\+0x88>
+ c5: 74 c1 je 88 <foo\+0x88>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1c.d b/gas/testsuite/gas/i386/align-branch-1c.d
new file mode 100644
index 0000000..947dcc8
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1c.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ 6: 3e 55 ds push %ebp
+ 8: 3e 55 ds push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5e je 82 <foo\+0x82>
+ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\)
+ 28: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 5d pop %ebp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %ebp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\)
+ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 50: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 53: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 56: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 59: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5f: 5d pop %ebp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 78: 5d pop %ebp
+ 79: 5d pop %ebp
+ 7a: 39 c5 cmp %eax,%ebp
+ 7c: 74 04 je 82 <foo\+0x82>
+ 7e: 66 90 xchg %ax,%ax
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a0: 89 75 0c mov %esi,0xc\(%ebp\)
+ a3: e9 [0-9a-f ]+ jmp .*
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ c0: 89 75 00 mov %esi,0x0\(%ebp\)
+ c3: 74 c3 je 88 <foo\+0x88>
+ c5: 74 c1 je 88 <foo\+0x88>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1d.d b/gas/testsuite/gas/i386/align-branch-1d.d
new file mode 100644
index 0000000..db62f08
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1d.d
@@ -0,0 +1,76 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5b je 7f <foo\+0x7f>
+ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\)
+ 28: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 5d pop %ebp
+ 40: 74 3d je 7f <foo\+0x7f>
+ 42: 5d pop %ebp
+ 43: 74 3a je 7f <foo\+0x7f>
+ 45: 89 44 24 fc mov %eax,-0x4\(%esp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5e: 5d pop %ebp
+ 5f: eb 24 jmp 85 <foo\+0x85>
+ 61: eb 22 jmp 85 <foo\+0x85>
+ 63: eb 20 jmp 85 <foo\+0x85>
+ 65: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 68: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 71: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 74: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 77: 5d pop %ebp
+ 78: 5d pop %ebp
+ 79: 39 c5 cmp %eax,%ebp
+ 7b: 74 02 je 7f <foo\+0x7f>
+ 7d: eb 06 jmp 85 <foo\+0x85>
+ 7f: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 82: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9d: 89 75 0c mov %esi,0xc\(%ebp\)
+ a0: e9 [0-9a-f ]+ jmp .*
+ a5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ab: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ bd: 89 75 00 mov %esi,0x0\(%ebp\)
+ c0: 74 c3 je 85 <foo\+0x85>
+ c2: 74 c1 je 85 <foo\+0x85>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1e.d b/gas/testsuite/gas/i386/align-branch-1e.d
new file mode 100644
index 0000000..dafbee1
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1e.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=jcc
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: 39 c5 cmp %eax,%ebp
+ 20: 74 5a je 7c <foo\+0x7c>
+ 22: 89 73 f4 mov %esi,-0xc\(%ebx\)
+ 25: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 5d pop %ebp
+ 3b: 5d pop %ebp
+ 3c: 5d pop %ebp
+ 3d: 74 3d je 7c <foo\+0x7c>
+ 3f: 5d pop %ebp
+ 40: 74 3a je 7c <foo\+0x7c>
+ 42: 89 44 24 fc mov %eax,-0x4\(%esp\)
+ 46: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 49: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: 5d pop %ebp
+ 5c: eb 24 jmp 82 <foo\+0x82>
+ 5e: eb 22 jmp 82 <foo\+0x82>
+ 60: eb 20 jmp 82 <foo\+0x82>
+ 62: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 65: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 68: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 71: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 74: 5d pop %ebp
+ 75: 5d pop %ebp
+ 76: 39 c5 cmp %eax,%ebp
+ 78: 74 02 je 7c <foo\+0x7c>
+ 7a: eb 06 jmp 82 <foo\+0x82>
+ 7c: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 7f: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 75 0c mov %esi,0xc\(%ebp\)
+ 9d: e9 [0-9a-f ]+ jmp .*
+ a2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 75 00 mov %esi,0x0\(%ebp\)
+ bd: 74 c3 je 82 <foo\+0x82>
+ bf: 90 nop
+ c0: 74 c0 je 82 <foo\+0x82>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1f.d b/gas/testsuite/gas/i386/align-branch-1f.d
new file mode 100644
index 0000000..bf197c9
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1f.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: 39 c5 cmp %eax,%ebp
+ 20: 74 5c je 7e <foo\+0x7e>
+ 22: 89 73 f4 mov %esi,-0xc\(%ebx\)
+ 25: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 5d pop %ebp
+ 3b: 5d pop %ebp
+ 3c: 5d pop %ebp
+ 3d: 74 3f je 7e <foo\+0x7e>
+ 3f: 5d pop %ebp
+ 40: 74 3c je 7e <foo\+0x7e>
+ 42: 89 44 24 fc mov %eax,-0x4\(%esp\)
+ 46: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 49: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: 5d pop %ebp
+ 5c: eb 27 jmp 85 <foo\+0x85>
+ 5e: 66 90 xchg %ax,%ax
+ 60: eb 23 jmp 85 <foo\+0x85>
+ 62: eb 21 jmp 85 <foo\+0x85>
+ 64: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 67: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6a: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 70: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 73: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 76: 5d pop %ebp
+ 77: 5d pop %ebp
+ 78: 39 c5 cmp %eax,%ebp
+ 7a: 74 02 je 7e <foo\+0x7e>
+ 7c: eb 07 jmp 85 <foo\+0x85>
+ 7e: 36 8b 45 f4 mov %ss:-0xc\(%ebp\),%eax
+ 82: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9d: 89 75 0c mov %esi,0xc\(%ebp\)
+ a0: e9 [0-9a-f ]+ jmp .*
+ a5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ab: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ bd: 89 75 00 mov %esi,0x0\(%ebp\)
+ c0: 74 c3 je 85 <foo\+0x85>
+ c2: 74 c1 je 85 <foo\+0x85>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1g.d b/gas/testsuite/gas/i386/align-branch-1g.d
new file mode 100644
index 0000000..6cae2cd
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1g.d
@@ -0,0 +1,77 @@
+#source: align-branch-1.s
+#as: -mbranches-within-32B-boundaries
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5e je 82 <foo\+0x82>
+ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\)
+ 28: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 5d pop %ebp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %ebp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\)
+ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 50: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 53: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 56: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 59: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5f: 5d pop %ebp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 78: 5d pop %ebp
+ 79: 5d pop %ebp
+ 7a: 39 c5 cmp %eax,%ebp
+ 7c: 74 04 je 82 <foo\+0x82>
+ 7e: 66 90 xchg %ax,%ax
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a0: 89 75 0c mov %esi,0xc\(%ebp\)
+ a3: e9 [0-9a-f ]+ jmp .*
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ c0: 89 75 00 mov %esi,0x0\(%ebp\)
+ c3: 74 c3 je 88 <foo\+0x88>
+ c5: 74 c1 je 88 <foo\+0x88>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1h.d b/gas/testsuite/gas/i386/align-branch-1h.d
new file mode 100644
index 0000000..01871ee
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1h.d
@@ -0,0 +1,76 @@
+#source: align-branch-1.s
+#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: 39 c5 cmp %eax,%ebp
+ 20: 74 5a je 7c <foo\+0x7c>
+ 22: 89 73 f4 mov %esi,-0xc\(%ebx\)
+ 25: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 5d pop %ebp
+ 3b: 5d pop %ebp
+ 3c: 5d pop %ebp
+ 3d: 74 3d je 7c <foo\+0x7c>
+ 3f: 5d pop %ebp
+ 40: 74 3a je 7c <foo\+0x7c>
+ 42: 89 44 24 fc mov %eax,-0x4\(%esp\)
+ 46: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 49: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: 5d pop %ebp
+ 5c: eb 24 jmp 82 <foo\+0x82>
+ 5e: eb 22 jmp 82 <foo\+0x82>
+ 60: eb 20 jmp 82 <foo\+0x82>
+ 62: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 65: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 68: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 71: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 74: 5d pop %ebp
+ 75: 5d pop %ebp
+ 76: 39 c5 cmp %eax,%ebp
+ 78: 74 02 je 7c <foo\+0x7c>
+ 7a: eb 06 jmp 82 <foo\+0x82>
+ 7c: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 7f: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 75 0c mov %esi,0xc\(%ebp\)
+ 9d: e9 [0-9a-f ]+ jmp .*
+ a2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 75 00 mov %esi,0x0\(%ebp\)
+ bd: 74 c3 je 82 <foo\+0x82>
+ bf: 74 c1 je 82 <foo\+0x82>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-1i.d b/gas/testsuite/gas/i386/align-branch-1i.d
new file mode 100644
index 0000000..e2cbc28
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-1i.d
@@ -0,0 +1,80 @@
+#source: align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=0
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: 66 90 xchg %ax,%ax
+ 20: 39 c5 cmp %eax,%ebp
+ 22: 74 5e je 82 <foo\+0x82>
+ 24: 89 73 f4 mov %esi,-0xc\(%ebx\)
+ 27: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2a: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 30: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3c: 5d pop %ebp
+ 3d: 5d pop %ebp
+ 3e: 5d pop %ebp
+ 3f: 90 nop
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %ebp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 89 44 24 fc mov %eax,-0x4\(%esp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5e: 5d pop %ebp
+ 5f: 90 nop
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 78: 5d pop %ebp
+ 79: 5d pop %ebp
+ 7a: 39 c5 cmp %eax,%ebp
+ 7c: 74 04 je 82 <foo\+0x82>
+ 7e: 66 90 xchg %ax,%ax
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%ebp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ a0: 89 75 0c mov %esi,0xc\(%ebp\)
+ a3: e9 [0-9a-f ]+ jmp .*
+ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\)
+ c0: 89 75 00 mov %esi,0x0\(%ebp\)
+ c3: 74 c3 je 88 <foo\+0x88>
+ c5: 74 c1 je 88 <foo\+0x88>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-2.s b/gas/testsuite/gas/i386/align-branch-2.s
new file mode 100644
index 0000000..4a79bbb
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-2.s
@@ -0,0 +1,49 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ jmp *%eax
+ pushl %ebp
+ pushl %ebp
+ movl %eax, %fs:0x1
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ call *%eax
+ movl %esi, -12(%ebp)
+ pushl %ebp
+ pushl %ebp
+ movl %eax, %fs:0x1
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ call foo
+ movl %esi, -12(%ebp)
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ movl %eax, %fs:0x1
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ call *foo
+ pushl %ebp
diff --git a/gas/testsuite/gas/i386/align-branch-2a.d b/gas/testsuite/gas/i386/align-branch-2a.d
new file mode 100644
index 0000000..cba0560
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-2a.d
@@ -0,0 +1,55 @@
+#source: align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: ff e0 jmp \*%eax
+ 20: 55 push %ebp
+ 21: 55 push %ebp
+ 22: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 28: 89 e5 mov %esp,%ebp
+ 2a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 30: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3c: ff d0 call \*%eax
+ 3e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 41: 55 push %ebp
+ 42: 55 push %ebp
+ 43: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 49: 89 e5 mov %esp,%ebp
+ 4b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 4e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 57: e8 [0-9a-f ]+ call .*
+ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5f: 55 push %ebp
+ 60: 55 push %ebp
+ 61: 55 push %ebp
+ 62: 55 push %ebp
+ 63: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 69: 89 e5 mov %esp,%ebp
+ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 71: ff 15 00 00 00 00 call \*0x0
+ 77: 55 push %ebp
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-2b.d b/gas/testsuite/gas/i386/align-branch-2b.d
new file mode 100644
index 0000000..7d879b6
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-2b.d
@@ -0,0 +1,55 @@
+#source: align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=indirect
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 a3 01 00 00 00 fs fs mov %eax,%fs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: ff e0 jmp \*%eax
+ 22: 3e 3e 55 ds ds push %ebp
+ 25: 55 push %ebp
+ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 2c: 89 e5 mov %esp,%ebp
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 40: ff d0 call \*%eax
+ 42: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 45: 55 push %ebp
+ 46: 55 push %ebp
+ 47: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 4d: 89 e5 mov %esp,%ebp
+ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5b: e8 [0-9a-f ]+ call .*
+ 60: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 63: 55 push %ebp
+ 64: 55 push %ebp
+ 65: 55 push %ebp
+ 66: 55 push %ebp
+ 67: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 6d: 89 e5 mov %esp,%ebp
+ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 75: ff 15 00 00 00 00 call \*0x0
+ 7b: 55 push %ebp
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-2c.d b/gas/testsuite/gas/i386/align-branch-2c.d
new file mode 100644
index 0000000..2fc6339
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-2c.d
@@ -0,0 +1,55 @@
+#source: align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 a3 01 00 00 00 fs fs mov %eax,%fs:0x1
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: ff e0 jmp \*%eax
+ 22: 3e 3e 55 ds ds push %ebp
+ 25: 55 push %ebp
+ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 2c: 89 e5 mov %esp,%ebp
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 40: ff d0 call \*%eax
+ 42: 36 36 36 36 36 89 75 f4 ss ss ss ss mov %esi,%ss:-0xc\(%ebp\)
+ 4a: 55 push %ebp
+ 4b: 55 push %ebp
+ 4c: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 52: 89 e5 mov %esp,%ebp
+ 54: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 57: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 5d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 60: e8 [0-9a-f ]+ call .*
+ 65: 36 36 36 36 36 89 75 f4 ss ss ss ss mov %esi,%ss:-0xc\(%ebp\)
+ 6d: 3e 55 ds push %ebp
+ 6f: 55 push %ebp
+ 70: 55 push %ebp
+ 71: 55 push %ebp
+ 72: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 78: 89 e5 mov %esp,%ebp
+ 7a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 7d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 80: ff 15 00 00 00 00 call \*0x0
+ 86: 55 push %ebp
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-3.d b/gas/testsuite/gas/i386/align-branch-3.d
new file mode 100644
index 0000000..da31b6f
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-3.d
@@ -0,0 +1,33 @@
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 89 e5 mov %esp,%ebp
+ c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1e: e8 fc ff ff ff call 1f <foo\+0x1f>
+ 23: 55 push %ebp
+ 24: 55 push %ebp
+ 25: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 2b: 89 e5 mov %esp,%ebp
+ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 30: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3c: ff 91 00 00 00 00 call \*0x0\(%ecx\)
+ 42: 89 75 f4 mov %esi,-0xc\(%ebp\)
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-3.s b/gas/testsuite/gas/i386/align-branch-3.s
new file mode 100644
index 0000000..e3e6c44
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-3.s
@@ -0,0 +1,28 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ call ___tls_get_addr
+ pushl %ebp
+ pushl %ebp
+ movl %eax, %fs:0x1
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ call *___tls_get_addr@GOT(%ecx)
+ movl %esi, -12(%ebp)
diff --git a/gas/testsuite/gas/i386/align-branch-4.s b/gas/testsuite/gas/i386/align-branch-4.s
new file mode 100644
index 0000000..34ff361
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-4.s
@@ -0,0 +1,30 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ pushl %ebp
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ ret
+ pushl %ebp
+ pushl %ebp
+ movl %eax, %fs:0x1
+ movl %esp, %ebp
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ ret $30
+ movl %esi, -12(%ebp)
diff --git a/gas/testsuite/gas/i386/align-branch-4a.d b/gas/testsuite/gas/i386/align-branch-4a.d
new file mode 100644
index 0000000..2b1e0b1
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-4a.d
@@ -0,0 +1,36 @@
+#source: align-branch-4.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 6: 55 push %ebp
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 89 e5 mov %esp,%ebp
+ d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 10: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 13: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 16: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 19: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1c: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1f: c3 ret
+ 20: 55 push %ebp
+ 21: 55 push %ebp
+ 22: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 28: 89 e5 mov %esp,%ebp
+ 2a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 30: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3c: c2 1e 00 ret \$0x1e
+ 3f: 89 75 f4 mov %esi,-0xc\(%ebp\)
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-4b.d b/gas/testsuite/gas/i386/align-branch-4b.d
new file mode 100644
index 0000000..c7690d3
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-4b.d
@@ -0,0 +1,36 @@
+#source: align-branch-4.s
+#as: -malign-branch-boundary=32 -malign-branch=ret
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 a3 01 00 00 00 fs mov %eax,%fs:0x1
+ 7: 55 push %ebp
+ 8: 55 push %ebp
+ 9: 55 push %ebp
+ a: 55 push %ebp
+ b: 55 push %ebp
+ c: 89 e5 mov %esp,%ebp
+ e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 20: c3 ret
+ 21: 3e 3e 3e 55 ds ds ds push %ebp
+ 25: 55 push %ebp
+ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1
+ 2c: 89 e5 mov %esp,%ebp
+ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ 40: c2 1e 00 ret \$0x1e
+ 43: 89 75 f4 mov %esi,-0xc\(%ebp\)
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-5.d b/gas/testsuite/gas/i386/align-branch-5.d
new file mode 100644
index 0000000..1f11427
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-5.d
@@ -0,0 +1,36 @@
+#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: c1 e9 02 shr \$0x2,%ecx
+ 3: c1 e9 02 shr \$0x2,%ecx
+ 6: c1 e9 02 shr \$0x2,%ecx
+ 9: 89 d1 mov %edx,%ecx
+ b: 31 c0 xor %eax,%eax
+ d: c1 e9 02 shr \$0x2,%ecx
+ 10: c1 e9 02 shr \$0x2,%ecx
+ 13: c1 e9 02 shr \$0x2,%ecx
+ 16: c1 e9 02 shr \$0x2,%ecx
+ 19: c1 e9 02 shr \$0x2,%ecx
+ 1c: c1 e9 02 shr \$0x2,%ecx
+ 1f: f6 c2 02 test \$0x2,%dl
+ 22: f3 ab rep stos %eax,%es:\(%edi\)
+ 24: 75 dd jne 3 <foo\+0x3>
+ 26: 31 c0 xor %eax,%eax
+ 28: c1 e9 02 shr \$0x2,%ecx
+ 2b: c1 e9 02 shr \$0x2,%ecx
+ 2e: c1 e9 02 shr \$0x2,%ecx
+ 31: 89 d1 mov %edx,%ecx
+ 33: 31 c0 xor %eax,%eax
+ 35: c1 e9 02 shr \$0x2,%ecx
+ 38: c1 e9 02 shr \$0x2,%ecx
+ 3b: c1 e9 02 shr \$0x2,%ecx
+ 3e: f6 c2 02 test \$0x2,%dl
+ 41: e8 [0-9a-f ]+ call .*
+ 46: 75 e3 jne 2b <foo\+0x2b>
+ 48: 31 c0 xor %eax,%eax
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-5.s b/gas/testsuite/gas/i386/align-branch-5.s
new file mode 100644
index 0000000..58e3b91
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-5.s
@@ -0,0 +1,32 @@
+ .text
+ .p2align 4,,15
+foo:
+ shrl $2, %ecx
+.L1:
+ shrl $2, %ecx
+ shrl $2, %ecx
+ movl %edx, %ecx
+ xorl %eax, %eax
+ shrl $2, %ecx
+ shrl $2, %ecx
+ shrl $2, %ecx
+ shrl $2, %ecx
+ shrl $2, %ecx
+ shrl $2, %ecx
+ testb $2, %dl
+ rep stosl
+ jne .L1
+ xorl %eax, %eax
+ shrl $2, %ecx
+.L2:
+ shrl $2, %ecx
+ shrl $2, %ecx
+ movl %edx, %ecx
+ xorl %eax, %eax
+ shrl $2, %ecx
+ shrl $2, %ecx
+ shrl $2, %ecx
+ testb $2, %dl
+ call bar
+ jne .L2
+ xorl %eax, %eax
diff --git a/gas/testsuite/gas/i386/align-branch-6.d b/gas/testsuite/gas/i386/align-branch-6.d
new file mode 100644
index 0000000..29e2787
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-6.d
@@ -0,0 +1,22 @@
+#as: -malign-branch-boundary=32 -D
+#objdump: -dw
+#warning_output: align-branch-6.e
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: eb 3c jmp 3e <_start\+0x3e>
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d b4 26 00 00 00 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 8d 74 26 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: f2 73 bf bnd jae 0 <_start>
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-6.e b/gas/testsuite/gas/i386/align-branch-6.e
new file mode 100644
index 0000000..c337835
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-6.e
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*:4: Warning: `constant directive` skips -malign-branch-boundary on `jnc`
diff --git a/gas/testsuite/gas/i386/align-branch-6.s b/gas/testsuite/gas/i386/align-branch-6.s
new file mode 100644
index 0000000..41a9277
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-6.s
@@ -0,0 +1,7 @@
+ .text
+_start:
+.L0:
+ .nops 62
+ .byte 0xf2
+ jnc .L0
+ ret
diff --git a/gas/testsuite/gas/i386/align-branch-7.d b/gas/testsuite/gas/i386/align-branch-7.d
new file mode 100644
index 0000000..7f8c338
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-7.d
@@ -0,0 +1,18 @@
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=4
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: 3e 66 0f 3a 60 00 03 pcmpestrm \$0x3,%ds:\(%eax\),%xmm0
+ +[a-f0-9]+: 3e 3e 89 e5 ds ds mov %esp,%ebp
+ +[a-f0-9]+: 89 bd 1c ff ff ff mov %edi,-0xe4\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ +[a-f0-9]+: a8 04 test \$0x4,%al
+ +[a-f0-9]+: 70 dc jo 0 <foo>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-7.s b/gas/testsuite/gas/i386/align-branch-7.s
new file mode 100644
index 0000000..370eedb
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-7.s
@@ -0,0 +1,14 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+.L1:
+ pcmpestrm $3, (%eax), %xmm0
+ movl %esp, %ebp
+ movl %edi, -228(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %eax, %gs:0x1
+ testb $0x4,%al
+ jo .L1
diff --git a/gas/testsuite/gas/i386/align-branch-8.d b/gas/testsuite/gas/i386/align-branch-8.d
new file mode 100644
index 0000000..ee7ae71
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-8.d
@@ -0,0 +1,18 @@
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=4
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: 3e c4 e3 79 60 00 03 vpcmpestrm \$0x3,%ds:\(%eax\),%xmm0
+ +[a-f0-9]+: 3e 3e 89 e5 ds ds mov %esp,%ebp
+ +[a-f0-9]+: 89 bd 1c ff ff ff mov %edi,-0xe4\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%ebp\)
+ +[a-f0-9]+: 65 a3 01 00 00 00 mov %eax,%gs:0x1
+ +[a-f0-9]+: a8 04 test \$0x4,%al
+ +[a-f0-9]+: 70 dc jo 0 <foo>
+#pass
diff --git a/gas/testsuite/gas/i386/align-branch-8.s b/gas/testsuite/gas/i386/align-branch-8.s
new file mode 100644
index 0000000..85a7fb6
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-branch-8.s
@@ -0,0 +1,14 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+.L1:
+ vpcmpestrm $3, (%eax), %xmm0
+ movl %esp, %ebp
+ movl %edi, -228(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %esi, -12(%ebp)
+ movl %eax, %gs:0x1
+ testb $0x4,%al
+ jo .L1
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index f4c7ce7..c31ffab 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -498,6 +498,24 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_list_test "optimize-6a" "-I${srcdir}/$subdir -march=+noavx -al"
run_dump_test "optimize-6b"
run_list_test "optimize-7" "-I${srcdir}/$subdir -march=+noavx2 -al"
+ run_dump_test "align-branch-1a"
+ run_dump_test "align-branch-1b"
+ run_dump_test "align-branch-1c"
+ run_dump_test "align-branch-1d"
+ run_dump_test "align-branch-1e"
+ run_dump_test "align-branch-1f"
+ run_dump_test "align-branch-1g"
+ run_dump_test "align-branch-1h"
+ run_dump_test "align-branch-1i"
+ run_dump_test "align-branch-2a"
+ run_dump_test "align-branch-2b"
+ run_dump_test "align-branch-2c"
+ run_dump_test "align-branch-4a"
+ run_dump_test "align-branch-4b"
+ run_dump_test "align-branch-5"
+ run_dump_test "align-branch-6"
+ run_dump_test "align-branch-7"
+ run_dump_test "align-branch-8"
# These tests require support for 8 and 16 bit relocs,
# so we only run them for ELF and COFF targets.
@@ -573,6 +591,10 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "property-1"
run_dump_test "property-2"
+ if {[istarget "*-*-linux*"]} then {
+ run_dump_test "align-branch-3"
+ }
+
if { [gas_64_check] } then {
run_dump_test "att-regs"
run_dump_test "intel-regs"
@@ -1032,6 +1054,24 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_list_test "x86-64-optimize-7a" "-I${srcdir}/$subdir -march=+noavx -al"
run_dump_test "x86-64-optimize-7b"
run_list_test "x86-64-optimize-8" "-I${srcdir}/$subdir -march=+noavx2 -al"
+ run_dump_test "x86-64-align-branch-1a"
+ run_dump_test "x86-64-align-branch-1b"
+ run_dump_test "x86-64-align-branch-1c"
+ run_dump_test "x86-64-align-branch-1d"
+ run_dump_test "x86-64-align-branch-1e"
+ run_dump_test "x86-64-align-branch-1f"
+ run_dump_test "x86-64-align-branch-1g"
+ run_dump_test "x86-64-align-branch-1h"
+ run_dump_test "x86-64-align-branch-1i"
+ run_dump_test "x86-64-align-branch-2a"
+ run_dump_test "x86-64-align-branch-2b"
+ run_dump_test "x86-64-align-branch-2c"
+ run_dump_test "x86-64-align-branch-4a"
+ run_dump_test "x86-64-align-branch-4b"
+ run_dump_test "x86-64-align-branch-5"
+ run_dump_test "x86-64-align-branch-6"
+ run_dump_test "x86-64-align-branch-7"
+ run_dump_test "x86-64-align-branch-8"
if { ![istarget "*-*-aix*"]
&& ![istarget "*-*-beos*"]
@@ -1096,6 +1136,11 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "evex-no-scale-64"
run_dump_test "x86-64-property-1"
run_dump_test "x86-64-property-2"
+
+ if {[istarget "*-*-linux*"]} then {
+ run_dump_test "x86-64-align-branch-3"
+ }
+
}
set ASFLAGS "$old_ASFLAGS"
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1.s b/gas/testsuite/gas/i386/x86-64-align-branch-1.s
new file mode 100644
index 0000000..74b3e7a
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1.s
@@ -0,0 +1,70 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ cmp %rax, %rbp
+ je .L_2
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %edi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ popq %rbp
+ popq %rbp
+ je .L_2
+ popq %rbp
+ je .L_2
+ movl %eax, -4(%rbp)
+ movl %esi, -12(%rbp)
+ movl %edi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ popq %rbp
+ popq %rbp
+ jmp .L_3
+ jmp .L_3
+ jmp .L_3
+ movl %eax, -4(%rbp)
+ movl %esi, -12(%rbp)
+ movl %edi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ popq %rbp
+ popq %rbp
+ cmp %rax, %rbp
+ je .L_2
+ jmp .L_3
+.L_2:
+ movl -12(%rbp), %eax
+ movl %eax, -4(%rbp)
+.L_3:
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ movl %esi, -1200(%rbp)
+ jmp .L_3
+ popq %rbp
+ retq
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1a.d b/gas/testsuite/gas/i386/x86-64-align-branch-1a.d
new file mode 100644
index 0000000..f96808a
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1a.d
@@ -0,0 +1,75 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5d je 82 <foo\+0x82>
+ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\)
+ 29: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 32: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 35: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 38: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3e: 5d pop %rbp
+ 3f: 5d pop %rbp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %rbp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5e: 5d pop %rbp
+ 5f: 5d pop %rbp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 78: 5d pop %rbp
+ 79: 5d pop %rbp
+ 7a: 48 39 c5 cmp %rax,%rbp
+ 7d: 74 03 je 82 <foo\+0x82>
+ 7f: 90 nop
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c4: eb c2 jmp 88 <foo\+0x88>
+ c6: 5d pop %rbp
+ c7: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1b.d b/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
new file mode 100644
index 0000000..10b3476
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
@@ -0,0 +1,75 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5d je 82 <foo\+0x82>
+ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\)
+ 29: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 32: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 35: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 38: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3e: 5d pop %rbp
+ 3f: 5d pop %rbp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %rbp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5e: 5d pop %rbp
+ 5f: 5d pop %rbp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 78: 5d pop %rbp
+ 79: 5d pop %rbp
+ 7a: 48 39 c5 cmp %rax,%rbp
+ 7d: 74 03 je 82 <foo\+0x82>
+ 7f: 90 nop
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c4: eb c2 jmp 88 <foo\+0x88>
+ c6: 5d pop %rbp
+ c7: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1c.d b/gas/testsuite/gas/i386/x86-64-align-branch-1c.d
new file mode 100644
index 0000000..53c848a
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1c.d
@@ -0,0 +1,75 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 2e 55 cs push %rbp
+ a: 2e 55 cs push %rbp
+ c: 2e 55 cs push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5d je 82 <foo\+0x82>
+ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\)
+ 29: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 32: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 35: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 38: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3e: 5d pop %rbp
+ 3f: 5d pop %rbp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %rbp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5e: 5d pop %rbp
+ 5f: 5d pop %rbp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 78: 5d pop %rbp
+ 79: 5d pop %rbp
+ 7a: 48 39 c5 cmp %rax,%rbp
+ 7d: 74 03 je 82 <foo\+0x82>
+ 7f: 90 nop
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c4: eb c2 jmp 88 <foo\+0x88>
+ c6: 5d pop %rbp
+ c7: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1d.d b/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
new file mode 100644
index 0000000..ae6445b
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
@@ -0,0 +1,74 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5b je 80 <foo\+0x80>
+ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\)
+ 29: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 32: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 35: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 38: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3e: 5d pop %rbp
+ 3f: 5d pop %rbp
+ 40: 74 3e je 80 <foo\+0x80>
+ 42: 5d pop %rbp
+ 43: 74 3b je 80 <foo\+0x80>
+ 45: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 48: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4b: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 57: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5d: 5d pop %rbp
+ 5e: 5d pop %rbp
+ 5f: eb 25 jmp 86 <foo\+0x86>
+ 61: eb 23 jmp 86 <foo\+0x86>
+ 63: eb 21 jmp 86 <foo\+0x86>
+ 65: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 68: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6b: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 71: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 74: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 77: 5d pop %rbp
+ 78: 5d pop %rbp
+ 79: 48 39 c5 cmp %rax,%rbp
+ 7c: 74 02 je 80 <foo\+0x80>
+ 7e: eb 06 jmp 86 <foo\+0x86>
+ 80: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 83: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 86: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8c: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 92: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 98: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ aa: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ bc: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c2: eb c2 jmp 86 <foo\+0x86>
+ c4: 5d pop %rbp
+ c5: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1e.d b/gas/testsuite/gas/i386/x86-64-align-branch-1e.d
new file mode 100644
index 0000000..beb7744
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1e.d
@@ -0,0 +1,74 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=jcc
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 48 89 e5 mov %rsp,%rbp
+ e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 48 39 c5 cmp %rax,%rbp
+ 20: 74 5b je 7d <foo\+0x7d>
+ 22: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 25: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 5d pop %rbp
+ 3b: 5d pop %rbp
+ 3c: 74 3f je 7d <foo\+0x7d>
+ 3e: 2e 5d cs pop %rbp
+ 40: 74 3b je 7d <foo\+0x7d>
+ 42: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 45: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 48: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 57: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5a: 5d pop %rbp
+ 5b: 5d pop %rbp
+ 5c: eb 25 jmp 83 <foo\+0x83>
+ 5e: eb 23 jmp 83 <foo\+0x83>
+ 60: eb 21 jmp 83 <foo\+0x83>
+ 62: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 65: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 68: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 71: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 74: 5d pop %rbp
+ 75: 5d pop %rbp
+ 76: 48 39 c5 cmp %rax,%rbp
+ 79: 74 02 je 7d <foo\+0x7d>
+ 7b: eb 06 jmp 83 <foo\+0x83>
+ 7d: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 80: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 83: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 89: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8f: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 95: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ad: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b3: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b9: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ bf: eb c2 jmp 83 <foo\+0x83>
+ c1: 5d pop %rbp
+ c2: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1f.d b/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
new file mode 100644
index 0000000..24fbf45
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
@@ -0,0 +1,75 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 48 89 e5 mov %rsp,%rbp
+ e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 48 39 c5 cmp %rax,%rbp
+ 20: 74 5d je 7f <foo\+0x7f>
+ 22: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 25: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 5d pop %rbp
+ 3b: 5d pop %rbp
+ 3c: 74 41 je 7f <foo\+0x7f>
+ 3e: 2e 5d cs pop %rbp
+ 40: 74 3d je 7f <foo\+0x7f>
+ 42: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 45: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 48: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 57: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5a: 5d pop %rbp
+ 5b: 5d pop %rbp
+ 5c: eb 27 jmp 85 <foo\+0x85>
+ 5e: 66 90 xchg %ax,%ax
+ 60: eb 23 jmp 85 <foo\+0x85>
+ 62: eb 21 jmp 85 <foo\+0x85>
+ 64: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 67: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6a: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 70: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 73: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 76: 5d pop %rbp
+ 77: 5d pop %rbp
+ 78: 48 39 c5 cmp %rax,%rbp
+ 7b: 74 02 je 7f <foo\+0x7f>
+ 7d: eb 06 jmp 85 <foo\+0x85>
+ 7f: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 82: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9d: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a3: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a9: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ af: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ bb: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c1: eb c2 jmp 85 <foo\+0x85>
+ c3: 5d pop %rbp
+ c4: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1g.d b/gas/testsuite/gas/i386/x86-64-align-branch-1g.d
new file mode 100644
index 0000000..6244940
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1g.d
@@ -0,0 +1,75 @@
+#source: x86-64-align-branch-1.s
+#as: -mbranches-within-32B-boundaries
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5d je 82 <foo\+0x82>
+ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\)
+ 29: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 32: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 35: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 38: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3e: 5d pop %rbp
+ 3f: 5d pop %rbp
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %rbp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\)
+ 49: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 52: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5e: 5d pop %rbp
+ 5f: 5d pop %rbp
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 78: 5d pop %rbp
+ 79: 5d pop %rbp
+ 7a: 48 39 c5 cmp %rax,%rbp
+ 7d: 74 03 je 82 <foo\+0x82>
+ 7f: 90 nop
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c4: eb c2 jmp 88 <foo\+0x88>
+ c6: 5d pop %rbp
+ c7: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1h.d b/gas/testsuite/gas/i386/x86-64-align-branch-1h.d
new file mode 100644
index 0000000..a6022be
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1h.d
@@ -0,0 +1,74 @@
+#source: x86-64-align-branch-1.s
+#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 48 89 e5 mov %rsp,%rbp
+ e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 48 39 c5 cmp %rax,%rbp
+ 20: 74 5a je 7c <foo\+0x7c>
+ 22: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 25: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 28: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 5d pop %rbp
+ 3b: 5d pop %rbp
+ 3c: 74 3e je 7c <foo\+0x7c>
+ 3e: 5d pop %rbp
+ 3f: 74 3b je 7c <foo\+0x7c>
+ 41: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 44: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 47: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 50: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 53: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 56: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 59: 5d pop %rbp
+ 5a: 5d pop %rbp
+ 5b: eb 25 jmp 82 <foo\+0x82>
+ 5d: eb 23 jmp 82 <foo\+0x82>
+ 5f: eb 21 jmp 82 <foo\+0x82>
+ 61: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 64: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 67: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 70: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 73: 5d pop %rbp
+ 74: 5d pop %rbp
+ 75: 48 39 c5 cmp %rax,%rbp
+ 78: 74 02 je 7c <foo\+0x7c>
+ 7a: eb 06 jmp 82 <foo\+0x82>
+ 7c: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 7f: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: eb c2 jmp 82 <foo\+0x82>
+ c0: 5d pop %rbp
+ c1: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1i.d b/gas/testsuite/gas/i386/x86-64-align-branch-1i.d
new file mode 100644
index 0000000..2493626
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1i.d
@@ -0,0 +1,78 @@
+#source: x86-64-align-branch-1.s
+#as: -malign-branch-boundary=32 -malign-branch-prefix-size=0
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 48 89 e5 mov %rsp,%rbp
+ e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 0f 1f 00 nopl \(%rax\)
+ 20: 48 39 c5 cmp %rax,%rbp
+ 23: 74 5d je 82 <foo\+0x82>
+ 25: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 28: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2b: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3d: 5d pop %rbp
+ 3e: 5d pop %rbp
+ 3f: 90 nop
+ 40: 74 40 je 82 <foo\+0x82>
+ 42: 5d pop %rbp
+ 43: 74 3d je 82 <foo\+0x82>
+ 45: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 48: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 4b: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 57: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5d: 5d pop %rbp
+ 5e: 5d pop %rbp
+ 5f: 90 nop
+ 60: eb 26 jmp 88 <foo\+0x88>
+ 62: eb 24 jmp 88 <foo\+0x88>
+ 64: eb 22 jmp 88 <foo\+0x88>
+ 66: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 69: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 72: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 75: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 78: 5d pop %rbp
+ 79: 5d pop %rbp
+ 7a: 48 39 c5 cmp %rax,%rbp
+ 7d: 74 03 je 82 <foo\+0x82>
+ 7f: 90 nop
+ 80: eb 06 jmp 88 <foo\+0x88>
+ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax
+ 85: 89 45 fc mov %eax,-0x4\(%rbp\)
+ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\)
+ c4: eb c2 jmp 88 <foo\+0x88>
+ c6: 5d pop %rbp
+ c7: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2.s b/gas/testsuite/gas/i386/x86-64-align-branch-2.s
new file mode 100644
index 0000000..54999f8
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2.s
@@ -0,0 +1,44 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ jmp *%rax
+ pushq %rbp
+ pushq %rbp
+ movl %eax, %fs:0x1
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ call *%rax
+ movl %esi, -12(%rbp)
+ pushq %rbp
+ pushq %rbp
+ movl %eax, %fs:0x1
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ call foo
+ movl %esi, -12(%rbp)
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ movl %eax, %fs:0x1
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ call *foo
+ pushq %rbp
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2a.d b/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
new file mode 100644
index 0000000..aaf759d
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
@@ -0,0 +1,50 @@
+#source: x86-64-align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 55 push %rbp
+ c: 48 89 e5 mov %rsp,%rbp
+ f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1e: ff e0 jmpq \*%rax
+ 20: 55 push %rbp
+ 21: 55 push %rbp
+ 22: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 2a: 48 89 e5 mov %rsp,%rbp
+ 2d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 30: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3c: ff d0 callq \*%rax
+ 3e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 41: 55 push %rbp
+ 42: 55 push %rbp
+ 43: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 4b: 48 89 e5 mov %rsp,%rbp
+ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 51: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 54: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 57: e8 [0-9a-f ]+ callq .*
+ 5c: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5f: 55 push %rbp
+ 60: 55 push %rbp
+ 61: 55 push %rbp
+ 62: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 6a: 48 89 e5 mov %rsp,%rbp
+ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 70: ff 14 25 00 00 00 00 callq \*0x0
+ 77: 55 push %rbp
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2b.d b/gas/testsuite/gas/i386/x86-64-align-branch-2b.d
new file mode 100644
index 0000000..720868e
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2b.d
@@ -0,0 +1,50 @@
+#source: x86-64-align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=indirect
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 89 04 25 01 00 00 00 fs fs mov %eax,%fs:0x1
+ a: 55 push %rbp
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: ff e0 jmpq \*%rax
+ 22: 2e 2e 55 cs cs push %rbp
+ 25: 55 push %rbp
+ 26: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 2e: 48 89 e5 mov %rsp,%rbp
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 40: ff d0 callq \*%rax
+ 42: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 45: 55 push %rbp
+ 46: 55 push %rbp
+ 47: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 4f: 48 89 e5 mov %rsp,%rbp
+ 52: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 55: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 58: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5b: e8 [0-9a-f ]+ callq .*
+ 60: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 63: 55 push %rbp
+ 64: 55 push %rbp
+ 65: 55 push %rbp
+ 66: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 6e: 48 89 e5 mov %rsp,%rbp
+ 71: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 74: ff 14 25 00 00 00 00 callq \*0x0
+ 7b: 55 push %rbp
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2c.d b/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
new file mode 100644
index 0000000..fb87c49
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
@@ -0,0 +1,50 @@
+#source: x86-64-align-branch-2.s
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 64 89 04 25 01 00 00 00 fs fs mov %eax,%fs:0x1
+ a: 55 push %rbp
+ b: 55 push %rbp
+ c: 55 push %rbp
+ d: 55 push %rbp
+ e: 48 89 e5 mov %rsp,%rbp
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: ff e0 jmpq \*%rax
+ 22: 2e 2e 55 cs cs push %rbp
+ 25: 55 push %rbp
+ 26: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 2e: 48 89 e5 mov %rsp,%rbp
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 40: ff d0 callq \*%rax
+ 42: 2e 2e 2e 2e 2e 89 75 f4 cs cs cs cs mov %esi,%cs:-0xc\(%rbp\)
+ 4a: 55 push %rbp
+ 4b: 55 push %rbp
+ 4c: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 54: 48 89 e5 mov %rsp,%rbp
+ 57: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 5d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 60: e8 [0-9a-f ]+ callq .*
+ 65: 2e 2e 2e 2e 2e 89 75 f4 cs cs cs cs mov %esi,%cs:-0xc\(%rbp\)
+ 6d: 2e 2e 55 cs cs push %rbp
+ 70: 55 push %rbp
+ 71: 55 push %rbp
+ 72: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 7a: 48 89 e5 mov %rsp,%rbp
+ 7d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 80: ff 14 25 00 00 00 00 callq \*0x0
+ 87: 55 push %rbp
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-3.d b/gas/testsuite/gas/i386/x86-64-align-branch-3.d
new file mode 100644
index 0000000..18767a7
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-3.d
@@ -0,0 +1,32 @@
+#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 55 push %rbp
+ c: 48 89 e5 mov %rsp,%rbp
+ f: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 12: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 15: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 18: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1e: e8 00 00 00 00 callq 23 <foo\+0x23>
+ 23: 55 push %rbp
+ 24: 55 push %rbp
+ 25: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 2d: 48 89 e5 mov %rsp,%rbp
+ 30: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 33: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 36: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 39: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3c: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3f: ff 15 00 00 00 00 callq \*0x0\(%rip\) # 45 <foo\+0x45>
+ 45: 89 75 f4 mov %esi,-0xc\(%rbp\)
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-3.s b/gas/testsuite/gas/i386/x86-64-align-branch-3.s
new file mode 100644
index 0000000..6787cdc
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-3.s
@@ -0,0 +1,27 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ pushq %rbp
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ call __tls_get_addr
+ pushq %rbp
+ pushq %rbp
+ movl %eax, %fs:0x1
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ call *__tls_get_addr@GOTPCREL(%rip)
+ movl %esi, -12(%rbp)
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-4.s b/gas/testsuite/gas/i386/x86-64-align-branch-4.s
new file mode 100644
index 0000000..9b546fe
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-4.s
@@ -0,0 +1,27 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+ movl %eax, %fs:0x1
+ pushq %rbp
+ pushq %rbp
+ movq %rsp, %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ ret
+ pushq %rbp
+ movl %eax, %fs:0x1
+ pushq %rbp
+ pushq %rbp
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ ret $30
+ pushq %rbp
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-4a.d b/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
new file mode 100644
index 0000000..47318e8
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
@@ -0,0 +1,33 @@
+#source: x86-64-align-branch-4.s
+#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 8: 55 push %rbp
+ 9: 55 push %rbp
+ a: 48 89 e5 mov %rsp,%rbp
+ d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 10: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 13: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 16: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 19: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1c: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1f: c3 retq
+ 20: 55 push %rbp
+ 21: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 29: 55 push %rbp
+ 2a: 55 push %rbp
+ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3d: c2 1e 00 retq \$0x1e
+ 40: 55 push %rbp
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-4b.d b/gas/testsuite/gas/i386/x86-64-align-branch-4b.d
new file mode 100644
index 0000000..9a030dd
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-4b.d
@@ -0,0 +1,33 @@
+#source: x86-64-align-branch-4.s
+#as: -malign-branch-boundary=32 -malign-branch=ret
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: 64 64 89 04 25 01 00 00 00 fs mov %eax,%fs:0x1
+ 9: 55 push %rbp
+ a: 55 push %rbp
+ b: 48 89 e5 mov %rsp,%rbp
+ e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 11: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 14: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 17: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 20: c3 retq
+ 21: 2e 2e 55 cs cs push %rbp
+ 24: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ 2c: 55 push %rbp
+ 2d: 55 push %rbp
+ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 31: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 34: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 37: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ 40: c2 1e 00 retq \$0x1e
+ 43: 55 push %rbp
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-5.d b/gas/testsuite/gas/i386/x86-64-align-branch-5.d
new file mode 100644
index 0000000..3a16c1b
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-5.d
@@ -0,0 +1,37 @@
+#source: align-branch-5.s
+#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ 0: c1 e9 02 shr \$0x2,%ecx
+ 3: c1 e9 02 shr \$0x2,%ecx
+ 6: c1 e9 02 shr \$0x2,%ecx
+ 9: 89 d1 mov %edx,%ecx
+ b: 31 c0 xor %eax,%eax
+ d: c1 e9 02 shr \$0x2,%ecx
+ 10: c1 e9 02 shr \$0x2,%ecx
+ 13: c1 e9 02 shr \$0x2,%ecx
+ 16: c1 e9 02 shr \$0x2,%ecx
+ 19: c1 e9 02 shr \$0x2,%ecx
+ 1c: c1 e9 02 shr \$0x2,%ecx
+ 1f: f6 c2 02 test \$0x2,%dl
+ 22: f3 ab rep stos %eax,%es:\(%rdi\)
+ 24: 75 dd jne 3 <foo\+0x3>
+ 26: 31 c0 xor %eax,%eax
+ 28: c1 e9 02 shr \$0x2,%ecx
+ 2b: c1 e9 02 shr \$0x2,%ecx
+ 2e: c1 e9 02 shr \$0x2,%ecx
+ 31: 89 d1 mov %edx,%ecx
+ 33: 31 c0 xor %eax,%eax
+ 35: c1 e9 02 shr \$0x2,%ecx
+ 38: c1 e9 02 shr \$0x2,%ecx
+ 3b: c1 e9 02 shr \$0x2,%ecx
+ 3e: f6 c2 02 test \$0x2,%dl
+ 41: e8 00 00 00 00 callq 46 <foo\+0x46>
+ 46: 75 e3 jne 2b <foo\+0x2b>
+ 48: 31 c0 xor %eax,%eax
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-6.d b/gas/testsuite/gas/i386/x86-64-align-branch-6.d
new file mode 100644
index 0000000..59a157c
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-6.d
@@ -0,0 +1,19 @@
+#source: align-branch-6.s
+#as: -mbranches-within-32B-boundaries -D
+#objdump: -dw
+#warning_output: align-branch-6.e
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 66 66 2e 0f 1f 84 00 00 00 00 00 data16 nopw %cs:0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 0f 1f 80 00 00 00 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f2 73 bf bnd jae 0 <_start>
+ +[a-f0-9]+: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-7.d b/gas/testsuite/gas/i386/x86-64-align-branch-7.d
new file mode 100644
index 0000000..9454d53
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-7.d
@@ -0,0 +1,18 @@
+#as: -mbranches-within-32B-boundaries -malign-branch-prefix-size=4
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: 2e 66 0f 3a 60 00 03 pcmpestrm \$0x3,%cs:\(%rax\),%xmm0
+ +[a-f0-9]+: 2e 2e 48 89 e5 cs cs mov %rsp,%rbp
+ +[a-f0-9]+: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ +[a-f0-9]+: a8 04 test \$0x4,%al
+ +[a-f0-9]+: 70 dc jo 0 <foo>
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-7.s b/gas/testsuite/gas/i386/x86-64-align-branch-7.s
new file mode 100644
index 0000000..73f5807
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-7.s
@@ -0,0 +1,14 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+.L1:
+ pcmpestrm $3, (%rax), %xmm0
+ movq %rsp, %rbp
+ movl %edi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %eax, %fs:0x1
+ testb $0x4,%al
+ jo .L1
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-8.d b/gas/testsuite/gas/i386/x86-64-align-branch-8.d
new file mode 100644
index 0000000..bffabc1
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-8.d
@@ -0,0 +1,18 @@
+#as: -mbranches-within-32B-boundaries -malign-branch-prefix-size=4
+#objdump: -dw
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+ +[a-f0-9]+: 2e c4 63 79 60 38 03 vpcmpestrm \$0x3,%cs:\(%rax\),%xmm15
+ +[a-f0-9]+: 2e 2e 48 89 e5 cs cs mov %rsp,%rbp
+ +[a-f0-9]+: 89 7d f8 mov %edi,-0x8\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 89 75 f4 mov %esi,-0xc\(%rbp\)
+ +[a-f0-9]+: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1
+ +[a-f0-9]+: a8 04 test \$0x4,%al
+ +[a-f0-9]+: 70 dc jo 0 <foo>
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-8.s b/gas/testsuite/gas/i386/x86-64-align-branch-8.s
new file mode 100644
index 0000000..bab825c
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-8.s
@@ -0,0 +1,14 @@
+ .text
+ .globl foo
+ .p2align 4
+foo:
+.L1:
+ vpcmpestrm $3, (%rax), %xmm15
+ movq %rsp, %rbp
+ movl %edi, -8(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %esi, -12(%rbp)
+ movl %eax, %fs:0x1
+ testb $0x4,%al
+ jo .L1
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a704214..4b7e746 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-i386/align-branch-1.d: New file.
+ * testsuite/ld-i386/align-branch-1.s: Likewise.
+ * testsuite/ld-x86-64/align-branch-1.d: Likewise.
+ * testsuite/ld-x86-64/align-branch-1.3: Likewise.
+ * testsuite/ld-i386/i386.exp: Run the new test.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
2019-12-08 Alan Modra <amodra@gmail.com>
* testsuite/ld-elf/eh4.d: Match optional padding DW_CFA_nop in FDEs.
diff --git a/ld/testsuite/ld-i386/align-branch-1.d b/ld/testsuite/ld-i386/align-branch-1.d
new file mode 100644
index 0000000..9eb7287
--- /dev/null
+++ b/ld/testsuite/ld-i386/align-branch-1.d
@@ -0,0 +1,25 @@
+#as: --32 -mbranches-within-32B-boundaries
+#ld: -melf_i386
+#objdump: -dw
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 20 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 1c je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 85 ff test %edi,%edi
+ +[a-f0-9]+: 74 18 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 65 a1 00 00 00 00 mov %gs:0x0,%eax
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: 8d 74 26 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 3e 3e 3e 8b 90 fc ff ff ff ds ds mov %ds:-0x4\(%eax\),%edx
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 00 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/align-branch-1.s b/ld/testsuite/ld-i386/align-branch-1.s
new file mode 100644
index 0000000..48edffb
--- /dev/null
+++ b/ld/testsuite/ld-i386/align-branch-1.s
@@ -0,0 +1,19 @@
+ .text
+ .globl _start
+_start:
+ testl %edx, %edx
+ je .L1
+ testl %edx, %edx
+ je .L1
+ testl %edi, %edi
+ je .L1
+ leal bar@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ movl bar@dtpoff(%eax), %edx
+ testl %edx, %edx
+ je .L1
+.L1:
+ ret
+ .section ".tdata", "awT", @progbits
+bar:
+ .long 10
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 3a1fd8b..8fe047b 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -495,6 +495,7 @@ run_dump_test "pr23854"
run_dump_test "pr23930"
run_dump_test "pr24322a"
run_dump_test "pr24322b"
+run_dump_test "align-branch-1"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-x86-64/align-branch-1.d b/ld/testsuite/ld-x86-64/align-branch-1.d
new file mode 100644
index 0000000..8567912
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/align-branch-1.d
@@ -0,0 +1,21 @@
+#as: --64 -mbranches-within-32B-boundaries
+#ld: -melf_x86_64
+#objdump: -dw
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 21 je 401025 <_start\+0x25>
+ +[a-f0-9]+: 48 85 ff test %rdi,%rdi
+ +[a-f0-9]+: 74 1c je 401025 <_start\+0x25>
+ +[a-f0-9]+: 66 66 66 64 48 8b 04 25 00 00 00 00 data16 data16 data16 mov %fs:0x0,%rax
+ +[a-f0-9]+: 2e 2e 2e 2e 48 8b 98 fc ff ff ff cs cs cs mov %cs:-0x4\(%rax\),%rbx
+ +[a-f0-9]+: 48 85 db test %rbx,%rbx
+ +[a-f0-9]+: 74 00 je 401025 <_start\+0x25>
+ +[a-f0-9]+: c3 retq
+#pass
diff --git a/ld/testsuite/ld-x86-64/align-branch-1.s b/ld/testsuite/ld-x86-64/align-branch-1.s
new file mode 100644
index 0000000..5c60a37
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/align-branch-1.s
@@ -0,0 +1,17 @@
+ .text
+ .globl _start
+_start:
+ testl %edx, %edx
+ je .L1
+ testq %rdi, %rdi
+ je .L1
+ leaq bar@tlsld(%rip), %rdi
+ call __tls_get_addr@PLT
+ movq bar@dtpoff(%rax), %rbx
+ testq %rbx, %rbx
+ je .L1
+.L1:
+ ret
+ .section ".tdata", "awT", @progbits
+bar:
+ .long 10
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index b13cc7d..ab4822e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -460,6 +460,7 @@ run_dump_test "pr24721"
run_dump_test "pr24721-x32"
run_dump_test "pr24905"
run_dump_test "pr24905-x32"
+run_dump_test "align-branch-1"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return