Hello,

I have a more-than-passing interest in getting isel instruction
support for the e500 spec implemented.  I have taken several days and
worked out what I believe is a valid implementation according to what
I understand of the e500 instruction set, and what I have learned
about valgrind.

The code works find for my simple test programs that include an isel
instruction, but fails on anything more complex.

The failure is a segfault shortly after processing of an isel
instruction (typically, several other isel instructions have
successfully executed before the failure).  I am assuming that the
changes I made have somehow resulted in the isel instruction no longer
performing correctly.

If any of you have the time, could you take a look at my code snippet
and see if I have made a significant error somewhere?

      /* isel : if crB then rD = rA else rD = rB
       * 011111 DDDDD AAAAA BBBBB CCCCC 011110
       *         rD     rA    rB    crb
       *        21-25 16-20 11-15  6-10  0-5
       *
       */
static Bool dis_int_isel ( UInt theInstr )
{
   UChar rD_addr = ifieldRegDS(theInstr);
   UChar rA_addr = ifieldRegA(theInstr);
   UChar rB_addr = ifieldRegB(theInstr);
   UChar cr_bit = ifieldRegC(theInstr);

   IRType ty     = mode64 ? Ity_I64 : Ity_I32;
   IRTemp rD     = newTemp(ty);
   IRTemp rA     = newTemp(ty);
   IRTemp rB     = newTemp(ty);
   IRTemp cr     = newTemp(ty);
   IRTemp cc_bitset     = newTemp(ty);

   vex_printf("handling isel, rD %d rA %d rB %d crb %d\n", rD_addr,
rA_addr, rB_addr, cr_bit);

   DIP("isel. r%u,r%u,r%u,crb%u\n", rD_addr, rA_addr, rB_addr, cr_bit);

   assign( rA, getIReg(rA_addr) );
   assign( rB, getIReg(rB_addr) );
   assign( cr, getCRbit(cr_bit) );

   assign( cc_bitset, binop(Iop_And32, mkexpr(cr), mkU32(1)));

   assign( rD, IRExpr_Mux0X(
               unop(Iop_1Uto8,
                   binop(Iop_CmpEQ32,
                       mkexpr(cc_bitset),
                       mkU32(0))),
               mkexpr(rA),
               mkexpr(rB)));
   return True;
}

Much appreciated,

Aaron

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to