i386: Add -mbranches-within-32B-boundaries
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Dec 2019 19:57:03 +0000 (11:57 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Dec 2019 20:03:45 +0000 (12:03 -0800)
Add -mbranches-within-32B-boundaries to enable

-malign-branch-boundary=32
-malign-branch=jcc+fused+jmp
-malign-branch-prefix-size=5

* 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.
(md_show_usage): Add -mbranches-within-32B-boundaries.

gas/ChangeLog
gas/config/tc-i386.c
gas/doc/c-i386.texi

index 7b83a0abd13cebb2afc17ff7ddad02b67b27ee5e..c6f776c028f5f22a9352c793601f601cf8a3096f 100644 (file)
@@ -1,3 +1,10 @@
+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.
+       (md_show_usage): Add -mbranches-within-32B-boundaries.
+
 2019-12-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-i386.c (_i386_insn): Add has_gotpc_tls_reloc.
index 41a6a0817a832c76e57685b49876abc3b92a04dd..6c71fc4d223b989e6b1bdfe4a5c8906d48aa1ffa 100644 (file)
@@ -12000,6 +12000,7 @@ const char *md_shortopts = "qnO::";
 #define OPTION_MALIGN_BRANCH_BOUNDARY (OPTION_MD_BASE + 27)
 #define OPTION_MALIGN_BRANCH_PREFIX_SIZE (OPTION_MD_BASE + 28)
 #define OPTION_MALIGN_BRANCH (OPTION_MD_BASE + 29)
+#define OPTION_MBRANCHES_WITH_32B_BOUNDARIES (OPTION_MD_BASE + 30)
 
 struct option md_longopts[] =
 {
@@ -12038,6 +12039,7 @@ struct option md_longopts[] =
   {"malign-branch-boundary", required_argument, NULL, OPTION_MALIGN_BRANCH_BOUNDARY},
   {"malign-branch-prefix-size", required_argument, NULL, OPTION_MALIGN_BRANCH_PREFIX_SIZE},
   {"malign-branch", required_argument, NULL, OPTION_MALIGN_BRANCH},
+  {"mbranches-within-32B-boundaries", no_argument, NULL, OPTION_MBRANCHES_WITH_32B_BOUNDARIES},
   {"mamd64", no_argument, NULL, OPTION_MAMD64},
   {"mintel64", no_argument, NULL, OPTION_MINTEL64},
   {NULL, no_argument, NULL, 0}
@@ -12500,6 +12502,14 @@ md_parse_option (int c, const char *arg)
       free (saved);
       break;
 
+    case OPTION_MBRANCHES_WITH_32B_BOUNDARIES:
+      align_branch_power = 5;
+      align_branch_prefix_size = 5;
+      align_branch = (align_branch_jcc_bit
+                     | align_branch_fused_bit
+                     | align_branch_jmp_bit);
+      break;
+
     case OPTION_MAMD64:
       intel64 = 0;
       break;
@@ -12763,6 +12773,9 @@ md_show_usage (FILE *stream)
   -malign-branch-prefix-size=NUM (default: 5)\n\
                           align branches with NUM prefixes per instruction\n"));
   fprintf (stream, _("\
+  -mbranches-within-32B-boundaries\n\
+                          align branches within 32 byte boundary\n"));
+  fprintf (stream, _("\
   -mamd64                 accept only AMD64 ISA [default]\n"));
   fprintf (stream, _("\
   -mintel64               accept only Intel64 ISA\n"));
index 74296e61f698966e92cb22a1807f576623eafad3..08f139cc1501fc5f1ab27d9559d6348794a94d56 100644 (file)
@@ -449,6 +449,17 @@ This option specifies the maximum number of prefixes on an instruction
 to align branches.  @var{NUM} should be between 0 and 5.  The default
 @var{NUM} is 5.
 
+@cindex @samp{-mbranches-within-32B-boundaries} option, i386
+@cindex @samp{-mbranches-within-32B-boundaries} option, x86-64
+@item -mbranches-within-32B-boundaries
+This option aligns conditional jumps, fused conditional jumps and
+unconditional jumps within 32 byte boundary with up to 5 segment prefixes
+on an instruction.  It is equivalent to
+@option{-malign-branch-boundary=32}
+@option{-malign-branch=jcc+fused+jmp}
+@option{-malign-branch-prefix-size=5}.
+The default doesn't align branches.
+
 @cindex @samp{-mx86-used-note=} option, i386
 @cindex @samp{-mx86-used-note=} option, x86-64
 @item -mx86-used-note=@var{no}
This page took 0.031327 seconds and 4 git commands to generate.