https://bugs.kde.org/show_bug.cgi?id=359472

--- Comment #1 from Carl Love <c...@us.ibm.com> ---
Created attachment 97252
  --> https://bugs.kde.org/attachment.cgi?id=97252&action=edit
Fix for the  vsubuqm, vaddcuq, vadduqm, vsubcuq, vaddecuq, vaddeuqm, vsubecuq,
vsubeuqm instructions

The Power PC instruction vsubuqm is emulated by the function 

static IRTemp _get_quad_modulo_or_carry(IRExpr * vecA, IRExpr * vecB,
                                        IRExpr * cin, Bool modulo)

The function is also used to implement the vaddcuq, vadduqm, vsubcuq, vaddecuq,
vaddeuqm, vsubecuq, vsubeuqm instructions.  Basically what the vsubuqm,
vadduqm,  vaddeuqm,  vsubeuqm instructions do calculate the lower 128 bits of
the add/subtract of two 128-bit integer add or subtract.  The other
instructions calculate the carry out of the add or subtract operation.  These
instructions can be used to do infinite precision arithmetic.  The function
returns either the lower 128-bit result or the carry out.  

The function does the add or subtract in 32-bit chunks propagating the carry to
the next higher chunk.  The carry is not correctly generated.  It is only
checking the result is less then one of the two inputs.

The testsuite doesn't have input values to properly test for this issue.

The first attached patch is a patch to VEX/priv/guest_ppc_toIR.c to fix the
implementation of the function.  The second patch adds data values to the test
for the instructions to cover the bug.  The new data values were validated to
find the issue in the eight instructions and the VEX patch fixes them all.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to