aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/cp1emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/math-emu/cp1emu.c')
-rw-r--r--arch/mips/math-emu/cp1emu.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index c4b855e7b0e0..584e0b805909 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -869,14 +869,16 @@ static inline int cop1_64bit(struct pt_regs *xcp)
869#endif 869#endif
870} 870}
871 871
872#define SIFROMREG(si, x) do { \ 872#define SIFROMREG(si, x) \
873do { \
873 if (cop1_64bit(xcp)) \ 874 if (cop1_64bit(xcp)) \
874 (si) = get_fpr32(&ctx->fpr[x], 0); \ 875 (si) = get_fpr32(&ctx->fpr[x], 0); \
875 else \ 876 else \
876 (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ 877 (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \
877} while (0) 878} while (0)
878 879
879#define SITOREG(si, x) do { \ 880#define SITOREG(si, x) \
881do { \
880 if (cop1_64bit(xcp)) { \ 882 if (cop1_64bit(xcp)) { \
881 unsigned i; \ 883 unsigned i; \
882 set_fpr32(&ctx->fpr[x], 0, si); \ 884 set_fpr32(&ctx->fpr[x], 0, si); \
@@ -889,17 +891,19 @@ static inline int cop1_64bit(struct pt_regs *xcp)
889 891
890#define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1)) 892#define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1))
891 893
892#define SITOHREG(si, x) do { \ 894#define SITOHREG(si, x) \
895do { \
893 unsigned i; \ 896 unsigned i; \
894 set_fpr32(&ctx->fpr[x], 1, si); \ 897 set_fpr32(&ctx->fpr[x], 1, si); \
895 for (i = 2; i < ARRAY_SIZE(ctx->fpr[x].val32); i++) \ 898 for (i = 2; i < ARRAY_SIZE(ctx->fpr[x].val32); i++) \
896 set_fpr32(&ctx->fpr[x], i, 0); \ 899 set_fpr32(&ctx->fpr[x], i, 0); \
897} while (0) 900} while (0)
898 901
899#define DIFROMREG(di, x) \ 902#define DIFROMREG(di, x) \
900 ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0)) 903 ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
901 904
902#define DITOREG(di, x) do { \ 905#define DITOREG(di, x) \
906do { \
903 unsigned fpr, i; \ 907 unsigned fpr, i; \
904 fpr = (x) & ~(cop1_64bit(xcp) == 0); \ 908 fpr = (x) & ~(cop1_64bit(xcp) == 0); \
905 set_fpr64(&ctx->fpr[fpr], 0, di); \ 909 set_fpr64(&ctx->fpr[fpr], 0, di); \
@@ -1341,20 +1345,20 @@ static const unsigned char cmptab[8] = {
1341 * Additional MIPS4 instructions 1345 * Additional MIPS4 instructions
1342 */ 1346 */
1343 1347
1344#define DEF3OP(name, p, f1, f2, f3) \ 1348#define DEF3OP(name, p, f1, f2, f3) \
1345static union ieee754##p fpemu_##p##_##name(union ieee754##p r, union ieee754##p s, \ 1349static union ieee754##p fpemu_##p##_##name(union ieee754##p r, \
1346 union ieee754##p t) \ 1350 union ieee754##p s, union ieee754##p t) \
1347{ \ 1351{ \
1348 struct _ieee754_csr ieee754_csr_save; \ 1352 struct _ieee754_csr ieee754_csr_save; \
1349 s = f1(s, t); \ 1353 s = f1(s, t); \
1350 ieee754_csr_save = ieee754_csr; \ 1354 ieee754_csr_save = ieee754_csr; \
1351 s = f2(s, r); \ 1355 s = f2(s, r); \
1352 ieee754_csr_save.cx |= ieee754_csr.cx; \ 1356 ieee754_csr_save.cx |= ieee754_csr.cx; \
1353 ieee754_csr_save.sx |= ieee754_csr.sx; \ 1357 ieee754_csr_save.sx |= ieee754_csr.sx; \
1354 s = f3(s); \ 1358 s = f3(s); \
1355 ieee754_csr.cx |= ieee754_csr_save.cx; \ 1359 ieee754_csr.cx |= ieee754_csr_save.cx; \
1356 ieee754_csr.sx |= ieee754_csr_save.sx; \ 1360 ieee754_csr.sx |= ieee754_csr_save.sx; \
1357 return s; \ 1361 return s; \
1358} 1362}
1359 1363
1360static union ieee754dp fpemu_dp_recip(union ieee754dp d) 1364static union ieee754dp fpemu_dp_recip(union ieee754dp d)