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 | |
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')
-rw-r--r-- | gas/ChangeLog | 13 | ||||
-rw-r--r-- | gas/NEWS | 3 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 37 | ||||
-rw-r--r-- | gas/doc/c-i386.texi | 12 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 17 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check-error.l | 40 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check-error.s | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check-warn.d | 18 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check-warn.e | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check.d | 16 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/sse-check.s | 20 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-sse-check-error.l | 40 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-sse-check-error.s | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-sse-check-warn.d | 18 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-sse-check.d | 17 |
16 files changed, 266 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index c25d7a3..f0bb52b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +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]. + 2008-04-10 Santiago Urueña <suruena@gmail.com> * listing.c: Add -ag listing flag to show general information in @@ -1,4 +1,7 @@ -*- text -*- +* New command line option, -msse-check=[none|error|warning], for x86 + targets. + * New sub-option added to the assembler's -a command line switch to generate a listing output. The 'g' sub-option will insert into the listing various information about the assembly, such as assembler version, the 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")); diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi index 3e148a2..1fd3476 100644 --- a/gas/doc/c-i386.texi +++ b/gas/doc/c-i386.texi @@ -155,6 +155,18 @@ Valid @var{CPU} values are identical to the processor list of This option specifies that the assembler should encode SSE instructions with VEX prefix. +@cindex @samp{-msse-check=} option, i386 +@cindex @samp{-msse-check=} option, x86-64 +@item -msse-check=@var{none} +@item -msse-check=@var{warning} +@item -msse-check=@var{error} +These options control if the assembler should check SSE intructions. +@option{-msse-check=@var{none}} will make the assembler not to check SSE +instructions, which is the default. @option{-msse-check=@var{warning}} +will make the assembler issue a warning for any SSE intruction. +@option{-msse-check=@var{error}} will make the assembler issue an error +for any SSE intruction. + @cindex @samp{-mmnemonic=} option, i386 @cindex @samp{-mmnemonic=} option, x86-64 @item -mmnemonic=@var{att} diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index bc31103..152e4f5 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,20 @@ +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. + 2008-04-10 Santiago Urueña <suruena@gmail.com> * gas/all/gas.exp: Check the performance of the -ag command line diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 4111fe5..18d6a7d 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -124,6 +124,9 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "avx-intel" run_dump_test "sse2avx" run_list_test "inval-avx" "-al" + run_dump_test "sse-check" + run_dump_test "sse-check-warn" + run_list_test "sse-check-error" "-msse-check=error -I${srcdir}/$subdir -al" # These tests require support for 8 and 16 bit relocs, # so we only run them for ELF and COFF targets. @@ -250,6 +253,9 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-avx-intel" run_dump_test "x86-64-sse2avx" run_list_test "x86-64-inval-avx" "-al" + run_dump_test "x86-64-sse-check" + run_dump_test "x86-64-sse-check-warn" + run_list_test "x86-64-sse-check-error" "-msse-check=error -I${srcdir}/$subdir -al" if { ![istarget "*-*-aix*"] && ![istarget "*-*-beos*"] diff --git a/gas/testsuite/gas/i386/sse-check-error.l b/gas/testsuite/gas/i386/sse-check-error.l new file mode 100644 index 0000000..bd1c4f6 --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check-error.l @@ -0,0 +1,40 @@ +.*: Assembler messages: +.*:7: Error: .* +.*:10: Error: .* +.*:13: Error: .* +.*:16: Error: .* +.*:19: Error: .* +.*:20: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.include "sse-check\.s" +[ ]*1[ ]+\# Check SSE instructions +[ ]*2[ ]+ +[ ]*3[ ]+\.text +[ ]*4[ ]+_start: +[ ]*5[ ]+ +[ ]*6[ ]+\# SSE instruction +[ ]*7[ ]+\?\?\?\? 0F58CA addps %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addps' is used +[ ]*8[ ]+ +[ ]*9[ ]+\# SSE2 instruction +[ ]*10[ ]+\?\?\?\? 660F58CA addpd %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addpd' is used +[ ]*11[ ]+ +[ ]*12[ ]+\# SSE3 instruction +[ ]*13[ ]+\?\?\?\? 660FD0CA addsubpd %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addsubpd' is used +[ ]*14[ ]+ +[ ]*15[ ]+\# SSSE3 instruction +[ ]*16[ ]+\?\?\?\? 660F3801 phaddw %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `phaddw' is used +[ ]*16[ ]+CA +[ ]*17[ ]+ +[ ]*18[ ]+\# SSE4 instructions +[ ]*19[ ]+\?\?\?\? 660F3815 blendvpd %xmm0,%xmm1,%xmm0 +\*\*\*\* Error:SSE instruction `blendvpd' is used +[ ]*19[ ]+C1 +[ ]*20[ ]+\?\?\?\? 660F3837 pcmpgtq %xmm1,%xmm0 +\*\*\*\* Error:SSE instruction `pcmpgtq' is used +[ ]*20[ ]+C1 diff --git a/gas/testsuite/gas/i386/sse-check-error.s b/gas/testsuite/gas/i386/sse-check-error.s new file mode 100644 index 0000000..450ff1f --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check-error.s @@ -0,0 +1 @@ +.include "sse-check.s" diff --git a/gas/testsuite/gas/i386/sse-check-warn.d b/gas/testsuite/gas/i386/sse-check-warn.d new file mode 100644 index 0000000..0b96b15 --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check-warn.d @@ -0,0 +1,18 @@ +#source: sse-check.s +#as: -msse-check=warning +#stderr: sse-check-warn.e +#objdump: -dw +#name: i386 SSE check (warning) + +.*: file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 0f 58 ca addps %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 58 ca addpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f d0 ca addsubpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 01 ca phaddw %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 15 c1 blendvpd %xmm0,%xmm1,%xmm0 +[ ]*[a-f0-9]+: 66 0f 38 37 c1 pcmpgtq %xmm1,%xmm0 +#pass diff --git a/gas/testsuite/gas/i386/sse-check-warn.e b/gas/testsuite/gas/i386/sse-check-warn.e new file mode 100644 index 0000000..26b2001 --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check-warn.e @@ -0,0 +1,7 @@ +.*: Assembler messages: +.*:7: Warning: SSE instruction `addps' is used +.*:10: Warning: SSE instruction `addpd' is used +.*:13: Warning: SSE instruction `addsubpd' is used +.*:16: Warning: SSE instruction `phaddw' is used +.*:19: Warning: SSE instruction `blendvpd' is used +.*:20: Warning: SSE instruction `pcmpgtq' is used diff --git a/gas/testsuite/gas/i386/sse-check.d b/gas/testsuite/gas/i386/sse-check.d new file mode 100644 index 0000000..9329638 --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check.d @@ -0,0 +1,16 @@ +#as: -msse-check=none +#objdump: -dw +#name: i386 SSE check (none) + +.*: file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 0f 58 ca addps %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 58 ca addpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f d0 ca addsubpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 01 ca phaddw %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 15 c1 blendvpd %xmm0,%xmm1,%xmm0 +[ ]*[a-f0-9]+: 66 0f 38 37 c1 pcmpgtq %xmm1,%xmm0 +#pass diff --git a/gas/testsuite/gas/i386/sse-check.s b/gas/testsuite/gas/i386/sse-check.s new file mode 100644 index 0000000..7e5d208 --- /dev/null +++ b/gas/testsuite/gas/i386/sse-check.s @@ -0,0 +1,20 @@ +# Check SSE instructions + + .text +_start: + +# SSE instruction + addps %xmm2,%xmm1 + +# SSE2 instruction + addpd %xmm2,%xmm1 + +# SSE3 instruction + addsubpd %xmm2,%xmm1 + +# SSSE3 instruction + phaddw %xmm2,%xmm1 + +# SSE4 instructions + blendvpd %xmm0,%xmm1,%xmm0 + pcmpgtq %xmm1,%xmm0 diff --git a/gas/testsuite/gas/i386/x86-64-sse-check-error.l b/gas/testsuite/gas/i386/x86-64-sse-check-error.l new file mode 100644 index 0000000..bd1c4f6 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-sse-check-error.l @@ -0,0 +1,40 @@ +.*: Assembler messages: +.*:7: Error: .* +.*:10: Error: .* +.*:13: Error: .* +.*:16: Error: .* +.*:19: Error: .* +.*:20: Error: .* +GAS LISTING .* + + +[ ]*1[ ]+\.include "sse-check\.s" +[ ]*1[ ]+\# Check SSE instructions +[ ]*2[ ]+ +[ ]*3[ ]+\.text +[ ]*4[ ]+_start: +[ ]*5[ ]+ +[ ]*6[ ]+\# SSE instruction +[ ]*7[ ]+\?\?\?\? 0F58CA addps %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addps' is used +[ ]*8[ ]+ +[ ]*9[ ]+\# SSE2 instruction +[ ]*10[ ]+\?\?\?\? 660F58CA addpd %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addpd' is used +[ ]*11[ ]+ +[ ]*12[ ]+\# SSE3 instruction +[ ]*13[ ]+\?\?\?\? 660FD0CA addsubpd %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `addsubpd' is used +[ ]*14[ ]+ +[ ]*15[ ]+\# SSSE3 instruction +[ ]*16[ ]+\?\?\?\? 660F3801 phaddw %xmm2,%xmm1 +\*\*\*\* Error:SSE instruction `phaddw' is used +[ ]*16[ ]+CA +[ ]*17[ ]+ +[ ]*18[ ]+\# SSE4 instructions +[ ]*19[ ]+\?\?\?\? 660F3815 blendvpd %xmm0,%xmm1,%xmm0 +\*\*\*\* Error:SSE instruction `blendvpd' is used +[ ]*19[ ]+C1 +[ ]*20[ ]+\?\?\?\? 660F3837 pcmpgtq %xmm1,%xmm0 +\*\*\*\* Error:SSE instruction `pcmpgtq' is used +[ ]*20[ ]+C1 diff --git a/gas/testsuite/gas/i386/x86-64-sse-check-error.s b/gas/testsuite/gas/i386/x86-64-sse-check-error.s new file mode 100644 index 0000000..450ff1f --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-sse-check-error.s @@ -0,0 +1 @@ +.include "sse-check.s" diff --git a/gas/testsuite/gas/i386/x86-64-sse-check-warn.d b/gas/testsuite/gas/i386/x86-64-sse-check-warn.d new file mode 100644 index 0000000..691185c --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-sse-check-warn.d @@ -0,0 +1,18 @@ +#source: sse-check.s +#as: -msse-check=warning +#stderr: sse-check-warn.e +#objdump: -dw +#name: x86-64 SSE check (warning) + +.*: file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 0f 58 ca addps %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 58 ca addpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f d0 ca addsubpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 01 ca phaddw %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 15 c1 blendvpd %xmm0,%xmm1,%xmm0 +[ ]*[a-f0-9]+: 66 0f 38 37 c1 pcmpgtq %xmm1,%xmm0 +#pass diff --git a/gas/testsuite/gas/i386/x86-64-sse-check.d b/gas/testsuite/gas/i386/x86-64-sse-check.d new file mode 100644 index 0000000..9ca0c79 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-sse-check.d @@ -0,0 +1,17 @@ +#source: sse-check.s +#as: -msse-check=none +#objdump: -dw +#name: x86-64 SSE check (none) + +.*: file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 0f 58 ca addps %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 58 ca addpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f d0 ca addsubpd %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 01 ca phaddw %xmm2,%xmm1 +[ ]*[a-f0-9]+: 66 0f 38 15 c1 blendvpd %xmm0,%xmm1,%xmm0 +[ ]*[a-f0-9]+: 66 0f 38 37 c1 pcmpgtq %xmm1,%xmm0 +#pass |