This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pmovmskb bug in gas


>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]