This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: pmovmskb bug in gas
- To: hjl at lucon dot org
- Subject: Re: pmovmskb bug in gas
- From: Phil Karn <karn at ka9q dot net>
- Date: Thu, 3 May 2001 21:48:59 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <200105031932.f43JWTN30450@homer.ka9q.net> <20010503211653.A20146@lucon.org>
- Reply-to: karn at ka9q dot net
>How do you know for sure the Intel documentation is wrong? Could
>someone please verify it with the Intel's ia32 assembler?
Well, I verified it by the actual behavior of the Pentium-III and
Pentium 4 on that instruction. I wrote a program (a Viterbi decoder)
that used pmovmskb and it crashed when it overwrote the stack pointer
instead of my intended register. I used gdb and single instruction stepping
to confirm that this was indeed the instruction that smashed %esp.
I looked at the object code and realized that the two 3-bit register
fields were somehow swapped in both the Intel documentation and
gas. I've worked around the problem by replacing the mnemonic with a
.byte directive with the correct opcode and arguments, and my program
now works fine.
I've verified that the error applies to both the 64 bit (mmx) and
128-bit (xmm) versions of the instruction, the latter being
implemented only on the Pentium 4 with SSE2. The 128-bit encoding is
the same as the 64-bit version except for a prefix byte of 0x66.
I went looking on the Intel website for some mention of this error but
didn't find any. I guess I need to write it up for them as
well. Lately I've been finding lots of little annoying errors in
Intel's manuals.
I'd be happy to send my program source if you're interested.
Phil