Bug 282910 - Unhandled instruction 0x66 0x0F 0x38 0x21 [PMOVSXBD]
Summary: Unhandled instruction 0x66 0x0F 0x38 0x21 [PMOVSXBD]
Status: RESOLVED INTENTIONAL
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.7 SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-27 14:37 UTC by kr.stokke
Modified: 2011-09-27 15:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kr.stokke 2011-09-27 14:37:08 UTC
Version:           3.7 SVN
OS:                Linux

Our project team has been optimizing MJPEG encoding using SIMD instructions. However, Valgrind doesn't seem to support all the SSE 4.x instructions. We've experienced two error cases:

-> Unhandled instruction 0x66 0x0F 0x38 0x21
This is the opcode for the pmovsxbd. Operating on XMM registers, it unpacks four signed bytes to four signed integers. We could not find a bug report for this instruction.

-> Unhandled instruction 0x66 0x0F 0x3A 0x22
This opcode references pinsrd, moving data from GPRs to XMM registers. This error has been referenced in another bug ticket in the system.


Reproducible: Always

Steps to Reproduce:
In order to reproduce this problem, it is sufficient to create some assembly function with pinsrd and movsxbd:

   	pmovsxbd %XMM0, %XMM0
   	pmovsxbd %XMM1, %XMM1

        pinsrd $0, %ecx, %XMM5


Expected Results:  
Valgrind should emulate the troubled instructions correctly instead of crashing on encounter with them.
Comment 1 Julian Seward 2011-09-27 14:44:15 UTC
In 32-bit mode (which is what you appear to be using), Valgrind only
supports up to SSSE3 instructions.  Your software should query its
capabilities using CPUID before trying to issue instructions that its
CPUID does not claim are supported.

In 64-bit mode though there is almost complete support for SSE4.2, including
the two instructions you mention.  If you can use 64 bit mode you should
be able to run your code.
Comment 2 kr.stokke 2011-09-27 14:52:02 UTC
Thank you for your quick response. This was valuable information for us! Do you still consider this a bug, or more of a feature request? (True, we are working on SIMD in 32 bit code, but it's still running perfectly outside of Valgrind..)
Comment 3 Julian Seward 2011-09-27 15:00:22 UTC
Well, making SSE4.1 and 4.2 work for 64-bit was quite a lot of work.
I (personally) regard 32-bit x86 as more or less "legacy" and did not
really want to spend the effort to make 4.1/4.2 work there.  Really
the next round of SIMD support hacking will be to make AVX work on
64-bit, so realistically the prospect of anything beyond SSSE3 working
for 32-bit is pretty small.

IOW .. just use 64-bit.

If you find any bugs in the 64-bit SSE4.1/4.2 support please let me
know.  I think it's pretty reliable, but one never really knows.
Comment 4 kr.stokke 2011-09-27 15:03:01 UTC
Closed then.