decoder.isa:

Added support for FP compare instructions. Somehow these flew beneath
my radar. Also, I start to use special FP utility functions in FP code.
Right now, they are defined in isa_traits.hh but may be moved in the
future

arch/mips/isa/decoder.isa:
    Added support for FP compare instructions. Somehow these flew beneath
    my radar. Also, I start to use special FP utility functions in FP code.
    Right now, they are defined in isa_traits.hh but may be moved in the
    future

--HG--
extra : convert_revision : 84a3b66882f3977ce9c1356cf466d62a7fd8bf19
This commit is contained in:
Korey Sewell 2006-05-09 14:39:45 -04:00
parent a4ed65d0fa
commit c01a43d302

View file

@ -514,37 +514,37 @@ decode OPCODE_HI default Unknown::unknown() {
0x1: decode FUNCTION_LO { 0x1: decode FUNCTION_LO {
format Float64Op { format Float64Op {
0x0: round_l_s({{ 0x0: round_l_s({{
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, RND_NEAREST); Fd.ud = fpConvert(roundFP(Fs.sf), SINGLE_TO_LONG);
}}); }});
0x1: trunc_l_s({{ 0x1: trunc_l_s({{
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, RND_ZERO); Fd.ud = fpConvert(truncFP(Fs.sf), SINGLE_TO_LONG);
}}); }});
0x2: ceil_l_s({{ 0x2: ceil_l_s({{
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, RND_UP); Fd.ud = fpConvert(ceil(Fs.sf), SINGLE_TO_LONG);
}}); }});
0x3: floor_l_s({{ 0x3: floor_l_s({{
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, RND_DOWN); Fd.ud = fpConvert(floor(Fs.sf), SINGLE_TO_LONG);
}}); }});
} }
format FloatOp { format FloatOp {
0x4: round_w_s({{ 0x4: round_w_s({{
Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, RND_NEAREST); Fd.uw = fpConvert(roundFP(Fs.sf), SINGLE_TO_WORD);
}}); }});
0x5: trunc_w_s({{ 0x5: trunc_w_s({{
Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, RND_ZERO); Fd.uw = fpConvert(truncFP(Fs.sf), SINGLE_TO_WORD);
}}); }});
0x6: ceil_w_s({{ 0x6: ceil_w_s({{
Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, RND_UP); Fd.uw = fpConvert(ceil(Fs.sf), SINGLE_TO_WORD);
}}); }});
0x7: floor_w_s({{ 0x7: floor_w_s({{
Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, RND_DOWN); Fd.uw = fpConvert(floor(Fs.sf), SINGLE_TO_WORD);
}}); }});
} }
} }
@ -552,19 +552,16 @@ decode OPCODE_HI default Unknown::unknown() {
0x2: decode FUNCTION_LO { 0x2: decode FUNCTION_LO {
0x1: decode MOVCF { 0x1: decode MOVCF {
format FloatOp { format FloatOp {
0x0: movfs({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }}); 0x0: movf_s({{if (FPConditionCode(CC) == 0) Fd = Fs;}});
0x1: movts({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}}); 0x1: movt_s({{if (FPConditionCode(CC) == 1) Fd = Fs;}});
} }
} }
format BasicOp { format FloatOp {
0x2: movzs({{ if (Rt == 0) Fd = Fs; }}); 0x2: movz_s({{ if (Rt == 0) Fd = Fs; }});
0x3: movns({{ if (Rt != 0) Fd = Fs; }}); 0x3: movn_s({{ if (Rt != 0) Fd = Fs; }});
} 0x5: recip_s({{ Fd = 1 / Fs; }});
0x6: rsqrt_s({{ Fd = 1 / sqrt(Fs);}});
format Float64Op {
0x5: recips({{ Fd = 1 / Fs; }});
0x6: rsqrts({{ Fd = 1 / sqrt((double)Fs.ud);}});
} }
} }
@ -572,21 +569,17 @@ decode OPCODE_HI default Unknown::unknown() {
format FloatOp { format FloatOp {
0x1: cvt_d_s({{ 0x1: cvt_d_s({{
int rnd_mode = xc->readMiscReg(FCSR) & 0x03; Fd.ud = fpConvert(Fs.sf, SINGLE_TO_DOUBLE);
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_DOUBLE, rnd_mode);
}}); }});
0x4: cvt_w_s({{ 0x4: cvt_w_s({{
int rnd_mode = xc->readMiscReg(FCSR) & 0x03; Fd.uw = fpConvert(Fs.sf, SINGLE_TO_WORD);
Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, rnd_mode);
}}); }});
} }
//only legal for 64 bit
format Float64Op { format Float64Op {
0x5: cvt_l_s({{ 0x5: cvt_l_s({{
int rnd_mode = xc->readMiscReg(FCSR) & 0x03; Fd.ud = fpConvert(Fs.sf, SINGLE_TO_LONG);
Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, rnd_mode);
}}); }});
0x6: cvt_ps_st({{ 0x6: cvt_ps_st({{
@ -594,6 +587,32 @@ decode OPCODE_HI default Unknown::unknown() {
}}); }});
} }
} }
0x6: decode FUNCTION_LO {
format FloatOp {
0x0: c_f_s({{ ; }});
0x1: c_un_s({{ ; }});
0x2: c_eq_s({{ ; }});
0x3: c_ueq_s({{ ; }});
0x4: c_olt_s({{ ; }});
0x5: c_ult_s({{ ; }});
0x6: c_ole_s({{ ; }});
0x7: c_ule_s({{ ; }});
}
}
0x7: decode FUNCTION_LO {
format FloatOp {
0x0: c_sf_s({{ ; }});
0x1: c_ngle_s({{ ; }});
0x2: c_seq_s({{ ; }});
0x3: c_ngl_s({{ ; }});
0x4: c_lt_s({{ ; }});
0x5: c_nge_s({{ ; }});
0x6: c_le_s({{ ; }});
0x7: c_ngt_s({{ ; }});
}
}
} }
//Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D //Table A-15 MIPS32 COP1 Encoding of Function Field When rs=D
@ -689,6 +708,32 @@ decode OPCODE_HI default Unknown::unknown() {
}}); }});
} }
} }
0x6: decode FUNCTION_LO {
format FloatOp {
0x0: c_f_d({{ ; }});
0x1: c_un_d({{ ; }});
0x2: c_eq_d({{ ; }});
0x3: c_ueq_d({{ ; }});
0x4: c_olt_d({{ ; }});
0x5: c_ult_d({{ ; }});
0x6: c_ole_d({{ ; }});
0x7: c_ule_d({{ ; }});
}
}
0x7: decode FUNCTION_LO {
format FloatOp {
0x0: c_sf_d({{ ; }});
0x1: c_ngle_d({{ ; }});
0x2: c_seq_d({{ ; }});
0x3: c_ngl_d({{ ; }});
0x4: c_lt_d({{ ; }});
0x5: c_nge_d({{ ; }});
0x6: c_le_d({{ ; }});
0x7: c_ngt_d({{ ; }});
}
}
} }
//Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W //Table A-16 MIPS32 COP1 Encoding of Function Field When rs=W
@ -797,6 +842,33 @@ decode OPCODE_HI default Unknown::unknown() {
0x7: puu({{ Fd.ud = Fs.ud<63:32> << 32 | Ft.ud<63:32>;}}); 0x7: puu({{ Fd.ud = Fs.ud<63:32> << 32 | Ft.ud<63:32>;}});
} }
} }
0x6: decode FUNCTION_LO {
format FloatOp {
0x0: c_f_ps({{ ; }});
0x1: c_un_ps({{ ; }});
0x2: c_eq_ps({{ ; }});
0x3: c_ueq_ps({{ ; }});
0x4: c_olt_ps({{ ; }});
0x5: c_ult_ps({{ ; }});
0x6: c_ole_ps({{ ; }});
0x7: c_ule_ps({{ ; }});
}
}
0x7: decode FUNCTION_LO {
format FloatOp {
0x0: c_sf_ps({{ ; }});
0x1: c_ngle_ps({{ ; }});
0x2: c_seq_ps({{ ; }});
0x3: c_ngl_ps({{ ; }});
0x4: c_lt_ps({{ ; }});
0x5: c_nge_ps({{ ; }});
0x6: c_le_ps({{ ; }});
0x7: c_ngt_ps({{ ; }});
}
}
} }
} }
} }