[kaffe] More mipsel jit3

Casey Marshall rsdio at metastatic.org
Mon Mar 8 13:36:10 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've gone ahead and implemented translations for fcmpg, fcmpl, dcmpg,
and dcmpl using C.cond.fmt. This gets me further in loading Kaffe (now
System.checkPropertyAccess complains that "line.separator" is a
zero-length key). Unfortunately, I am also getting an improper gc_free
call, and thence a SIGSEGV, with jitBasic ControlFlowMethods.class.

Below is what I've added to jit3-mips.def, so people who understand
the instruction set better than I do can pick it apart. I'm assuming
that this instruction is specific to MIPS32, so while this doesn't
matter to me, it might matter to other people.

(The double versions are equivalent, but with `DOUBLE_FORMAT'.)

- ----------
#define BC              0x08
#define FC              0x03

#define finsn_comp(fmt, ft, fs, cc, cond)               \
        LOUT = 0x00000000 | ((COP1) << 26) |            \
        ((fmt) << 21) | ((ft) << 16) | ((fs) << 11) |   \
        (((cc) & 0x07) << 8) | (FC << 4) | ((cond) & 0x1F)

#define insn_bc1x(tv, offset)                           \
        LOUT = 0x00000000 | ((COP1) << 26) |            \
        ((BC) << 21) | (((tv) & 0x01) << 16) | ((offset) & MASKL16BITS)

#define COND_F          0x00
#define COND_UN         0x01
#define COND_EQ         0x02
#define COND_UEQ        0x03
#define COND_OLT        0x04
#define COND_ULT        0x05
#define COND_OLE        0x06
#define COND_ULE        0x07

define_insn(cmpl_float, float_cmpl_RRR)
{
        int fs = rreg_float(2);
        int ft = rreg_float(1);
        int w  = wreg_int(0);

        debug_name(("cmpl_float:\n"));

        debug(("        move    %s,0\n", regname(w)));
        debug(("        C.eq.S  %s,%s\n", fregname(ft),
        fregname(fs)));
        debug(("        bc1t    DONE\n"));
        debug(("        C.lt.S  %s,%s\n", fregname(ft),
        fregname(fs)));
        debug(("        bc1t    LT\n"));
        debug(("        move    %s,1", regname(w)));
        debug(("        b       DONE\n"));
        debug(("LT:\n"));
        debug(("        move    %s,-1", regname(w)));

        insn_RRR(_ADDU, w, REG_i0, REG_i0);
        finsn_comp(SINGLE_FORMAT, ft, fs, 0, COND_EQ);
        NOP();
        insn_bc1x(true, 40 /* DONE */);
        NOP();
        finsn_comp(SINGLE_FORMAT, ft, fs, 0, COND_OLT);
        NOP();
        insn_bc1x(true, 12 /* LT */);
        NOP();
        insn_RRC(_ADDIU, w, REG_i0, 1);
        insn_cbr(_BEQ, REG_i0, REG_i0, 12 /* DONE */);
/* LT: */
        NOP();
        insn_RRC(_LUI, 0, w, 0xFFFF);
        insn_RRC(_ORI, w, w, 0xFFFF);
/* DONE: */
}

define_insn(cmpg_float, float_cmpg_RRR)
{
        int fs = rreg_float(2);
        int ft = rreg_float(1);
        int w  = wreg_int(0);

        debug_name(("cmpg_float:\n"));

        debug(("        move    %s,0\n", regname(w)));
        debug(("        C.eq.S  %s,%s\n", fregname(ft),
        fregname(fs)));
        debug(("        bc1t    DONE\n"));
        debug(("        C.lt.S  %s,%s\n", fregname(ft),
        fregname(fs)));
        debug(("        bc1f    GT\n"));
        debug(("        move    %s,-1", regname(w)));
        debug(("        b       DONE\n"));
        debug(("GT:\n"));
        debug(("        move    %s,1", regname(w)));

        insn_RRR(_ADDU, w, REG_i0, REG_i0);
        finsn_comp(SINGLE_FORMAT, ft, fs, 0, COND_EQ);
        NOP();
        insn_bc1x(true, 40 /* DONE */);
        NOP();
        finsn_comp(SINGLE_FORMAT, ft, fs, 0, COND_OLT);
        NOP();
        insn_bc1x(false, 20 /* GT */);
        NOP();
        insn_RRC(_LUI, 0, w, 0xFFFF);
        insn_RRC(_ORI, w, w, 0xFFFF);
        insn_cbr(_BEQ, REG_i0, REG_i0, 8 /* DONE */);
/* GT: */
        NOP();
        insn_RRC(_ADDIU, w, REG_i0, 1);
/* DONE: */
}
- ----------

- -- 
Casey Marshall || rsdio at metastatic.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>

iD8DBQFATOa/gAuWMgRGsWsRAsz0AJsECRsgK9OJUtt9osxjPu8vtl/W7QCfY2CS
mVM1Ty+HISdzGHQU2hABdhY=
=nFgQ
-----END PGP SIGNATURE-----




More information about the kaffe mailing list