+2014-08-06 Ilya Tocar <ilya.tocar@intel.com>
+
+ * config/tc-i386.c (omit_lock_prefix): New.
+ (output_insn): Omit lock prefix if omit_lock_prefix is true.
+ (OPTION_omit_lock_prefix): New.
+ (md_longopts): Add momit-lock-prefix.
+ (md_parse_option): Handle momit-lock-prefix.
+ (md_show_usage): Add momit-lock-prefix=[no|yes].
+ * doc/c-i386.texi (momit-lock-prefix): Document.
+
2014-08-01 Takashi Yoshii <yoshii.takashi@renesas.com>
PR 10378
/* 1 if pseudo index register, eiz/riz, is allowed . */
static int allow_index_reg = 0;
+/* 1 if the assembler should ignore LOCK prefix, even if it was
+ specified explicitly. */
+static int omit_lock_prefix = 0;
+
static enum check_kind
{
check_none = 0,
unsigned int j;
unsigned int prefix;
+ /* Some processors fail on LOCK prefix. This options makes
+ assembler ignore LOCK prefix and serves as a workaround. */
+ if (omit_lock_prefix)
+ {
+ if (i.tm.base_opcode == LOCK_PREFIX_OPCODE)
+ return;
+ i.prefix[LOCK_PREFIX] = 0;
+ }
+
/* Since the VEX/EVEX prefix contains the implicit prefix, we
don't need the explicit prefix. */
if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex)
#define OPTION_MEVEXLIG (OPTION_MD_BASE + 16)
#define OPTION_MEVEXWIG (OPTION_MD_BASE + 17)
#define OPTION_MBIG_OBJ (OPTION_MD_BASE + 18)
+#define OPTION_omit_lock_prefix (OPTION_MD_BASE + 19)
struct option md_longopts[] =
{
# if defined (TE_PE) || defined (TE_PEP)
{"mbig-obj", no_argument, NULL, OPTION_MBIG_OBJ},
#endif
+ {"momit-lock-prefix", required_argument, NULL, OPTION_omit_lock_prefix},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
break;
#endif
+ case OPTION_omit_lock_prefix:
+ if (strcasecmp (arg, "yes") == 0)
+ omit_lock_prefix = 1;
+ else if (strcasecmp (arg, "no") == 0)
+ omit_lock_prefix = 0;
+ else
+ as_fatal (_("invalid -momit-lock-prefix= option: `%s'"), arg);
+ break;
+
default:
return 0;
}
fprintf (stream, _("\
-mbig-obj generate big object files\n"));
#endif
+ fprintf (stream, _("\
+ -momit-lock-prefix=[no|yes]\n\
+ strip all lock prefixes\n"));
}
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
On x86-64 PE/COFF target this option forces the use of big object file
format, which allows more than 32768 sections.
+@cindex @samp{-momit-lock-prefix=} option, i386
+@cindex @samp{-momit-lock-prefix=} option, x86-64
+@item -momit-lock-prefix=@var{no}
+@itemx -momit-lock-prefix=@var{yes}
+These options control how the assembler should encode lock prefix.
+This option is intended as a workaround for processors, that fail on
+lock prefix. This option can only be safely used with single-core,
+single-thread computers
+@option{-momit-lock-prefix=@var{yes}} will omit all lock prefixes.
+@option{-momit-lock-prefix=@var{no}} will encode lock prefix as usual,
+which is the default.
+
@end table
@c man end
+2014-08-06 Ilya Tocar <ilya.tocar@intel.com>
+
+ * gas/i386/i386.exp: Run new tests.
+ * gas/i386/omit-lock-no.d: New.
+ * gas/i386/omit-lock-yes.d: Ditto.
+ * gas/i386/omit-lock.s: Ditto.
+
2014-07-29 Matthew Fortune <matthew.fortune@imgtec.com>
* gas/mips/attr-gnu-4-0.d: New.
run_dump_test "avx512dq"
run_dump_test "avx512dq_vl-intel"
run_dump_test "avx512dq_vl"
+ run_dump_test "omit-lock-yes"
+ run_dump_test "omit-lock-no"
run_dump_test "disassem"
# These tests require support for 8 and 16 bit relocs,
--- /dev/null
+#source: omit-lock.s
+#as: -momit-lock-prefix=yes -momit-lock-prefix=no
+#objdump: -dw
+#name: i386 omit lock = no
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+ <main>:
+ 0: f0 f0 83 00 01 lock lock addl \$0x1,\(%eax\)
+#pass
--- /dev/null
+#source: omit-lock.s
+#as: -momit-lock-prefix=yes
+#objdump: -dw
+#name: i386 omit lock = yes
+
+.*: +file format .*i386.*
+
+Disassembly of section .text:
+
+0+ <main>:
+ 0: 83 00 01 addl \$0x1,\(%eax\)
+#pass
--- /dev/null
+ .code32
+.globl main
+ .type main, @function
+main:
+ lock
+ lock addl $0x1,(%eax)