MIPS: math-emu: Reformat code according to coding style.
authorRalf Baechle <ralf@linux-mips.org>
Wed, 16 Apr 2014 09:00:12 +0000 (11:00 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 21 May 2014 09:12:56 +0000 (11:12 +0200)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/math-emu/cp1emu.c
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754dp.h
arch/mips/math-emu/ieee754int.h
arch/mips/math-emu/ieee754sp.c
arch/mips/math-emu/ieee754sp.h
arch/mips/math-emu/me-debugfs.c

index c4b855e7b0e0dd4ea371a74b20052ad641c8bc5c..584e0b805909578d9d1bae350c03435426d8e014 100644 (file)
@@ -869,14 +869,16 @@ static inline int cop1_64bit(struct pt_regs *xcp)
 #endif
 }
 
-#define SIFROMREG(si, x) do {                                          \
+#define SIFROMREG(si, x)                                               \
+do {                                                                   \
        if (cop1_64bit(xcp))                                            \
                (si) = get_fpr32(&ctx->fpr[x], 0);                      \
        else                                                            \
                (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1);         \
 } while (0)
 
-#define SITOREG(si, x) do {                                            \
+#define SITOREG(si, x)                                                 \
+do {                                                                   \
        if (cop1_64bit(xcp)) {                                          \
                unsigned i;                                             \
                set_fpr32(&ctx->fpr[x], 0, si);                         \
@@ -889,17 +891,19 @@ static inline int cop1_64bit(struct pt_regs *xcp)
 
 #define SIFROMHREG(si, x)      ((si) = get_fpr32(&ctx->fpr[x], 1))
 
-#define SITOHREG(si, x) do {                                           \
+#define SITOHREG(si, x)                                                        \
+do {                                                                   \
        unsigned i;                                                     \
        set_fpr32(&ctx->fpr[x], 1, si);                                 \
        for (i = 2; i < ARRAY_SIZE(ctx->fpr[x].val32); i++)             \
                set_fpr32(&ctx->fpr[x], i, 0);                          \
 } while (0)
 
-#define DIFROMREG(di, x) \
+#define DIFROMREG(di, x)                                               \
        ((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
 
-#define DITOREG(di, x) do {                                            \
+#define DITOREG(di, x)                                                 \
+do {                                                                   \
        unsigned fpr, i;                                                \
        fpr = (x) & ~(cop1_64bit(xcp) == 0);                            \
        set_fpr64(&ctx->fpr[fpr], 0, di);                               \
@@ -1341,20 +1345,20 @@ static const unsigned char cmptab[8] = {
  * Additional MIPS4 instructions
  */
 
-#define DEF3OP(name, p, f1, f2, f3) \
-static union ieee754##p fpemu_##p##_##name(union ieee754##p r, union ieee754##p s, \
-    union ieee754##p t) \
-{ \
-       struct _ieee754_csr ieee754_csr_save; \
-       s = f1(s, t); \
-       ieee754_csr_save = ieee754_csr; \
-       s = f2(s, r); \
-       ieee754_csr_save.cx |= ieee754_csr.cx; \
-       ieee754_csr_save.sx |= ieee754_csr.sx; \
-       s = f3(s); \
-       ieee754_csr.cx |= ieee754_csr_save.cx; \
-       ieee754_csr.sx |= ieee754_csr_save.sx; \
-       return s; \
+#define DEF3OP(name, p, f1, f2, f3)                                    \
+static union ieee754##p fpemu_##p##_##name(union ieee754##p r,         \
+       union ieee754##p s, union ieee754##p t)                         \
+{                                                                      \
+       struct _ieee754_csr ieee754_csr_save;                           \
+       s = f1(s, t);                                                   \
+       ieee754_csr_save = ieee754_csr;                                 \
+       s = f2(s, r);                                                   \
+       ieee754_csr_save.cx |= ieee754_csr.cx;                          \
+       ieee754_csr_save.sx |= ieee754_csr.sx;                          \
+       s = f3(s);                                                      \
+       ieee754_csr.cx |= ieee754_csr_save.cx;                          \
+       ieee754_csr.sx |= ieee754_csr_save.sx;                          \
+       return s;                                                       \
 }
 
 static union ieee754dp fpemu_dp_recip(union ieee754dp d)
index 3692362b80723aa3bded228d8b237173c53baa2f..43fb7fefb6cc5b401ff2c56dfb9923d0b7783718 100644 (file)
@@ -151,12 +151,12 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
                        case IEEE754_RZ:
                                return ieee754dp_zero(sn);
                        case IEEE754_RU:    /* toward +Infinity */
-                               if(sn == 0)
+                               if (sn == 0)
                                        return ieee754dp_min(0);
                                else
                                        return ieee754dp_zero(1);
                        case IEEE754_RD:    /* toward -Infinity */
-                               if(sn == 0)
+                               if (sn == 0)
                                        return ieee754dp_zero(0);
                                else
                                        return ieee754dp_min(1);
index ad2568fa0b054dc1d58e50982ea8e82366c8dd08..3759f3f35293437289d3261ce5645b9d7f9b722f 100644 (file)
 
 /* 3bit extended double precision sticky right shift */
 #define XDPSRS(v,rs)   \
-  ((rs > (DP_MBITS+3))?1:((v) >> (rs)) | ((v) << (64-(rs)) != 0))
+       ((rs > (DP_MBITS+3))?1:((v) >> (rs)) | ((v) << (64-(rs)) != 0))
 
 #define XDPSRSX1() \
-  (xe++, (xm = (xm >> 1) | (xm & 1)))
+       (xe++, (xm = (xm >> 1) | (xm & 1)))
 
 #define XDPSRS1(v)     \
-  (((v) >> 1) | ((v) & 1))
+       (((v) >> 1) | ((v) & 1))
 
 /* convert denormal to normalized with extended exponent */
 #define DPDNORMx(m,e) \
-  while( (m >> DP_MBITS) == 0) { m <<= 1; e--; }
+       while ((m >> DP_MBITS) == 0) { m <<= 1; e--; }
 #define DPDNORMX       DPDNORMx(xm, xe)
 #define DPDNORMY       DPDNORMx(ym, ye)
 
@@ -71,13 +71,13 @@ extern union ieee754dp ieee754dp_bestnan(union ieee754dp, union ieee754dp);
 extern union ieee754dp ieee754dp_format(int, int, u64);
 
 
-#define DPNORMRET2(s, e, m, name, a0, a1) \
-{ \
-    union ieee754dp V = ieee754dp_format(s, e, m); \
-    if(TSTX()) \
-      return ieee754dp_xcpt(V, name, a0, a1); \
-    else \
-      return V; \
+#define DPNORMRET2(s, e, m, name, a0, a1)                              \
+{                                                                      \
+       union ieee754dp V = ieee754dp_format(s, e, m);                  \
+       if (TSTX())                                                     \
+               return ieee754dp_xcpt(V, name, a0, a1);                 \
+       else                                                            \
+               return V;                                               \
 }
 
 #define DPNORMRET1(s, e, m, name, a0)  DPNORMRET2(s, e, m, name, a0, a0)
index 4b6c6fb353047e1b9b7185a0cda2e7e95b866d51..27ed825ad35aefc082846d94efbf5cc170818516 100644 (file)
 #define CLPAIR(x, y)   ((x)*6+(y))
 
 #define CLEARCX \
-  (ieee754_csr.cx = 0)
+       (ieee754_csr.cx = 0)
 
 #define SETCX(x) \
-  (ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
+       (ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
 
 #define SETANDTESTCX(x) \
-  (SETCX(x), ieee754_csr.mx & (x))
+       (SETCX(x), ieee754_csr.mx & (x))
 
 #define TSTX() \
        (ieee754_csr.cx & ieee754_csr.mx)
 
 
 #define COMPXSP \
-  unsigned xm; int xe; int xs __maybe_unused; int xc
+       unsigned xm; int xe; int xs __maybe_unused; int xc
 
 #define COMPYSP \
-  unsigned ym; int ye; int ys; int yc
-
-#define EXPLODESP(v, vc, vs, ve, vm) \
-{\
-    vs = SPSIGN(v);\
-    ve = SPBEXP(v);\
-    vm = SPMANT(v);\
-    if(ve == SP_EMAX+1+SP_EBIAS){\
-       if(vm == 0)\
-         vc = IEEE754_CLASS_INF;\
-       else if(vm & SP_MBIT(SP_MBITS-1)) \
-         vc = IEEE754_CLASS_SNAN;\
-       else \
-         vc = IEEE754_CLASS_QNAN;\
-    } else if(ve == SP_EMIN-1+SP_EBIAS) {\
-       if(vm) {\
-           ve = SP_EMIN;\
-           vc = IEEE754_CLASS_DNORM;\
-       } else\
-         vc = IEEE754_CLASS_ZERO;\
-    } else {\
-       ve -= SP_EBIAS;\
-       vm |= SP_HIDDEN_BIT;\
-       vc = IEEE754_CLASS_NORM;\
-    }\
+       unsigned ym; int ye; int ys; int yc
+
+#define EXPLODESP(v, vc, vs, ve, vm)                                   \
+{                                                                      \
+       vs = SPSIGN(v);                                                 \
+       ve = SPBEXP(v);                                                 \
+       vm = SPMANT(v);                                                 \
+       if (ve == SP_EMAX+1+SP_EBIAS) {                                 \
+               if (vm == 0)                                            \
+                       vc = IEEE754_CLASS_INF;                         \
+               else if (vm & SP_MBIT(SP_MBITS-1))                      \
+                       vc = IEEE754_CLASS_SNAN;                        \
+       else                                                            \
+               vc = IEEE754_CLASS_QNAN;                                \
+       } else if (ve == SP_EMIN-1+SP_EBIAS) {                          \
+               if (vm) {                                               \
+                       ve = SP_EMIN;                                   \
+                       vc = IEEE754_CLASS_DNORM;                       \
+               } else                                                  \
+                       vc = IEEE754_CLASS_ZERO;                        \
+       } else {                                                        \
+               ve -= SP_EBIAS;                                         \
+               vm |= SP_HIDDEN_BIT;                                    \
+               vc = IEEE754_CLASS_NORM;                                \
+       }                                                               \
 }
 #define EXPLODEXSP EXPLODESP(x, xc, xs, xe, xm)
 #define EXPLODEYSP EXPLODESP(y, yc, ys, ye, ym)
 
 
 #define COMPXDP \
-u64 xm; int xe; int xs __maybe_unused; int xc
+       u64 xm; int xe; int xs __maybe_unused; int xc
 
 #define COMPYDP \
-u64 ym; int ye; int ys; int yc
-
-#define EXPLODEDP(v, vc, vs, ve, vm) \
-{\
-    vm = DPMANT(v);\
-    vs = DPSIGN(v);\
-    ve = DPBEXP(v);\
-    if(ve == DP_EMAX+1+DP_EBIAS){\
-       if(vm == 0)\
-         vc = IEEE754_CLASS_INF;\
-       else if(vm & DP_MBIT(DP_MBITS-1)) \
-         vc = IEEE754_CLASS_SNAN;\
-       else \
-         vc = IEEE754_CLASS_QNAN;\
-    } else if(ve == DP_EMIN-1+DP_EBIAS) {\
-       if(vm) {\
-           ve = DP_EMIN;\
-           vc = IEEE754_CLASS_DNORM;\
-       } else\
-         vc = IEEE754_CLASS_ZERO;\
-    } else {\
-       ve -= DP_EBIAS;\
-       vm |= DP_HIDDEN_BIT;\
-       vc = IEEE754_CLASS_NORM;\
-    }\
+       u64 ym; int ye; int ys; int yc
+
+#define EXPLODEDP(v, vc, vs, ve, vm)                                   \
+{                                                                      \
+       vm = DPMANT(v);                                                 \
+       vs = DPSIGN(v);                                                 \
+       ve = DPBEXP(v);                                                 \
+       if (ve == DP_EMAX+1+DP_EBIAS) {                                 \
+               if (vm == 0)                                            \
+                       vc = IEEE754_CLASS_INF;                         \
+               else if (vm & DP_MBIT(DP_MBITS-1))                      \
+                       vc = IEEE754_CLASS_SNAN;                        \
+               else                                                    \
+                       vc = IEEE754_CLASS_QNAN;                        \
+       } else if (ve == DP_EMIN-1+DP_EBIAS) {                          \
+               if (vm) {                                               \
+                       ve = DP_EMIN;                                   \
+                       vc = IEEE754_CLASS_DNORM;                       \
+       } else                                                          \
+               vc = IEEE754_CLASS_ZERO;                                \
+       } else {                                                        \
+               ve -= DP_EBIAS;                                         \
+               vm |= DP_HIDDEN_BIT;                                    \
+               vc = IEEE754_CLASS_NORM;                                \
+       }                                                               \
 }
 #define EXPLODEXDP EXPLODEDP(x, xc, xs, xe, xm)
 #define EXPLODEYDP EXPLODEDP(y, yc, ys, ye, ym)
 
-#define FLUSHDP(v, vc, vs, ve, vm) \
-       if(vc==IEEE754_CLASS_DNORM) {\
-           if(ieee754_csr.nod) {\
-               SETCX(IEEE754_INEXACT);\
-               vc = IEEE754_CLASS_ZERO;\
-               ve = DP_EMIN-1+DP_EBIAS;\
-               vm = 0;\
-               v = ieee754dp_zero(vs);\
-           }\
+#define FLUSHDP(v, vc, vs, ve, vm)                                     \
+       if (vc==IEEE754_CLASS_DNORM) {                                  \
+               if (ieee754_csr.nod) {                                  \
+                       SETCX(IEEE754_INEXACT);                         \
+                       vc = IEEE754_CLASS_ZERO;                        \
+                       ve = DP_EMIN-1+DP_EBIAS;                        \
+                       vm = 0;                                         \
+                       v = ieee754dp_zero(vs);                         \
+               }                                                       \
        }
 
-#define FLUSHSP(v, vc, vs, ve, vm) \
-       if(vc==IEEE754_CLASS_DNORM) {\
-           if(ieee754_csr.nod) {\
-               SETCX(IEEE754_INEXACT);\
-               vc = IEEE754_CLASS_ZERO;\
-               ve = SP_EMIN-1+SP_EBIAS;\
-               vm = 0;\
-               v = ieee754sp_zero(vs);\
-           }\
+#define FLUSHSP(v, vc, vs, ve, vm)                                     \
+       if (vc==IEEE754_CLASS_DNORM) {                                  \
+               if (ieee754_csr.nod) {                                  \
+                       SETCX(IEEE754_INEXACT);                         \
+                       vc = IEEE754_CLASS_ZERO;                        \
+                       ve = SP_EMIN-1+SP_EBIAS;                        \
+                       vm = 0;                                         \
+                       v = ieee754sp_zero(vs);                         \
+               }                                                       \
        }
 
 #define FLUSHXDP FLUSHDP(x, xc, xs, xe, xm)
index ac84d19e7c87edc284c4eadacc63237c961032e7..a15d2123e05e784a783217747852924f2d587bee 100644 (file)
@@ -152,12 +152,12 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                        case IEEE754_RZ:
                                return ieee754sp_zero(sn);
                        case IEEE754_RU:      /* toward +Infinity */
-                               if(sn == 0)
+                               if (sn == 0)
                                        return ieee754sp_min(0);
                                else
                                        return ieee754sp_zero(1);
                        case IEEE754_RD:      /* toward -Infinity */
-                               if(sn == 0)
+                               if (sn == 0)
                                        return ieee754sp_zero(0);
                                else
                                        return ieee754sp_min(1);
@@ -174,8 +174,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
                        /* Clear grs bits */
                        xm &= ~(SP_MBIT(3) - 1);
                        xe++;
-               }
-               else {
+               } else {
                        /* sticky right shift es bits
                         */
                        SPXSRSXn(es);
index 5836fa1e69d81eee97f4e8e60f93d9af0198c35c..f007c47086cb82a6329236d8d2e06e323fa60ac3 100644 (file)
 #define assert(expr) ((void)0)
 
 /* 3bit extended single precision sticky right shift */
-#define SPXSRSXn(rs) \
-  (xe += rs, \
-   xm = (rs > (SP_MBITS+3))?1:((xm) >> (rs)) | ((xm) << (32-(rs)) != 0))
+#define SPXSRSXn(rs)                                                   \
+       (xe += rs,                                                      \
+        xm = (rs > (SP_MBITS+3))?1:((xm) >> (rs)) | ((xm) << (32-(rs)) != 0))
 
 #define SPXSRSX1() \
-  (xe++, (xm = (xm >> 1) | (xm & 1)))
+       (xe++, (xm = (xm >> 1) | (xm & 1)))
 
-#define SPXSRSYn(rs) \
-   (ye+=rs, \
-    ym = (rs > (SP_MBITS+3))?1:((ym) >> (rs)) | ((ym) << (32-(rs)) != 0))
+#define SPXSRSYn(rs)                                                           \
+       (ye+=rs,                                                                \
+        ym = (rs > (SP_MBITS+3))?1:((ym) >> (rs)) | ((ym) << (32-(rs)) != 0))
 
 #define SPXSRSY1() \
-   (ye++, (ym = (ym >> 1) | (ym & 1)))
+       (ye++, (ym = (ym >> 1) | (ym & 1)))
 
 /* convert denormal to normalized with extended exponent */
 #define SPDNORMx(m,e) \
-  while( (m >> SP_MBITS) == 0) { m <<= 1; e--; }
+       while ((m >> SP_MBITS) == 0) { m <<= 1; e--; }
 #define SPDNORMX       SPDNORMx(xm, xe)
 #define SPDNORMY       SPDNORMx(ym, ye)
 
@@ -77,13 +77,14 @@ extern union ieee754sp ieee754sp_bestnan(union ieee754sp, union ieee754sp);
 extern union ieee754sp ieee754sp_format(int, int, unsigned);
 
 
-#define SPNORMRET2(s, e, m, name, a0, a1) \
-{ \
-    union ieee754sp V = ieee754sp_format(s, e, m); \
-    if(TSTX()) \
-      return ieee754sp_xcpt(V, name, a0, a1); \
-    else \
-      return V; \
+#define SPNORMRET2(s, e, m, name, a0, a1)                              \
+{                                                                      \
+       union ieee754sp V = ieee754sp_format(s, e, m);                  \
+                                                                       \
+       if (TSTX())                                                     \
+               return ieee754sp_xcpt(V, name, a0, a1);                 \
+       else                                                            \
+               return V;                                               \
 }
 
 #define SPNORMRET1(s, e, m, name, a0)  SPNORMRET2(s, e, m, name, a0, a0)
index d895b38773dfccf76f9999d4d88cab79b4a13457..95ed9f9bd2b074a76ead940c6485508366435266 100644 (file)
@@ -38,14 +38,17 @@ static int __init debugfs_fpuemu(void)
        if (!dir)
                return -ENOMEM;
 
-#define FPU_STAT_CREATE(M)                                             \
-       do {                                                            \
-               d = debugfs_create_file(#M , S_IRUGO, dir,              \
-                       (void *)offsetof(struct mips_fpu_emulator_stats, M), \
-                       &fops_fpuemu_stat);                             \
-               if (!d)                                                 \
-                       return -ENOMEM;                                 \
-       } while (0)
+#define FPU_EMU_STAT_OFFSET(m)                                         \
+       offsetof(struct mips_fpu_emulator_stats, m)
+
+#define FPU_STAT_CREATE(m)                                             \
+do {                                                                   \
+       d = debugfs_create_file(#m , S_IRUGO, dir,                      \
+                               (void *)FPU_EMU_STAT_OFFSET(m),         \
+                               &fops_fpuemu_stat);                     \
+       if (!d)                                                         \
+               return -ENOMEM;                                         \
+} while (0)
 
        FPU_STAT_CREATE(emulated);
        FPU_STAT_CREATE(loads);