Bug 372195

Summary: Power PC, xxsel instruction is not always recognized.
Product: [Developer tools] valgrind Reporter: Carl Love <cel>
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.12 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

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.