MIPS: math-emu: Add support for the MIPS R6 CLASS FPU instruction
[linux-drm-fsl-dcu.git] / arch / mips / math-emu / cp1emu.c
index a348cbefe4a8ef17e75c4f6382057ca283146a96..b65b4ea60232873d45db2b5e26f0967ad7b3122f 100644 (file)
@@ -1803,6 +1803,18 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
                        goto copcsr;
                }
 
+               case fclass_op: {
+                       union ieee754sp fs;
+
+                       if (!cpu_has_mips_r6)
+                               return SIGILL;
+
+                       SPFROMREG(fs, MIPSInst_FS(ir));
+                       rv.w = ieee754sp_2008class(fs);
+                       rfmt = w_fmt;
+                       break;
+               }
+
                case fabs_op:
                        handler.u = ieee754sp_abs;
                        goto scopuop;
@@ -2061,6 +2073,18 @@ copcsr:
                        goto copcsr;
                }
 
+               case fclass_op: {
+                       union ieee754dp fs;
+
+                       if (!cpu_has_mips_r6)
+                               return SIGILL;
+
+                       DPFROMREG(fs, MIPSInst_FS(ir));
+                       rv.w = ieee754dp_2008class(fs);
+                       rfmt = w_fmt;
+                       break;
+               }
+
                case fabs_op:
                        handler.u = ieee754dp_abs;
                        goto dcopuop;