This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bug in operands to IA32 cvtps2dq instruction in gnu as
- To: Phil Karn <karn at ka9q dot net>
- Subject: Re: Bug in operands to IA32 cvtps2dq instruction in gnu as
- From: amodra at one dot net dot au
- Date: Sat, 12 May 2001 19:22:48 +0930
- Cc: hjl at lucon dot org, binutils at sourceware dot cygnus dot com
- References: <200105120055.f4C0t2T26156@homer.ka9q.net>
On Fri, May 11, 2001 at 05:55:02PM -0700, Phil Karn wrote:
> The operand table for this instruction probably needs fixing.
Indeed. Looks to me that movdq2q and movq2dq are wrong too.
include/opcode/ChangeLog
* i386.h (i386_optab): Second operand of cvtps2dq is an xmm reg,
not an mmx reg. Swap xmm/mmx regs on both movdq2q and movq2dq,
and use InvMem as these insns must have register operands.
opcodes/ChangeLog
* i386-dis.c (prefix_user_table): Correct movq2dq, movdq2q, and
movq operands.
gas/testsuite/ChangeLog
* gas/i386/sse2.s: Correct cvtps2dq, movdq2q, and movq2dq
* gas/i386/sse2.d: Likewise. Fix pmuludq too.
* gas/i386/ssemmx2.d: Correct movq.
--
Alan Modra
Index: include/opcode/i386.h
===================================================================
RCS file: /cvs/src/src/include/opcode/i386.h,v
retrieving revision 1.32
diff -u -p -r1.32 i386.h
--- i386.h 2001/05/04 11:10:53 1.32
+++ i386.h 2001/05/12 09:44:06
@@ -1254,7 +1254,7 @@ static const template i386_optab[] = {
{"cvtpd2pi", 2, 0x660f2d, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegMMX, 0 } },
{"cvtpd2ps", 2, 0x660f5a, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
{"cvtps2pd", 2, 0x0f5a, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
-{"cvtps2dq", 2, 0x660f5b, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegMMX, 0 } },
+{"cvtps2dq", 2, 0x660f5b, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
{"cvtsd2si", 2, 0xf20f2d, X, CpuSSE2, lq_Suf|IgnoreSize|Modrm,{ RegXMM|LLongMem, Reg32|Reg64, 0 } },
{"cvtsd2ss", 2, 0xf20f5a, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
{"cvtss2sd", 2, 0xf30f5a, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
@@ -1267,8 +1267,8 @@ static const template i386_optab[] = {
{"movdqa", 2, 0x660f7f, X, CpuSSE2, FP|Modrm, { RegXMM, RegXMM|LLongMem, 0 } },
{"movdqu", 2, 0xf30f6f, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegXMM, 0 } },
{"movdqu", 2, 0xf30f7f, X, CpuSSE2, FP|Modrm, { RegXMM, RegXMM|LLongMem, 0 } },
-{"movdq2q", 2, 0xf20fd6, X, CpuSSE2, FP|Modrm, { RegMMX|LLongMem, RegXMM, 0 } },
-{"movq2dq", 2, 0xf30fd6, X, CpuSSE2, FP|Modrm, { RegXMM|LLongMem, RegMMX, 0 } },
+{"movdq2q", 2, 0xf20fd6, X, CpuSSE2, FP|Modrm, { RegXMM|InvMem, RegMMX, 0 } },
+{"movq2dq", 2, 0xf30fd6, X, CpuSSE2, FP|Modrm, { RegMMX|InvMem, RegXMM, 0 } },
{"pmuludq", 2, 0x0ff4, X, CpuSSE2, FP|Modrm, { RegMMX|LongMem, RegMMX, 0 } },
{"pmuludq", 2, 0x660ff4, X, CpuSSE2, FP|Modrm, { RegXMM|LongMem, RegXMM, 0 } },
{"pshufd", 3, 0x660f70, X, CpuSSE2, FP|Modrm, { Imm8, RegXMM|LLongMem, RegXMM } },
Index: opcodes/i386-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-dis.c,v
retrieving revision 1.20
diff -u -p -r1.20 i386-dis.c
--- i386-dis.c 2001/05/04 11:10:54 1.20
+++ i386-dis.c 2001/05/12 09:43:35
@@ -2716,9 +2716,9 @@ static const struct dis386 prefix_user_t
/* PREGRP21 */
{
{ "(bad)", EX, XM, XX },
- { "movq2dq", EX, EM, XX },
+ { "movq2dq", XM, MS, XX },
{ "movq", EX, XM, XX },
- { "movdq2q", EM, MX, XX },
+ { "movdq2q", MX, XS, XX },
},
/* PREGRP22 */
{
@@ -2730,7 +2730,7 @@ static const struct dis386 prefix_user_t
/* PREGRP23 */
{
{ "movd", Ed, MX, XX },
- { "movq", Ed, XM, XX },
+ { "movq", XM, EX, XX },
{ "movd", Ed, XM, XX },
{ "(bad)", Ed, XM, XX },
},
Index: gas/testsuite/gas/i386/sse2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/sse2.d,v
retrieving revision 1.3
diff -u -p -r1.3 sse2.d
--- sse2.d 2001/05/04 11:10:55 1.3
+++ sse2.d 2001/05/12 09:44:07
@@ -143,9 +143,9 @@ Disassembly of section .text:
245: 66 0f 6f c8[ ]+movdqa %xmm0,%xmm1
249: f3 0f 6f c8[ ]+movdqu %xmm0,%xmm1
24d: f3 0f 6f c8[ ]+movdqu %xmm0,%xmm1
- 251: f2 0f d6 c8[ ]+movdq2q %mm1,%mm0
- 255: f3 0f d6 c8 66[ ]+movq2dq %mm0,%xmm0
- 25a: 0f f4 c8[ ]+pmuludq %mm0,%mm1
+ 251: f2 0f d6 c8[ ]+movdq2q %xmm0,%mm1
+ 255: f3 0f d6 c8[ ]+movq2dq %mm0,%xmm1
+ 25a: 66 0f f4 c8[ ]+pmuludq %xmm0,%xmm1
25d: 66 0f f4 c8[ ]+pmuludq %xmm0,%xmm1
261: 66 0f 70 c8 01[ ]+pshufd \$0x1,%xmm0,%xmm1
266: f3 0f 70 c8 01[ ]+pshufhw \$0x1,%xmm0,%xmm1
Index: gas/testsuite/gas/i386/sse2.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/sse2.s,v
retrieving revision 1.2
diff -u -p -r1.2 sse2.s
--- sse2.s 2001/01/12 03:34:49 1.2
+++ sse2.s 2001/05/12 09:44:07
@@ -125,7 +125,7 @@ foo:
cvtdq2ps %xmm0, %xmm1
cvtpd2ps %xmm0, %xmm1
cvtps2pd %xmm0, %xmm1
- cvtps2dq %xmm0, %mm1
+ cvtps2dq %xmm0, %xmm1
cvtsd2ss %xmm0, %xmm1
cvtss2sd %xmm0, %xmm1
cvttpd2dq %xmm0, %xmm1
@@ -135,8 +135,8 @@ foo:
movdqa %xmm0, %xmm1
movdqu %xmm0, %xmm1
movdqu %xmm0, %xmm1
- movdq2q %mm0, %xmm1
- movq2dq %xmm0, %mm1
+ movdq2q %xmm0, %mm1
+ movq2dq %mm0, %xmm1
pmuludq %xmm0, %xmm1
pmuludq %xmm0, %xmm1
pshufd $1, %xmm0, %xmm1
Index: gas/testsuite/gas/i386/ssemmx2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/ssemmx2.d,v
retrieving revision 1.4
diff -u -p -r1.4 ssemmx2.d
--- ssemmx2.d 2001/05/04 11:10:55 1.4
+++ ssemmx2.d 2001/05/12 09:44:07
@@ -47,7 +47,7 @@ Disassembly of section .text:
[ ]+ca: 66 0f 6a 90 90 90 90 90 punpckhdq 0x90909090\(%eax\),%xmm2
[ ]+d2: 66 0f 6b 90 90 90 90 90 packssdw 0x90909090\(%eax\),%xmm2
[ ]+da: 66 0f 6e 90 90 90 90 90 movd[ ]+0x90909090\(%eax\),%xmm2
-[ ]+e2: f3 0f 7e 90 90 90 90 90 movq[ ]+%xmm2,0x90909090\(%eax\)
+[ ]+e2: f3 0f 7e 90 90 90 90 90 movq[ ]+0x90909090\(%eax\),%xmm2
[ ]+ea: 66 0f 71 d0 90[ ]+psrlw[ ]+\$0x90,%xmm0
[ ]+ef: 66 0f 72 d0 90[ ]+psrld[ ]+\$0x90,%xmm0
[ ]+f4: 66 0f 73 d0 90[ ]+psrlq[ ]+\$0x90,%xmm0