MIPS: math-emu: Add support for the MIPS R6 RINT FPU instruction
[linux-drm-fsl-dcu.git] / arch / mips / math-emu / cp1emu.c
index 54964b372992f5f41184eed16f7384962e4d8f19..a348cbefe4a8ef17e75c4f6382057ca283146a96 100644 (file)
@@ -1791,6 +1791,18 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
                        break;
                }
 
+               case frint_op: {
+                       union ieee754sp fs;
+
+                       if (!cpu_has_mips_r6)
+                               return SIGILL;
+
+                       SPFROMREG(fs, MIPSInst_FS(ir));
+                       rv.l = ieee754sp_tlong(fs);
+                       rv.s = ieee754sp_flong(rv.l);
+                       goto copcsr;
+               }
+
                case fabs_op:
                        handler.u = ieee754sp_abs;
                        goto scopuop;
@@ -2037,6 +2049,18 @@ copcsr:
                        break;
                }
 
+               case frint_op: {
+                       union ieee754dp fs;
+
+                       if (!cpu_has_mips_r6)
+                               return SIGILL;
+
+                       DPFROMREG(fs, MIPSInst_FS(ir));
+                       rv.l = ieee754dp_tlong(fs);
+                       rv.d = ieee754dp_flong(rv.l);
+                       goto copcsr;
+               }
+
                case fabs_op:
                        handler.u = ieee754dp_abs;
                        goto dcopuop;