aboutsummaryrefslogtreecommitdiffstats
path: root/arch/nds32/math-emu
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--arch/nds32/math-emu/Makefile10
-rw-r--r--arch/nds32/math-emu/faddd.c24
-rw-r--r--arch/nds32/math-emu/fadds.c24
-rw-r--r--arch/nds32/math-emu/fcmpd.c24
-rw-r--r--arch/nds32/math-emu/fcmps.c24
-rw-r--r--arch/nds32/math-emu/fd2s.c22
-rw-r--r--arch/nds32/math-emu/fd2si.c30
-rw-r--r--arch/nds32/math-emu/fd2siz.c30
-rw-r--r--arch/nds32/math-emu/fd2ui.c30
-rw-r--r--arch/nds32/math-emu/fd2uiz.c30
-rw-r--r--arch/nds32/math-emu/fdivd.c27
-rw-r--r--arch/nds32/math-emu/fdivs.c26
-rw-r--r--arch/nds32/math-emu/fmuld.c23
-rw-r--r--arch/nds32/math-emu/fmuls.c23
-rw-r--r--arch/nds32/math-emu/fnegd.c21
-rw-r--r--arch/nds32/math-emu/fnegs.c21
-rw-r--r--arch/nds32/math-emu/fpuemu.c406
-rw-r--r--arch/nds32/math-emu/fs2d.c23
-rw-r--r--arch/nds32/math-emu/fs2si.c29
-rw-r--r--arch/nds32/math-emu/fs2siz.c29
-rw-r--r--arch/nds32/math-emu/fs2ui.c29
-rw-r--r--arch/nds32/math-emu/fs2uiz.c30
-rw-r--r--arch/nds32/math-emu/fsi2d.c22
-rw-r--r--arch/nds32/math-emu/fsi2s.c22
-rw-r--r--arch/nds32/math-emu/fsqrtd.c21
-rw-r--r--arch/nds32/math-emu/fsqrts.c21
-rw-r--r--arch/nds32/math-emu/fsubd.c27
-rw-r--r--arch/nds32/math-emu/fsubs.c27
-rw-r--r--arch/nds32/math-emu/fui2d.c22
-rw-r--r--arch/nds32/math-emu/fui2s.c22
30 files changed, 0 insertions, 1119 deletions
diff --git a/arch/nds32/math-emu/Makefile b/arch/nds32/math-emu/Makefile
deleted file mode 100644
index 3bed7e5d5d05..000000000000
--- a/arch/nds32/math-emu/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the Linux/nds32 kernel FPU emulation.
-#
-
-obj-y := fpuemu.o \
- fdivd.o fmuld.o fsubd.o faddd.o fs2d.o fsqrtd.o fcmpd.o fnegs.o \
- fd2si.o fd2ui.o fd2siz.o fd2uiz.o fsi2d.o fui2d.o \
- fdivs.o fmuls.o fsubs.o fadds.o fd2s.o fsqrts.o fcmps.o fnegd.o \
- fs2si.o fs2ui.o fs2siz.o fs2uiz.o fsi2s.o fui2s.o
diff --git a/arch/nds32/math-emu/faddd.c b/arch/nds32/math-emu/faddd.c
deleted file mode 100644
index f7fd4e3c3904..000000000000
--- a/arch/nds32/math-emu/faddd.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-void faddd(void *ft, void *fa, void *fb)
-{
- FP_DECL_D(A);
- FP_DECL_D(B);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
- FP_UNPACK_DP(B, fb);
-
- FP_ADD_D(R, A, B);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}
diff --git a/arch/nds32/math-emu/fadds.c b/arch/nds32/math-emu/fadds.c
deleted file mode 100644
index f5af6ca8cca5..000000000000
--- a/arch/nds32/math-emu/fadds.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fadds(void *ft, void *fa, void *fb)
-{
- FP_DECL_S(A);
- FP_DECL_S(B);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
- FP_UNPACK_SP(B, fb);
-
- FP_ADD_S(R, A, B);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}
diff --git a/arch/nds32/math-emu/fcmpd.c b/arch/nds32/math-emu/fcmpd.c
deleted file mode 100644
index 0ea225abe880..000000000000
--- a/arch/nds32/math-emu/fcmpd.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-int fcmpd(void *ft, void *fa, void *fb, int cmpop)
-{
- FP_DECL_D(A);
- FP_DECL_D(B);
- FP_DECL_EX;
- long cmp;
-
- FP_UNPACK_DP(A, fa);
- FP_UNPACK_DP(B, fb);
-
- FP_CMP_D(cmp, A, B, SF_CUN);
- cmp += 2;
- if (cmp == SF_CGT)
- *(long *)ft = 0;
- else
- *(long *)ft = (cmp & cmpop) ? 1 : 0;
-
- return 0;
-}
diff --git a/arch/nds32/math-emu/fcmps.c b/arch/nds32/math-emu/fcmps.c
deleted file mode 100644
index 681480758213..000000000000
--- a/arch/nds32/math-emu/fcmps.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-int fcmps(void *ft, void *fa, void *fb, int cmpop)
-{
- FP_DECL_S(A);
- FP_DECL_S(B);
- FP_DECL_EX;
- long cmp;
-
- FP_UNPACK_SP(A, fa);
- FP_UNPACK_SP(B, fb);
-
- FP_CMP_S(cmp, A, B, SF_CUN);
- cmp += 2;
- if (cmp == SF_CGT)
- *(int *)ft = 0x0;
- else
- *(int *)ft = (cmp & cmpop) ? 0x1 : 0x0;
-
- return 0;
-}
diff --git a/arch/nds32/math-emu/fd2s.c b/arch/nds32/math-emu/fd2s.c
deleted file mode 100644
index 1328371e8170..000000000000
--- a/arch/nds32/math-emu/fd2s.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/double.h>
-#include <math-emu/single.h>
-#include <math-emu/soft-fp.h>
-void fd2s(void *ft, void *fa)
-{
- FP_DECL_D(A);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- FP_CONV(S, D, 1, 2, R, A);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fd2si.c b/arch/nds32/math-emu/fd2si.c
deleted file mode 100644
index fae3e16a0a10..000000000000
--- a/arch/nds32/math-emu/fd2si.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fd2si(void *ft, void *fa)
-{
- int r;
-
- FP_DECL_D(A);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(int *)ft = (A_s == 0) ? 0x7fffffff : 0x80000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_ROUND_D(r, A, 32, 1);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(int *)ft = r;
- }
-
-}
diff --git a/arch/nds32/math-emu/fd2siz.c b/arch/nds32/math-emu/fd2siz.c
deleted file mode 100644
index 92fe6774f112..000000000000
--- a/arch/nds32/math-emu/fd2siz.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fd2si_z(void *ft, void *fa)
-{
- int r;
-
- FP_DECL_D(A);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(int *)ft = (A_s == 0) ? 0x7fffffff : 0x80000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_D(r, A, 32, 1);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(int *)ft = r;
- }
-
-}
diff --git a/arch/nds32/math-emu/fd2ui.c b/arch/nds32/math-emu/fd2ui.c
deleted file mode 100644
index a0423b699aa4..000000000000
--- a/arch/nds32/math-emu/fd2ui.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fd2ui(void *ft, void *fa)
-{
- unsigned int r;
-
- FP_DECL_D(A);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(unsigned int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_ROUND_D(r, A, 32, 0);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(unsigned int *)ft = r;
- }
-
-}
diff --git a/arch/nds32/math-emu/fd2uiz.c b/arch/nds32/math-emu/fd2uiz.c
deleted file mode 100644
index 8ae17cfce90d..000000000000
--- a/arch/nds32/math-emu/fd2uiz.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fd2ui_z(void *ft, void *fa)
-{
- unsigned int r;
-
- FP_DECL_D(A);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(unsigned int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_D(r, A, 32, 0);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(unsigned int *)ft = r;
- }
-
-}
diff --git a/arch/nds32/math-emu/fdivd.c b/arch/nds32/math-emu/fdivd.c
deleted file mode 100644
index 458e7e98b08e..000000000000
--- a/arch/nds32/math-emu/fdivd.c
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-
-#include <linux/uaccess.h>
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fdivd(void *ft, void *fa, void *fb)
-{
- FP_DECL_D(A);
- FP_DECL_D(B);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
- FP_UNPACK_DP(B, fb);
-
- if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO)
- FP_SET_EXCEPTION(FP_EX_DIVZERO);
-
- FP_DIV_D(R, A, B);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fdivs.c b/arch/nds32/math-emu/fdivs.c
deleted file mode 100644
index c7d202159ce2..000000000000
--- a/arch/nds32/math-emu/fdivs.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fdivs(void *ft, void *fa, void *fb)
-{
- FP_DECL_S(A);
- FP_DECL_S(B);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
- FP_UNPACK_SP(B, fb);
-
- if (B_c == FP_CLS_ZERO && A_c != FP_CLS_ZERO)
- FP_SET_EXCEPTION(FP_EX_DIVZERO);
-
- FP_DIV_S(R, A, B);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fmuld.c b/arch/nds32/math-emu/fmuld.c
deleted file mode 100644
index f3c77a45ddc2..000000000000
--- a/arch/nds32/math-emu/fmuld.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-void fmuld(void *ft, void *fa, void *fb)
-{
- FP_DECL_D(A);
- FP_DECL_D(B);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
- FP_UNPACK_DP(B, fb);
-
- FP_MUL_D(R, A, B);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fmuls.c b/arch/nds32/math-emu/fmuls.c
deleted file mode 100644
index cf150df938f9..000000000000
--- a/arch/nds32/math-emu/fmuls.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fmuls(void *ft, void *fa, void *fb)
-{
- FP_DECL_S(A);
- FP_DECL_S(B);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
- FP_UNPACK_SP(B, fb);
-
- FP_MUL_S(R, A, B);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fnegd.c b/arch/nds32/math-emu/fnegd.c
deleted file mode 100644
index de7ea6a0873e..000000000000
--- a/arch/nds32/math-emu/fnegd.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-void fnegd(void *ft, void *fa)
-{
- FP_DECL_D(A);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- FP_NEG_D(R, A);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fnegs.c b/arch/nds32/math-emu/fnegs.c
deleted file mode 100644
index 07270b326a77..000000000000
--- a/arch/nds32/math-emu/fnegs.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fnegs(void *ft, void *fa)
-{
- FP_DECL_S(A);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- FP_NEG_S(R, A);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fpuemu.c b/arch/nds32/math-emu/fpuemu.c
deleted file mode 100644
index 46558a15c0dc..000000000000
--- a/arch/nds32/math-emu/fpuemu.c
+++ /dev/null
@@ -1,406 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-
-#include <asm/bitfield.h>
-#include <asm/uaccess.h>
-#include <asm/sfp-machine.h>
-#include <asm/fpuemu.h>
-#include <asm/nds32_fpu_inst.h>
-
-#define DPFROMREG(dp, x) (dp = (void *)((unsigned long *)fpu_reg + 2*x))
-#ifdef __NDS32_EL__
-#define SPFROMREG(sp, x)\
- ((sp) = (void *)((unsigned long *)fpu_reg + (x^1)))
-#else
-#define SPFROMREG(sp, x) ((sp) = (void *)((unsigned long *)fpu_reg + x))
-#endif
-
-#define DEF3OP(name, p, f1, f2) \
-void fpemu_##name##p(void *ft, void *fa, void *fb) \
-{ \
- f1(fa, fa, fb); \
- f2(ft, ft, fa); \
-}
-
-#define DEF3OPNEG(name, p, f1, f2, f3) \
-void fpemu_##name##p(void *ft, void *fa, void *fb) \
-{ \
- f1(fa, fa, fb); \
- f2(ft, ft, fa); \
- f3(ft, ft); \
-}
-DEF3OP(fmadd, s, fmuls, fadds);
-DEF3OP(fmsub, s, fmuls, fsubs);
-DEF3OP(fmadd, d, fmuld, faddd);
-DEF3OP(fmsub, d, fmuld, fsubd);
-DEF3OPNEG(fnmadd, s, fmuls, fadds, fnegs);
-DEF3OPNEG(fnmsub, s, fmuls, fsubs, fnegs);
-DEF3OPNEG(fnmadd, d, fmuld, faddd, fnegd);
-DEF3OPNEG(fnmsub, d, fmuld, fsubd, fnegd);
-
-static const unsigned char cmptab[8] = {
- SF_CEQ,
- SF_CEQ,
- SF_CLT,
- SF_CLT,
- SF_CLT | SF_CEQ,
- SF_CLT | SF_CEQ,
- SF_CUN,
- SF_CUN
-};
-
-enum ARGTYPE {
- S1S = 1,
- S2S,
- S1D,
- CS,
- D1D,
- D2D,
- D1S,
- CD
-};
-union func_t {
- void (*t)(void *ft, void *fa, void *fb);
- void (*b)(void *ft, void *fa);
-};
-/*
- * Emulate a single FPU arithmetic instruction.
- */
-static int fpu_emu(struct fpu_struct *fpu_reg, unsigned long insn)
-{
- int rfmt; /* resulting format */
- union func_t func;
- int ftype = 0;
-
- switch (rfmt = NDS32Insn_OPCODE_COP0(insn)) {
- case fs1_op:{
- switch (NDS32Insn_OPCODE_BIT69(insn)) {
- case fadds_op:
- func.t = fadds;
- ftype = S2S;
- break;
- case fsubs_op:
- func.t = fsubs;
- ftype = S2S;
- break;
- case fmadds_op:
- func.t = fpemu_fmadds;
- ftype = S2S;
- break;
- case fmsubs_op:
- func.t = fpemu_fmsubs;
- ftype = S2S;
- break;
- case fnmadds_op:
- func.t = fpemu_fnmadds;
- ftype = S2S;
- break;
- case fnmsubs_op:
- func.t = fpemu_fnmsubs;
- ftype = S2S;
- break;
- case fmuls_op:
- func.t = fmuls;
- ftype = S2S;
- break;
- case fdivs_op:
- func.t = fdivs;
- ftype = S2S;
- break;
- case fs1_f2op_op:
- switch (NDS32Insn_OPCODE_BIT1014(insn)) {
- case fs2d_op:
- func.b = fs2d;
- ftype = S1D;
- break;
- case fs2si_op:
- func.b = fs2si;
- ftype = S1S;
- break;
- case fs2si_z_op:
- func.b = fs2si_z;
- ftype = S1S;
- break;
- case fs2ui_op:
- func.b = fs2ui;
- ftype = S1S;
- break;
- case fs2ui_z_op:
- func.b = fs2ui_z;
- ftype = S1S;
- break;
- case fsi2s_op:
- func.b = fsi2s;
- ftype = S1S;
- break;
- case fui2s_op:
- func.b = fui2s;
- ftype = S1S;
- break;
- case fsqrts_op:
- func.b = fsqrts;
- ftype = S1S;
- break;
- default:
- return SIGILL;
- }
- break;
- default:
- return SIGILL;
- }
- break;
- }
- case fs2_op:
- switch (NDS32Insn_OPCODE_BIT69(insn)) {
- case fcmpeqs_op:
- case fcmpeqs_e_op:
- case fcmplts_op:
- case fcmplts_e_op:
- case fcmples_op:
- case fcmples_e_op:
- case fcmpuns_op:
- case fcmpuns_e_op:
- ftype = CS;
- break;
- default:
- return SIGILL;
- }
- break;
- case fd1_op:{
- switch (NDS32Insn_OPCODE_BIT69(insn)) {
- case faddd_op:
- func.t = faddd;
- ftype = D2D;
- break;
- case fsubd_op:
- func.t = fsubd;
- ftype = D2D;
- break;
- case fmaddd_op:
- func.t = fpemu_fmaddd;
- ftype = D2D;
- break;
- case fmsubd_op:
- func.t = fpemu_fmsubd;
- ftype = D2D;
- break;
- case fnmaddd_op:
- func.t = fpemu_fnmaddd;
- ftype = D2D;
- break;
- case fnmsubd_op:
- func.t = fpemu_fnmsubd;
- ftype = D2D;
- break;
- case fmuld_op:
- func.t = fmuld;
- ftype = D2D;
- break;
- case fdivd_op:
- func.t = fdivd;
- ftype = D2D;
- break;
- case fd1_f2op_op:
- switch (NDS32Insn_OPCODE_BIT1014(insn)) {
- case fd2s_op:
- func.b = fd2s;
- ftype = D1S;
- break;
- case fd2si_op:
- func.b = fd2si;
- ftype = D1S;
- break;
- case fd2si_z_op:
- func.b = fd2si_z;
- ftype = D1S;
- break;
- case fd2ui_op:
- func.b = fd2ui;
- ftype = D1S;
- break;
- case fd2ui_z_op:
- func.b = fd2ui_z;
- ftype = D1S;
- break;
- case fsi2d_op:
- func.b = fsi2d;
- ftype = D1S;
- break;
- case fui2d_op:
- func.b = fui2d;
- ftype = D1S;
- break;
- case fsqrtd_op:
- func.b = fsqrtd;
- ftype = D1D;
- break;
- default:
- return SIGILL;
- }
- break;
- default:
- return SIGILL;
-
- }
- break;
- }
-
- case fd2_op:
- switch (NDS32Insn_OPCODE_BIT69(insn)) {
- case fcmpeqd_op:
- case fcmpeqd_e_op:
- case fcmpltd_op:
- case fcmpltd_e_op:
- case fcmpled_op:
- case fcmpled_e_op:
- case fcmpund_op:
- case fcmpund_e_op:
- ftype = CD;
- break;
- default:
- return SIGILL;
- }
- break;
-
- default:
- return SIGILL;
- }
-
- switch (ftype) {
- case S1S:{
- void *ft, *fa;
-
- SPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- SPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- func.b(ft, fa);
- break;
- }
- case S2S:{
- void *ft, *fa, *fb;
-
- SPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- SPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- SPFROMREG(fb, NDS32Insn_OPCODE_Rb(insn));
- func.t(ft, fa, fb);
- break;
- }
- case S1D:{
- void *ft, *fa;
-
- DPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- SPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- func.b(ft, fa);
- break;
- }
- case CS:{
- unsigned int cmpop = NDS32Insn_OPCODE_BIT69(insn);
- void *ft, *fa, *fb;
-
- SPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- SPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- SPFROMREG(fb, NDS32Insn_OPCODE_Rb(insn));
- if (cmpop < 0x8) {
- cmpop = cmptab[cmpop];
- fcmps(ft, fa, fb, cmpop);
- } else
- return SIGILL;
- break;
- }
- case D1D:{
- void *ft, *fa;
-
- DPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- DPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- func.b(ft, fa);
- break;
- }
- case D2D:{
- void *ft, *fa, *fb;
-
- DPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- DPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- DPFROMREG(fb, NDS32Insn_OPCODE_Rb(insn));
- func.t(ft, fa, fb);
- break;
- }
- case D1S:{
- void *ft, *fa;
-
- SPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- DPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- func.b(ft, fa);
- break;
- }
- case CD:{
- unsigned int cmpop = NDS32Insn_OPCODE_BIT69(insn);
- void *ft, *fa, *fb;
-
- SPFROMREG(ft, NDS32Insn_OPCODE_Rt(insn));
- DPFROMREG(fa, NDS32Insn_OPCODE_Ra(insn));
- DPFROMREG(fb, NDS32Insn_OPCODE_Rb(insn));
- if (cmpop < 0x8) {
- cmpop = cmptab[cmpop];
- fcmpd(ft, fa, fb, cmpop);
- } else
- return SIGILL;
- break;
- }
- default:
- return SIGILL;
- }
-
- /*
- * If an exception is required, generate a tidy SIGFPE exception.
- */
-#if IS_ENABLED(CONFIG_SUPPORT_DENORMAL_ARITHMETIC)
- if (((fpu_reg->fpcsr << 5) & fpu_reg->fpcsr & FPCSR_mskALLE_NO_UDF_IEXE)
- || ((fpu_reg->fpcsr << 5) & (fpu_reg->UDF_IEX_trap))) {
-#else
- if ((fpu_reg->fpcsr << 5) & fpu_reg->fpcsr & FPCSR_mskALLE) {
-#endif
- return SIGFPE;
- }
- return 0;
-}
-
-int do_fpuemu(struct pt_regs *regs, struct fpu_struct *fpu)
-{
- unsigned long insn = 0, addr = regs->ipc;
- unsigned long emulpc, contpc;
- unsigned char *pc = (void *)&insn;
- char c;
- int i = 0, ret;
-
- for (i = 0; i < 4; i++) {
- if (__get_user(c, (unsigned char *)addr++))
- return SIGBUS;
- *pc++ = c;
- }
-
- insn = be32_to_cpu(insn);
-
- emulpc = regs->ipc;
- contpc = regs->ipc + 4;
-
- if (NDS32Insn_OPCODE(insn) != cop0_op)
- return SIGILL;
-
- switch (NDS32Insn_OPCODE_COP0(insn)) {
- case fs1_op:
- case fs2_op:
- case fd1_op:
- case fd2_op:
- {
- /* a real fpu computation instruction */
- ret = fpu_emu(fpu, insn);
- if (!ret)
- regs->ipc = contpc;
- }
- break;
-
- default:
- return SIGILL;
- }
-
- return ret;
-}
diff --git a/arch/nds32/math-emu/fs2d.c b/arch/nds32/math-emu/fs2d.c
deleted file mode 100644
index 0e8db9035631..000000000000
--- a/arch/nds32/math-emu/fs2d.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-
-#include <linux/uaccess.h>
-#include <asm/sfp-machine.h>
-#include <math-emu/double.h>
-#include <math-emu/single.h>
-#include <math-emu/soft-fp.h>
-
-void fs2d(void *ft, void *fa)
-{
- FP_DECL_S(A);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- FP_CONV(D, S, 2, 1, R, A);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fs2si.c b/arch/nds32/math-emu/fs2si.c
deleted file mode 100644
index b4931d60980e..000000000000
--- a/arch/nds32/math-emu/fs2si.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fs2si(void *ft, void *fa)
-{
- int r;
-
- FP_DECL_S(A);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(int *)ft = (A_s == 0) ? 0x7fffffff : 0x80000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_ROUND_S(r, A, 32, 1);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(int *)ft = r;
- }
-}
diff --git a/arch/nds32/math-emu/fs2siz.c b/arch/nds32/math-emu/fs2siz.c
deleted file mode 100644
index 1c2b99ce3e38..000000000000
--- a/arch/nds32/math-emu/fs2siz.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fs2si_z(void *ft, void *fa)
-{
- int r;
-
- FP_DECL_S(A);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(int *)ft = (A_s == 0) ? 0x7fffffff : 0x80000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_S(r, A, 32, 1);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(int *)ft = r;
- }
-}
diff --git a/arch/nds32/math-emu/fs2ui.c b/arch/nds32/math-emu/fs2ui.c
deleted file mode 100644
index c337f0384d06..000000000000
--- a/arch/nds32/math-emu/fs2ui.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fs2ui(void *ft, void *fa)
-{
- unsigned int r;
-
- FP_DECL_S(A);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(unsigned int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_ROUND_S(r, A, 32, 0);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(unsigned int *)ft = r;
- }
-}
diff --git a/arch/nds32/math-emu/fs2uiz.c b/arch/nds32/math-emu/fs2uiz.c
deleted file mode 100644
index 22c5e4768044..000000000000
--- a/arch/nds32/math-emu/fs2uiz.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fs2ui_z(void *ft, void *fa)
-{
- unsigned int r;
-
- FP_DECL_S(A);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- if (A_c == FP_CLS_INF) {
- *(unsigned int *)ft = (A_s == 0) ? 0xffffffff : 0x00000000;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else if (A_c == FP_CLS_NAN) {
- *(unsigned int *)ft = 0xffffffff;
- __FPU_FPCSR |= FP_EX_INVALID;
- } else {
- FP_TO_INT_S(r, A, 32, 0);
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
- *(unsigned int *)ft = r;
- }
-
-}
diff --git a/arch/nds32/math-emu/fsi2d.c b/arch/nds32/math-emu/fsi2d.c
deleted file mode 100644
index 6b04cec0c5c5..000000000000
--- a/arch/nds32/math-emu/fsi2d.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fsi2d(void *ft, void *fa)
-{
- int a = *(int *)fa;
-
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_FROM_INT_D(R, a, 32, int);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}
diff --git a/arch/nds32/math-emu/fsi2s.c b/arch/nds32/math-emu/fsi2s.c
deleted file mode 100644
index 689864a5df90..000000000000
--- a/arch/nds32/math-emu/fsi2s.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fsi2s(void *ft, void *fa)
-{
- int a = *(int *)fa;
-
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_FROM_INT_S(R, a, 32, int);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}
diff --git a/arch/nds32/math-emu/fsqrtd.c b/arch/nds32/math-emu/fsqrtd.c
deleted file mode 100644
index c3a8dbd81d4e..000000000000
--- a/arch/nds32/math-emu/fsqrtd.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-
-#include <linux/uaccess.h>
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-void fsqrtd(void *ft, void *fa)
-{
- FP_DECL_D(A);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
-
- FP_SQRT_D(R, A);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fsqrts.c b/arch/nds32/math-emu/fsqrts.c
deleted file mode 100644
index 4c6f94b27328..000000000000
--- a/arch/nds32/math-emu/fsqrts.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-
-#include <linux/uaccess.h>
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fsqrts(void *ft, void *fa)
-{
- FP_DECL_S(A);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
-
- FP_SQRT_S(R, A);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fsubd.c b/arch/nds32/math-emu/fsubd.c
deleted file mode 100644
index 81b6a0d02a1f..000000000000
--- a/arch/nds32/math-emu/fsubd.c
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-void fsubd(void *ft, void *fa, void *fb)
-{
-
- FP_DECL_D(A);
- FP_DECL_D(B);
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_UNPACK_DP(A, fa);
- FP_UNPACK_DP(B, fb);
-
- if (B_c != FP_CLS_NAN)
- B_s ^= 1;
-
- FP_ADD_D(R, A, B);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fsubs.c b/arch/nds32/math-emu/fsubs.c
deleted file mode 100644
index 61ddd9708465..000000000000
--- a/arch/nds32/math-emu/fsubs.c
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2018 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-void fsubs(void *ft, void *fa, void *fb)
-{
-
- FP_DECL_S(A);
- FP_DECL_S(B);
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_UNPACK_SP(A, fa);
- FP_UNPACK_SP(B, fb);
-
- if (B_c != FP_CLS_NAN)
- B_s ^= 1;
-
- FP_ADD_S(R, A, B);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-}
diff --git a/arch/nds32/math-emu/fui2d.c b/arch/nds32/math-emu/fui2d.c
deleted file mode 100644
index 9689d33a8d50..000000000000
--- a/arch/nds32/math-emu/fui2d.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/double.h>
-
-void fui2d(void *ft, void *fa)
-{
- unsigned int a = *(unsigned int *)fa;
-
- FP_DECL_D(R);
- FP_DECL_EX;
-
- FP_FROM_INT_D(R, a, 32, int);
-
- FP_PACK_DP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}
diff --git a/arch/nds32/math-emu/fui2s.c b/arch/nds32/math-emu/fui2s.c
deleted file mode 100644
index f70f0762547d..000000000000
--- a/arch/nds32/math-emu/fui2s.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2019 Andes Technology Corporation
-#include <linux/uaccess.h>
-
-#include <asm/sfp-machine.h>
-#include <math-emu/soft-fp.h>
-#include <math-emu/single.h>
-
-void fui2s(void *ft, void *fa)
-{
- unsigned int a = *(unsigned int *)fa;
-
- FP_DECL_S(R);
- FP_DECL_EX;
-
- FP_FROM_INT_S(R, a, 32, int);
-
- FP_PACK_SP(ft, R);
-
- __FPU_FPCSR |= FP_CUR_EXCEPTIONS;
-
-}