Bug 449483

Summary: Powerpc: vcmpgtsq., vcmpgtuq,, vcmpequq. instructions not setting the condition code correctly
Product: [Developer tools] valgrind Reporter: Carl Love <cel>
Component: vexAssignee: Julian Seward <jseward>
Status: CLOSED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Powerpc test fixes, updated expected results
Powerpc VEX fix for vcmpgtsq., vcmpgtuq,, vcmpequq. opcode calculation

Description Carl Love 2022-02-02 00:43:14 UTC
The test_isa_3_1_VRT.c test issues the wrong instruction for the test of the  vcmpgtsq., vcmpgtuq,, vcmpequq. instructions.  The non-dotted instructions are issued.   The non-dotted instructions do not set the condition code field.  

Once the tests were fixed, it exposed an issue in the VEX support where the calculation of the condition code for the three dotted instructions was not correct.
Comment 1 Carl Love 2022-02-02 00:45:32 UTC
Created attachment 146154 [details]
Powerpc test fixes, updated expected results

The patch fixes the missing dot in the instruction opcodes.  The expected results file is also updated.
Comment 2 Carl Love 2022-02-02 00:47:23 UTC
Created attachment 146155 [details]
Powerpc VEX fix for  vcmpgtsq., vcmpgtuq,, vcmpequq. opcode calculation

The patch fixes the calculation for the condition code for the three instructions.
Comment 3 Carl Love 2022-02-02 01:23:50 UTC
Patches committed to Valgrind mainline.

commit ab740a1741322b6d0a02ea00499c2497e35e7022 (HEAD -> master, origin/master, origin/HEAD)
Author: Carl Love <cel@us.ibm.com>
Date:   Tue Feb 1 21:22:37 2022 +0000

    Powerpc test_isa_3_1_VRT fix
    
    The vcmpequq, vcmpgtsq, vcmpgtuq test cases for the dotted versions of the
    instructions were issuing the non-dotted instruction.
    
    This patch fixes the issues and updates the expected output.
    
    Note, the issue exposed a bug in the VEX/priv/guest_ppc_toIR.c handling of
    the instructions.  That fix is in a separate patch.

commit 27fc72dfb185733fed3dfd974ad2e7c5476852f6
Author: Carl Love <cel@us.ibm.com>
Date:   Tue Feb 1 21:29:30 2022 +0000

    Fix setting condition code for Vector Compare quad word instructions.
    
    The vcmpgtsq., vcmpgtuq,, vcmpequq. instructions set the condition code field
    6 to 0b1000 for true, 0b0010 for false.  The condition code was being set
    according to the typical condition code values for equal and greater than
    which is incorrect for these instructions.  The patch fixes the setting of the
    condition code as specified in the instructions.
Comment 4 Carl Love 2022-02-02 01:24:06 UTC
closing