decoder.isa:
authorKorey Sewell <ksewell@umich.edu>
Tue, 9 May 2006 18:39:45 +0000 (14:39 -0400)
committerKorey Sewell <ksewell@umich.edu>
Tue, 9 May 2006 18:39:45 +0000 (14:39 -0400)
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

arch/mips/isa/decoder.isa

index d2d14efd06cfcbd740119c27ffd345fa42e5d5ae..1e78d27d936fb054d2b22584f523b18e8a622c34 100644 (file)
@@ -514,37 +514,37 @@ decode OPCODE_HI default Unknown::unknown() {
                         0x1: decode FUNCTION_LO {
                             format Float64Op {
                                 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({{
-                                    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({{
-                                    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({{
-                                    Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, RND_DOWN);
+                                    Fd.ud = fpConvert(floor(Fs.sf), SINGLE_TO_LONG);
                                 }});
                             }
 
                             format FloatOp {
                                 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({{
-                                    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({{
-                                    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({{
-                                    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 {
                             0x1: decode MOVCF {
                                 format FloatOp {
-                                    0x0: movfs({{if (xc->readMiscReg(FPCR) != CC) Fd = Fs; }});
-                                    0x1: movts({{if (xc->readMiscReg(FPCR) == CC) Fd = Fs;}});
+                                    0x0: movf_s({{if (FPConditionCode(CC) == 0) Fd = Fs;}});
+                                    0x1: movt_s({{if (FPConditionCode(CC) == 1) Fd = Fs;}});
                                 }
                             }
 
-                            format BasicOp {
-                                0x2: movzs({{ if (Rt == 0) Fd = Fs; }});
-                                0x3: movns({{ if (Rt != 0) Fd = Fs; }});
-                            }
-
-                            format Float64Op {
-                                0x5: recips({{ Fd = 1 / Fs; }});
-                                0x6: rsqrts({{ Fd = 1 / sqrt((double)Fs.ud);}});
+                            format FloatOp {
+                                0x2: movz_s({{ 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);}});
                             }
                         }
 
@@ -572,21 +569,17 @@ decode OPCODE_HI default Unknown::unknown() {
 
                             format FloatOp {
                                 0x1: cvt_d_s({{
-                                    int rnd_mode = xc->readMiscReg(FCSR) & 0x03;
-                                    Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_DOUBLE, rnd_mode);
+                                    Fd.ud = fpConvert(Fs.sf, SINGLE_TO_DOUBLE);
                                 }});
 
                                 0x4: cvt_w_s({{
-                                    int rnd_mode = xc->readMiscReg(FCSR) & 0x03;
-                                    Fd.uw = convert_and_round(Fs.sf, SINGLE_TO_WORD, rnd_mode);
+                                    Fd.uw = fpConvert(Fs.sf, SINGLE_TO_WORD);
                                 }});
                             }
 
-                            //only legal for 64 bit
                             format Float64Op {
                                 0x5: cvt_l_s({{
-                                    int rnd_mode = xc->readMiscReg(FCSR) & 0x03;
-                                    Fd.ud = convert_and_round(Fs.sf, SINGLE_TO_LONG, rnd_mode);
+                                    Fd.ud = fpConvert(Fs.sf, SINGLE_TO_LONG);
                                 }});
 
                                 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
@@ -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
@@ -797,6 +842,33 @@ decode OPCODE_HI default Unknown::unknown() {
                                 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({{ ; }});
+                            }
+                        }
+
                     }
                 }
             }