aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2019-06-25 09:25:26 +0200
committerJan Beulich <jbeulich@suse.com>2019-06-25 09:35:17 +0200
commite1a1babdad9d14b935cbddc7d63fb76a580a16c5 (patch)
tree39fda81013c155f1b0e5dc365b2f9394147b951b /gas
parentb8364fa775112f036a80e799b70311f69baac131 (diff)
downloadgdb-e1a1babdad9d14b935cbddc7d63fb76a580a16c5.zip
gdb-e1a1babdad9d14b935cbddc7d63fb76a580a16c5.tar.gz
gdb-e1a1babdad9d14b935cbddc7d63fb76a580a16c5.tar.bz2
x86: fix (dis)assembly of certain SSE2 insns in 16-bit mode
MOVNTI was wrongly assembled with a 66h prefix. Add IgnoreSize to address this. It and the scalar to/from integer conversion insns also were also wrongly using Ev / Gv, leading to 16-bit register names being printed when 32-bit ones were meant. Clone the 32-bit SSE2 test to cover both assembler and disassembler.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
-rw-r--r--gas/testsuite/gas/i386/sse2-16bit.d167
-rw-r--r--gas/testsuite/gas/i386/sse2-16bit.s7
4 files changed, 181 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 416c2be..2e12363 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2019-06-25 Jan Beulich <jbeulich@suse.com>
+ * testsuite/gas/i386/sse2-16bit.d,
+ testsuite/gas/i386/sse2-16bit.s: New.
+ testsuite/gas/i386/i386.exp: Run new test.
+
+2019-06-25 Jan Beulich <jbeulich@suse.com>
+
* config/tc-i386.c (optimize_encoding): Also handle ANDQ with
immediatie fitting in 7 bits.
* testsuite/gas/i386/x86-64-optimize-1.s: Add ANDQ cases with
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 5be713f..7043da7 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -73,6 +73,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "relax-2"
run_dump_test "ssemmx2"
run_dump_test "sse2"
+ run_dump_test "sse2-16bit"
run_dump_test "sub"
run_dump_test "sse3"
run_dump_test "sib"
diff --git a/gas/testsuite/gas/i386/sse2-16bit.d b/gas/testsuite/gas/i386/sse2-16bit.d
new file mode 100644
index 0000000..16ea55f
--- /dev/null
+++ b/gas/testsuite/gas/i386/sse2-16bit.d
@@ -0,0 +1,167 @@
+#as: -I${srcdir}/$subdir
+#objdump: -dwMaddr16 -Mdata16
+#name: i386 16-bit SSE2
+
+.*: file format .*
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ ]*[a-f0-9]+: 67 0f c3 00 movnti %eax,\(%eax\)
+[ ]*[a-f0-9]+: 0f ae f8 sfence
+[ ]*[a-f0-9]+: 0f ae e8 lfence
+[ ]*[a-f0-9]+: 0f ae f0 mfence
+[ ]*[a-f0-9]+: 67 66 0f 58 01 addpd \(%ecx\),%xmm0
+[ ]*[a-f0-9]+: 66 0f 58 ca addpd %xmm2,%xmm1
+[ ]*[a-f0-9]+: 67 f2 0f 58 13 addsd \(%ebx\),%xmm2
+[ ]*[a-f0-9]+: f2 0f 58 dc addsd %xmm4,%xmm3
+[ ]*[a-f0-9]+: 67 66 0f 55 65 00 andnpd 0x0\(%ebp\),%xmm4
+[ ]*[a-f0-9]+: 66 0f 55 ee andnpd %xmm6,%xmm5
+[ ]*[a-f0-9]+: 67 66 0f 54 37 andpd \(%edi\),%xmm6
+[ ]*[a-f0-9]+: 66 0f 54 f8 andpd %xmm0,%xmm7
+[ ]*[a-f0-9]+: 66 0f c2 c1 02 cmplepd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f c2 0a 03 cmpunordpd \(%edx\),%xmm1
+[ ]*[a-f0-9]+: f2 0f c2 d2 04 cmpneqsd %xmm2,%xmm2
+[ ]*[a-f0-9]+: 67 f2 0f c2 1c 24 05 cmpnltsd \(%esp\),%xmm3
+[ ]*[a-f0-9]+: 66 0f c2 e5 06 cmpnlepd %xmm5,%xmm4
+[ ]*[a-f0-9]+: 67 66 0f c2 2e 07 cmpordpd \(%esi\),%xmm5
+[ ]*[a-f0-9]+: f2 0f c2 f7 00 cmpeqsd %xmm7,%xmm6
+[ ]*[a-f0-9]+: 67 f2 0f c2 38 01 cmpltsd \(%eax\),%xmm7
+[ ]*[a-f0-9]+: 66 0f c2 c1 00 cmpeqpd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f c2 0a 00 cmpeqpd \(%edx\),%xmm1
+[ ]*[a-f0-9]+: f2 0f c2 d2 00 cmpeqsd %xmm2,%xmm2
+[ ]*[a-f0-9]+: 67 f2 0f c2 1c 24 00 cmpeqsd \(%esp\),%xmm3
+[ ]*[a-f0-9]+: 66 0f c2 e5 01 cmpltpd %xmm5,%xmm4
+[ ]*[a-f0-9]+: 67 66 0f c2 2e 01 cmpltpd \(%esi\),%xmm5
+[ ]*[a-f0-9]+: f2 0f c2 f7 01 cmpltsd %xmm7,%xmm6
+[ ]*[a-f0-9]+: 67 f2 0f c2 38 01 cmpltsd \(%eax\),%xmm7
+[ ]*[a-f0-9]+: 67 66 0f c2 01 02 cmplepd \(%ecx\),%xmm0
+[ ]*[a-f0-9]+: 66 0f c2 ca 02 cmplepd %xmm2,%xmm1
+[ ]*[a-f0-9]+: 67 f2 0f c2 13 02 cmplesd \(%ebx\),%xmm2
+[ ]*[a-f0-9]+: f2 0f c2 dc 02 cmplesd %xmm4,%xmm3
+[ ]*[a-f0-9]+: 67 66 0f c2 65 00 03 cmpunordpd 0x0\(%ebp\),%xmm4
+[ ]*[a-f0-9]+: 66 0f c2 ee 03 cmpunordpd %xmm6,%xmm5
+[ ]*[a-f0-9]+: 67 f2 0f c2 37 03 cmpunordsd \(%edi\),%xmm6
+[ ]*[a-f0-9]+: f2 0f c2 f8 03 cmpunordsd %xmm0,%xmm7
+[ ]*[a-f0-9]+: 66 0f c2 c1 04 cmpneqpd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f c2 0a 04 cmpneqpd \(%edx\),%xmm1
+[ ]*[a-f0-9]+: f2 0f c2 d2 04 cmpneqsd %xmm2,%xmm2
+[ ]*[a-f0-9]+: 67 f2 0f c2 1c 24 04 cmpneqsd \(%esp\),%xmm3
+[ ]*[a-f0-9]+: 66 0f c2 e5 05 cmpnltpd %xmm5,%xmm4
+[ ]*[a-f0-9]+: 67 66 0f c2 2e 05 cmpnltpd \(%esi\),%xmm5
+[ ]*[a-f0-9]+: f2 0f c2 f7 05 cmpnltsd %xmm7,%xmm6
+[ ]*[a-f0-9]+: 67 f2 0f c2 38 05 cmpnltsd \(%eax\),%xmm7
+[ ]*[a-f0-9]+: 67 66 0f c2 01 06 cmpnlepd \(%ecx\),%xmm0
+[ ]*[a-f0-9]+: 66 0f c2 ca 06 cmpnlepd %xmm2,%xmm1
+[ ]*[a-f0-9]+: 67 f2 0f c2 13 06 cmpnlesd \(%ebx\),%xmm2
+[ ]*[a-f0-9]+: f2 0f c2 dc 06 cmpnlesd %xmm4,%xmm3
+[ ]*[a-f0-9]+: 67 66 0f c2 65 00 07 cmpordpd 0x0\(%ebp\),%xmm4
+[ ]*[a-f0-9]+: 66 0f c2 ee 07 cmpordpd %xmm6,%xmm5
+[ ]*[a-f0-9]+: 67 f2 0f c2 37 07 cmpordsd \(%edi\),%xmm6
+[ ]*[a-f0-9]+: f2 0f c2 f8 07 cmpordsd %xmm0,%xmm7
+[ ]*[a-f0-9]+: 66 0f 2f c1 comisd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f 2f 0a comisd \(%edx\),%xmm1
+[ ]*[a-f0-9]+: 66 0f 2a d3 cvtpi2pd %mm3,%xmm2
+[ ]*[a-f0-9]+: 67 66 0f 2a 1c 24 cvtpi2pd \(%esp\),%xmm3
+[ ]*[a-f0-9]+: f2 0f 2a e5 cv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0-9]+: f2 0f 5d f7 minsd %xmm7,%xmm6
+[ ]*[a-f0-9]+: 67 f2 0f 5d 38 minsd \(%eax\),%xmm7
+[ ]*[a-f0-9]+: 66 0f 28 c1 movapd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f 29 11 movapd %xmm2,\(%ecx\)
+[ ]*[a-f0-9]+: 67 66 0f 28 12 movapd \(%edx\),%xmm2
+[ ]*[a-f0-9]+: 67 66 0f 17 2c 24 movhpd %xmm5,\(%esp\)
+[ ]*[a-f0-9]+: 67 66 0f 16 2e movhpd \(%esi\),%xmm5
+[ ]*[a-f0-9]+: 67 66 0f 13 07 movlpd %xmm0,\(%edi\)
+[ ]*[a-f0-9]+: 67 66 0f 12 00 movlpd \(%eax\),%xmm0
+[ ]*[a-f0-9]+: 66 0f 50 ca movmskpd %xmm2,%ecx
+[ ]*[a-f0-9]+: 66 0f 10 d3 movupd %xmm3,%xmm2
+[ ]*[a-f0-9]+: 67 66 0f 11 22 movupd %xmm4,\(%edx\)
+[ ]*[a-f0-9]+: 67 66 0f 10 65 00 movupd 0x0\(%ebp\),%xmm4
+[ ]*[a-f0-9]+: f2 0f 10 ee movsd %xmm6,%xmm5
+[ ]*[a-f0-9]+: 67 f2 0f 11 3e movsd %xmm7,\(%esi\)
+[ ]*[a-f0-9]+: 67 f2 0f 10 38 movsd \(%eax\),%xmm7
+[ ]*[a-f0-9]+: 66 0f 59 c1 mulpd %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f 59 0a mulpd \(%edx\),%xmm1
+[ ]*[a-f0-9]+: f2 0f 59 d2 mulsd %xmm2,%xmm2
+[ ]*[a-f0-9]+: 67 f2 0f 59 1c 24 mulsd \(%esp\),%xmm3
+[ ]*[a-f0-9]+: 66 0f 56 e5 orpd %xmm5,%xmm4
+[ ]*[a-f0-9]+: 67 66 0f 56 2e orpd \(%esi\),%xmm5
+[ ]*[a-f0-9]+: 67 66 0f c6 37 02 shufpd \$0x2,\(%edi\),%xmm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d8 01 psrldq \$0x1,%xmm0
+[ ]*[a-f0-9]+: 66 0f 6d c8 punpckhqdq %xmm0,%xmm1
+[ ]*[a-f0-9]+: 0f d4 c1 paddq %mm1,%mm0
+[ ]*[a-f0-9]+: 67 0f d4 00 paddq \(%eax\),%mm0
+[ ]*[a-f0-9]+: 66 0f d4 c1 paddq %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f d4 00 paddq \(%eax\),%xmm0
+[ ]*[a-f0-9]+: 0f fb c1 psubq %mm1,%mm0
+[ ]*[a-f0-9]+: 67 0f fb 00 psubq \(%eax\),%mm0
+[ ]*[a-f0-9]+: 66 0f fb c1 psubq %xmm1,%xmm0
+[ ]*[a-f0-9]+: 67 66 0f fb 00 psubq \(%eax\),%xmm0
+[ ]*[a-f0-9]+: 0f 58 2f addps \(%bx\),%xmm5
+#pass
diff --git a/gas/testsuite/gas/i386/sse2-16bit.s b/gas/testsuite/gas/i386/sse2-16bit.s
new file mode 100644
index 0000000..ab9c323
--- /dev/null
+++ b/gas/testsuite/gas/i386/sse2-16bit.s
@@ -0,0 +1,7 @@
+# Check SSE2 instructions in 16-bit mode
+
+ .code16
+ .include "sse2.s"
+ .att_syntax prefix
+
+ addps (%bx),%xmm5