aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfpdouble.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/vfp/vfpdouble.c')
-rw-r--r--arch/arm/vfp/vfpdouble.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 9b367a65cb4d..febd115dba28 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -588,6 +588,7 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
588 struct vfp_double vdm; 588 struct vfp_double vdm;
589 u32 d, exceptions = 0; 589 u32 d, exceptions = 0;
590 int rmode = fpscr & FPSCR_RMODE_MASK; 590 int rmode = fpscr & FPSCR_RMODE_MASK;
591 int tm;
591 592
592 vfp_double_unpack(&vdm, vfp_get_double(dm)); 593 vfp_double_unpack(&vdm, vfp_get_double(dm));
593 vfp_double_dump("VDM", &vdm); 594 vfp_double_dump("VDM", &vdm);
@@ -595,10 +596,14 @@ static u32 vfp_double_ftosi(int sd, int unused, int dm, u32 fpscr)
595 /* 596 /*
596 * Do we have denormalised number? 597 * Do we have denormalised number?
597 */ 598 */
598 if (vfp_double_type(&vdm) & VFP_DENORMAL) 599 tm = vfp_double_type(&vdm);
600 if (tm & VFP_DENORMAL)
599 exceptions |= FPSCR_IDC; 601 exceptions |= FPSCR_IDC;
600 602
601 if (vdm.exponent >= 1023 + 32) { 603 if (tm & VFP_NAN) {
604 d = 0;
605 exceptions |= FPSCR_IOC;
606 } else if (vdm.exponent >= 1023 + 32) {
602 d = 0x7fffffff; 607 d = 0x7fffffff;
603 if (vdm.sign) 608 if (vdm.sign)
604 d = ~d; 609 d = ~d;
@@ -1122,9 +1127,9 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1122{ 1127{
1123 u32 op = inst & FOP_MASK; 1128 u32 op = inst & FOP_MASK;
1124 u32 exceptions = 0; 1129 u32 exceptions = 0;
1125 unsigned int dd = vfp_get_sd(inst); 1130 unsigned int dd = vfp_get_dd(inst);
1126 unsigned int dn = vfp_get_sn(inst); 1131 unsigned int dn = vfp_get_dn(inst);
1127 unsigned int dm = vfp_get_sm(inst); 1132 unsigned int dm = vfp_get_dm(inst);
1128 unsigned int vecitr, veclen, vecstride; 1133 unsigned int vecitr, veclen, vecstride;
1129 u32 (*fop)(int, int, s32, u32); 1134 u32 (*fop)(int, int, s32, u32);
1130 1135
@@ -1141,7 +1146,7 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1141 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride, 1146 pr_debug("VFP: vecstride=%u veclen=%u\n", vecstride,
1142 (veclen >> FPSCR_LENGTH_BIT) + 1); 1147 (veclen >> FPSCR_LENGTH_BIT) + 1);
1143 1148
1144 fop = (op == FOP_EXT) ? fop_extfns[dn] : fop_fns[FOP_TO_IDX(op)]; 1149 fop = (op == FOP_EXT) ? fop_extfns[FEXT_TO_IDX(inst)] : fop_fns[FOP_TO_IDX(op)];
1145 if (!fop) 1150 if (!fop)
1146 goto invalid; 1151 goto invalid;
1147 1152
@@ -1149,17 +1154,13 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1149 u32 except; 1154 u32 except;
1150 1155
1151 if (op == FOP_EXT) 1156 if (op == FOP_EXT)
1152 pr_debug("VFP: itr%d (d%u.%u) = op[%u] (d%u.%u)\n", 1157 pr_debug("VFP: itr%d (d%u) = op[%u] (d%u)\n",
1153 vecitr >> FPSCR_LENGTH_BIT, 1158 vecitr >> FPSCR_LENGTH_BIT,
1154 dd >> 1, dd & 1, dn, 1159 dd, dn, dm);
1155 dm >> 1, dm & 1);
1156 else 1160 else
1157 pr_debug("VFP: itr%d (d%u.%u) = (d%u.%u) op[%u] (d%u.%u)\n", 1161 pr_debug("VFP: itr%d (d%u) = (d%u) op[%u] (d%u)\n",
1158 vecitr >> FPSCR_LENGTH_BIT, 1162 vecitr >> FPSCR_LENGTH_BIT,
1159 dd >> 1, dd & 1, 1163 dd, dn, FOP_TO_IDX(op), dm);
1160 dn >> 1, dn & 1,
1161 FOP_TO_IDX(op),
1162 dm >> 1, dm & 1);
1163 1164
1164 except = fop(dd, dn, dm, fpscr); 1165 except = fop(dd, dn, dm, fpscr);
1165 pr_debug("VFP: itr%d: exceptions=%08x\n", 1166 pr_debug("VFP: itr%d: exceptions=%08x\n",