diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2008-04-10 17:53:40 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2008-04-10 17:53:40 +0000 |
commit | daf50ae75d6531256d833e273eeec189ce8a1166 (patch) | |
tree | 4c010e5ccfde18ff541453d26b261d896a707b63 /gas/config/tc-i386.c | |
parent | 112b7c5071b75bffeae19c11ca923e700cf36e16 (diff) | |
download | gdb-daf50ae75d6531256d833e273eeec189ce8a1166.zip gdb-daf50ae75d6531256d833e273eeec189ce8a1166.tar.gz gdb-daf50ae75d6531256d833e273eeec189ce8a1166.tar.bz2 |
gas/
2008-04-10 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention -msse-check=[none|error|warning].
* config/tc-i386.c (sse_check): New.
(OPTION_MSSE_CHECK): Likewise.
(md_assemble): Check SSE instructions if needed.
(md_longopts): Add -msse-check.
(md_parse_option): Handle OPTION_MSSE_CHECK.
(md_show_usage): Show -msse-check=[none|error|warning].
* doc/c-i386.texi: Document -msse-check=[none|error|warning].
gas/testsuite/
2008-04-10 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Run sse-check, sse-check-warn,
sse-check-error, x86-64-sse-check, x86-64-sse-check-warn and
x86-64-sse-check-error.
* gas/i386/sse-check.d: New.
* gas/i386/sse-check.s: Likewise.
* gas/i386/sse-check-error.l: Likewise.
* gas/i386/sse-check-error.s: Likewise.
* gas/i386/sse-check-warn.d: Likewise.
* gas/i386/sse-check-warn.e: Likewise.
* gas/i386/x86-64-sse-check.d: Likewise.
* gas/i386/x86-64-sse-check-error.l: Likewise.
* gas/i386/x86-64-sse-check-error.s: Likewise.
* gas/i386/x86-64-sse-check-warn.d: Likewise.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index f6b3909..2a5e79c 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -434,6 +434,14 @@ static int allow_naked_reg = 0; /* 1 if pseudo index register, eiz/riz, is allowed . */ static int allow_index_reg = 0; +static enum + { + sse_check_none = 0, + sse_check_warning, + sse_check_error + } +sse_check; + /* Register prefix used for error message. */ static const char *register_prefix = "%"; @@ -2661,6 +2669,19 @@ md_assemble (char *line) if (!match_template ()) return; + if (sse_check != sse_check_none + && (i.tm.cpu_flags.bitfield.cpusse + || i.tm.cpu_flags.bitfield.cpusse2 + || i.tm.cpu_flags.bitfield.cpusse3 + || i.tm.cpu_flags.bitfield.cpussse3 + || i.tm.cpu_flags.bitfield.cpusse4_1 + || i.tm.cpu_flags.bitfield.cpusse4_2)) + { + (sse_check == sse_check_warning + ? as_warn + : as_bad) (_("SSE instruction `%s' is used"), i.tm.name); + } + /* Zap movzx and movsx suffix. The suffix has been set from "word ptr" or "byte ptr" on the source operand in Intel syntax or extracted from mnemonic in AT&T syntax. But we'll use @@ -7798,6 +7819,7 @@ const char *md_shortopts = "qn"; #define OPTION_MNAKED_REG (OPTION_MD_BASE + 8) #define OPTION_MOLD_GCC (OPTION_MD_BASE + 9) #define OPTION_MSSE2AVX (OPTION_MD_BASE + 10) +#define OPTION_MSSE_CHECK (OPTION_MD_BASE + 11) struct option md_longopts[] = { @@ -7814,6 +7836,7 @@ struct option md_longopts[] = {"mnaked-reg", no_argument, NULL, OPTION_MNAKED_REG}, {"mold-gcc", no_argument, NULL, OPTION_MOLD_GCC}, {"msse2avx", no_argument, NULL, OPTION_MSSE2AVX}, + {"msse-check", required_argument, NULL, OPTION_MSSE_CHECK}, {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); @@ -8007,6 +8030,17 @@ md_parse_option (int c, char *arg) sse2avx = 1; break; + case OPTION_MSSE_CHECK: + if (strcasecmp (arg, "error") == 0) + sse_check = sse_check_error; + else if (strcasecmp (arg, "warning") == 0) + sse_check = sse_check_warning; + else if (strcasecmp (arg, "none") == 0) + sse_check = sse_check_none; + else + as_fatal (_("Invalid -msse-check= option: `%s'"), arg); + break; + default: return 0; } @@ -8061,6 +8095,9 @@ md_show_usage (stream) fprintf (stream, _("\ -msse2avx encode SSE instructions with VEX prefix\n")); fprintf (stream, _("\ + -msse-check=[none|error|warning]\n\ + check SSE instructions\n")); + fprintf (stream, _("\ -mmnemonic=[att|intel] use AT&T/Intel mnemonic\n")); fprintf (stream, _("\ -msyntax=[att|intel] use AT&T/Intel syntax\n")); |