Bug 304867 - implement MOVBE instruction in x86 mode
Summary: implement MOVBE instruction in x86 mode
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-09 16:31 UTC by Ambroz Bizjak
Modified: 2012-08-23 23:44 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
add movbe in x86 (3.62 KB, patch)
2012-08-09 16:31 UTC, Ambroz Bizjak
Details
test code (888 bytes, text/x-csrc)
2012-08-09 16:32 UTC, Ambroz Bizjak
Details
movbe regression test (4.21 KB, patch)
2012-08-09 17:52 UTC, Ambroz Bizjak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ambroz Bizjak 2012-08-09 16:31:01 UTC
Created attachment 73066 [details]
add movbe in x86

The MOVBE instruction is currently implemented in Valgrind only for amd64, but it is also available in x86 mode in Atom processors. The attached patch implements this. It also changes the BSWAP implementation to use the added math_BSWAP() function. The code is based on the MOVBE implementation for amd64.

I've tested both forms of the instruction with the attached C code containing inline asm. Since I don't know either Valgrind or x86 assembly much, it would make sense to check the code for obvious errors.
Comment 1 Ambroz Bizjak 2012-08-09 16:32:23 UTC
Created attachment 73067 [details]
test code

This code with inline assembly reads an integer from command line and reverses it using both forms of the movbe instruction (4-byte only).
Comment 2 Ambroz Bizjak 2012-08-09 17:52:48 UTC
Created attachment 73069 [details]
movbe regression test

Regression test. Expected output was produced natively on an Atom CPU.
Comment 3 Julian Seward 2012-08-23 23:44:14 UTC
Committed, r2480, r12889.  Thanks for the patches.