From 10d97a0f99079325bf85e17cc741496e686a6b74 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 3 Mar 2020 07:39:18 -0800 Subject: x86: Allow integer conversion without suffix in AT&T syntax According to gas manual, suffix in instruction mnemonics isn't always required: When there is no sizing suffix and no (suitable) register operands to deduce the size of memory operands, with a few exceptions and where long operand size is possible in the first place, operand size will default to long in 32- and 64-bit modes. This includes cvtsi2sd, cvtsi2ss, vcvtsi2sd, vcvtsi2ss, vcvtusi2sd and vcvtusi2ss. Since they are used in GCC 8 and older GCC releases, they must be allowed without suffix in AT&T syntax. gas/ PR gas/25622 * testsuite/gas/i386/i386.exp: Run x86-64-default-suffix and x86-64-default-suffix-avx. * testsuite/gas/i386/noreg64.s: Remove cvtsi2sd, cvtsi2ss, vcvtsi2sd, vcvtsi2ss, vcvtusi2sd and vcvtusi2ss entries. * testsuite/gas/i386/noreg64.d: Updated. * testsuite/gas/i386/noreg64.l: Likewise. * testsuite/gas/i386/x86-64-default-suffix-avx.d: New file. * testsuite/gas/i386/x86-64-default-suffix.d: Likewise. * testsuite/gas/i386/x86-64-default-suffix.s: Likewise. opcodes/ PR gas/25622 * i386-opc.tbl: Add IgnoreSize to cvtsi2sd, cvtsi2ss, vcvtsi2sd, vcvtsi2ss, vcvtusi2sd and vcvtusi2ss for AT&T syntax. * i386-tbl.h: Regenerated. --- gas/ChangeLog | 13 +++++++++++++ gas/testsuite/gas/i386/i386.exp | 2 ++ gas/testsuite/gas/i386/noreg64.d | 8 -------- gas/testsuite/gas/i386/noreg64.l | 8 -------- gas/testsuite/gas/i386/noreg64.s | 8 -------- gas/testsuite/gas/i386/x86-64-default-suffix-avx.d | 19 +++++++++++++++++++ gas/testsuite/gas/i386/x86-64-default-suffix.d | 17 +++++++++++++++++ gas/testsuite/gas/i386/x86-64-default-suffix.s | 10 ++++++++++ 8 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 gas/testsuite/gas/i386/x86-64-default-suffix-avx.d create mode 100644 gas/testsuite/gas/i386/x86-64-default-suffix.d create mode 100644 gas/testsuite/gas/i386/x86-64-default-suffix.s (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 00c5623..835383c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +2020-03-03 H.J. Lu + + PR gas/25622 + * testsuite/gas/i386/i386.exp: Run x86-64-default-suffix and + x86-64-default-suffix-avx. + * testsuite/gas/i386/noreg64.s: Remove cvtsi2sd, cvtsi2ss, + vcvtsi2sd, vcvtsi2ss, vcvtusi2sd and vcvtusi2ss entries. + * testsuite/gas/i386/noreg64.d: Updated. + * testsuite/gas/i386/noreg64.l: Likewise. + * testsuite/gas/i386/x86-64-default-suffix-avx.d: New file. + * testsuite/gas/i386/x86-64-default-suffix.d: Likewise. + * testsuite/gas/i386/x86-64-default-suffix.s: Likewise. + 2020-03-03 Sergey Belyashov PR 25604 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 8fc621f..7f6c27a 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -938,6 +938,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-avx512dq_vl" run_dump_test "x86-64-suffix" run_dump_test "x86-64-suffix-intel" + run_dump_test "x86-64-default-suffix" + run_dump_test "x86-64-default-suffix-avx" run_dump_test "x86-64-avx512dq-rcigrd-intel" run_dump_test "x86-64-avx512dq-rcigrd" run_dump_test "x86-64-avx512dq-rcigrne-intel" diff --git a/gas/testsuite/gas/i386/noreg64.d b/gas/testsuite/gas/i386/noreg64.d index e7764f9..f381c75 100644 --- a/gas/testsuite/gas/i386/noreg64.d +++ b/gas/testsuite/gas/i386/noreg64.d @@ -32,8 +32,6 @@ Disassembly of section .text: *[a-f0-9]+: a7 cmpsl %es:\(%rdi\),%ds:\(%rsi\) *[a-f0-9]+: f2 0f 38 f1 00 crc32l \(%rax\),%eax *[a-f0-9]+: f2 48 0f 38 f1 00 crc32q \(%rax\),%rax - *[a-f0-9]+: f2 0f 2a 00 cvtsi2sdl \(%rax\),%xmm0 - *[a-f0-9]+: f3 0f 2a 00 cvtsi2ssl \(%rax\),%xmm0 *[a-f0-9]+: ff 08 decl \(%rax\) *[a-f0-9]+: f7 30 divl \(%rax\) *[a-f0-9]+: d8 00 fadds \(%rax\) @@ -155,12 +153,6 @@ Disassembly of section .text: *[a-f0-9]+: f7 00 89 00 00 00 testl \$0x89,\(%rax\) *[a-f0-9]+: f7 00 34 12 00 00 testl \$0x1234,\(%rax\) *[a-f0-9]+: f7 00 78 56 34 12 testl \$0x12345678,\(%rax\) - *[a-f0-9]+: c5 fb 2a 00 vcvtsi2sdl \(%rax\),%xmm0,%xmm0 - *[a-f0-9]+: 62 61 7f 08 2a 38 vcvtsi2sdl \(%rax\),%xmm0,%xmm31 - *[a-f0-9]+: c5 fa 2a 00 vcvtsi2ssl \(%rax\),%xmm0,%xmm0 - *[a-f0-9]+: 62 61 7e 08 2a 38 vcvtsi2ssl \(%rax\),%xmm0,%xmm31 - *[a-f0-9]+: 62 f1 7f 08 7b 00 vcvtusi2sdl \(%rax\),%xmm0,%xmm0 - *[a-f0-9]+: 62 f1 7e 08 7b 00 vcvtusi2ssl \(%rax\),%xmm0,%xmm0 *[a-f0-9]+: 83 30 01 xorl \$0x1,\(%rax\) *[a-f0-9]+: 81 30 89 00 00 00 xorl \$0x89,\(%rax\) *[a-f0-9]+: 81 30 34 12 00 00 xorl \$0x1234,\(%rax\) diff --git a/gas/testsuite/gas/i386/noreg64.l b/gas/testsuite/gas/i386/noreg64.l index 29dfe62..c4e8b05 100644 --- a/gas/testsuite/gas/i386/noreg64.l +++ b/gas/testsuite/gas/i386/noreg64.l @@ -23,8 +23,6 @@ .*:[1-9][0-9]*: Warning: .* `cmps' .*:[1-9][0-9]*: Warning: .* `crc32' .*:[1-9][0-9]*: Warning: .* `crc32' -.*:[1-9][0-9]*: Warning: .* `cvtsi2sd' -.*:[1-9][0-9]*: Warning: .* `cvtsi2ss' .*:[1-9][0-9]*: Warning: .* `dec' .*:[1-9][0-9]*: Warning: .* `div' .*:[1-9][0-9]*: Warning: .* `fadd' @@ -128,12 +126,6 @@ .*:[1-9][0-9]*: Warning: .* `test' .*:[1-9][0-9]*: Warning: .* `test' .*:[1-9][0-9]*: Warning: .* `test' -.*:[1-9][0-9]*: Warning: .* `vcvtsi2sd' -.*:[1-9][0-9]*: Warning: .* `vcvtsi2sd' -.*:[1-9][0-9]*: Warning: .* `vcvtsi2ss' -.*:[1-9][0-9]*: Warning: .* `vcvtsi2ss' -.*:[1-9][0-9]*: Warning: .* `vcvtusi2sd' -.*:[1-9][0-9]*: Warning: .* `vcvtusi2ss' .*:[1-9][0-9]*: Warning: .* `xor' .*:[1-9][0-9]*: Warning: .* `xor' .*:[1-9][0-9]*: Warning: .* `xor' diff --git a/gas/testsuite/gas/i386/noreg64.s b/gas/testsuite/gas/i386/noreg64.s index ab0b558..1ccb8fd 100644 --- a/gas/testsuite/gas/i386/noreg64.s +++ b/gas/testsuite/gas/i386/noreg64.s @@ -25,8 +25,6 @@ noreg: cmps %es:(%rdi), (%rsi) crc32 (%rax), %eax crc32 (%rax), %rax - cvtsi2sd (%rax), %xmm0 - cvtsi2ss (%rax), %xmm0 dec (%rax) div (%rax) fadd (%rax) @@ -148,12 +146,6 @@ noreg: test $0x89, (%rax) test $0x1234, (%rax) test $0x12345678, (%rax) - vcvtsi2sd (%rax), %xmm0, %xmm0 - vcvtsi2sd (%rax), %xmm0, %xmm31 - vcvtsi2ss (%rax), %xmm0, %xmm0 - vcvtsi2ss (%rax), %xmm0, %xmm31 - vcvtusi2sd (%rax), %xmm0, %xmm0 - vcvtusi2ss (%rax), %xmm0, %xmm0 xor $1, (%rax) xor $0x89, (%rax) xor $0x1234, (%rax) diff --git a/gas/testsuite/gas/i386/x86-64-default-suffix-avx.d b/gas/testsuite/gas/i386/x86-64-default-suffix-avx.d new file mode 100644 index 0000000..c7a8aff --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-default-suffix-avx.d @@ -0,0 +1,19 @@ +#source: x86-64-default-suffix.s +#as: -msse2avx +#objdump: -dw +#name: x86-64 default suffix (AT&T mode) + +.*: +file format .* + +Disassembly of section .text: + +0+ : + +[a-f0-9]+: c5 fb 2a 00 vcvtsi2sdl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: c5 fa 2a 00 vcvtsi2ssl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: c5 fb 2a 00 vcvtsi2sdl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 61 7f 08 2a 38 vcvtsi2sdl \(%rax\),%xmm0,%xmm31 + +[a-f0-9]+: c5 fa 2a 00 vcvtsi2ssl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 61 7e 08 2a 38 vcvtsi2ssl \(%rax\),%xmm0,%xmm31 + +[a-f0-9]+: 62 f1 7f 08 7b 00 vcvtusi2sdl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 f1 7e 08 7b 00 vcvtusi2ssl \(%rax\),%xmm0,%xmm0 +#pass diff --git a/gas/testsuite/gas/i386/x86-64-default-suffix.d b/gas/testsuite/gas/i386/x86-64-default-suffix.d new file mode 100644 index 0000000..8258dad --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-default-suffix.d @@ -0,0 +1,17 @@ +#objdump: -dw +#name: x86-64 default suffix (AT&T mode) + +.*: +file format .* + +Disassembly of section .text: + +0+ : + +[a-f0-9]+: f2 0f 2a 00 cvtsi2sdl \(%rax\),%xmm0 + +[a-f0-9]+: f3 0f 2a 00 cvtsi2ssl \(%rax\),%xmm0 + +[a-f0-9]+: c5 fb 2a 00 vcvtsi2sdl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 61 7f 08 2a 38 vcvtsi2sdl \(%rax\),%xmm0,%xmm31 + +[a-f0-9]+: c5 fa 2a 00 vcvtsi2ssl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 61 7e 08 2a 38 vcvtsi2ssl \(%rax\),%xmm0,%xmm31 + +[a-f0-9]+: 62 f1 7f 08 7b 00 vcvtusi2sdl \(%rax\),%xmm0,%xmm0 + +[a-f0-9]+: 62 f1 7e 08 7b 00 vcvtusi2ssl \(%rax\),%xmm0,%xmm0 +#pass diff --git a/gas/testsuite/gas/i386/x86-64-default-suffix.s b/gas/testsuite/gas/i386/x86-64-default-suffix.s new file mode 100644 index 0000000..c949748 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-default-suffix.s @@ -0,0 +1,10 @@ + .text +foo: + cvtsi2sd (%rax), %xmm0 + cvtsi2ss (%rax), %xmm0 + vcvtsi2sd (%rax), %xmm0, %xmm0 + vcvtsi2sd (%rax), %xmm0, %xmm31 + vcvtsi2ss (%rax), %xmm0, %xmm0 + vcvtsi2ss (%rax), %xmm0, %xmm31 + vcvtusi2sd (%rax), %xmm0, %xmm0 + vcvtusi2ss (%rax), %xmm0, %xmm0 -- cgit v1.1