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

--- Comment #10 from Julian Seward <jsew...@acm.org> ---
(In reply to Will Schmidt from comment #9)
> > (2) If (1) isn't the case, and instead, the test program produces different
> >     results when run directly vs when run on V, then V is buggy.
> 
> ^ this one (option 2).  :-)

Ok, thanks for the clarification.  In that case, the patch looks OK, except
for the fact that it duplicates the entire subtree for calculation of the 
first 32 bits of the result.  That will cause the tree to be evaluated twice,
unless you get lucky and the IR optimiser removes the duplication.  But 
that usually doesn't happen, since CSE is expensive and is only used in
specific situations.

Please can you fix this by binding the duplicated subtrees to a new IRTemp
and instead use the IRTemps twice?  Here's an example for case 0x212
(xscvdpsp);
the other cases should be obvious:

case 0x212: // xscvdpsp (VSX Scalar round Double-Precision to single-precision
and
            //           Convert to Single-Precision format
            // Apr 2019 update - write the result to both halves of the
            // target VSR.  (see bug 401827,401828).
   DIP("xscvdpsp v%u,v%u\n", XT, XB);
   IRTemp resultI32 = newTemp(Ity_I32);
   assign(resultI32, unop( Iop_ReinterpF32asI32,
                                 unop( Iop_TruncF64asF32,
                                       binop( Iop_RoundF64toF32,
                                              get_IR_roundingmode(),
                                              mkexpr( xB ) ) ) );
   putVSReg( XT,
             binop( Iop_64HLtoV128,
                    binop( Iop_32HLto64, mkexpr(resultI32),
                                         mkexpr(resultI32) ),
                    mkU64( 0ULL ) ) );
   break;

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

Reply via email to