Bug 372195 - Power PC, xxsel instruction is not always recognized.
Summary: Power PC, xxsel instruction is not always recognized.
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.12 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-07 19:46 UTC by Carl Love
Modified: 2016-11-07 20: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 Carl Love 2016-11-07 19:46:54 UTC
POWER PC does not always recognize the xxsel instruction.  The following code to test the xxsel instruction fails on an error that the xxsel instruction isn't recognized.  However, the xxsel instruction in 
none/tests/ppc64/test_isa_2_06_part2.c  is recognized.

int main()
{
        asm ("xxsel   62,63,44,1");
/*
        asm ("xxsel   1,39,9,1");
        asm ("xxsel   12,47,48,1");
        asm ("xxsel   33,50,43,1");
*/

	return 0;
}
Comment 1 Carl Love 2016-11-07 19:59:10 UTC
The issue is the opc2 field is used by the xxsel instruction to specify an additional operand.  That leaves a subset of the opc2 field for the actual opcode.  The function get_VSX60_opc2(UInt opc2_full) in VEX/priv/guest_ppc_toIR.c is used to determine the instruction in opc2 field for instructions that have an opc1 field of 0x60.  The 10-bit opc2 field is masked to get the actual opcode.  There are several different masks that are used for the various forms.  The issue is that a match was being made on the xxsel instruction depending on the value of the additional opcode.  The function was updated to fix the issue.
Comment 2 Carl Love 2016-11-07 20:03:26 UTC
Patch committed 

VEX commit 3284   Functional change
VEX commit 3285   Tweeked the comments so I could fix the Bugzilla number listed
                  in the commit log.

Valgrind commit 16119,  Update the NEWS file.