Commit cb56b360 authored by Russell King's avatar Russell King

[ARM] NWFPE 4: Eliminate getFd from CPDO worker functions.

Eliminate getFd from {Single,Double,Extended}CPDO by passing a
pointer to the destination register into these functions.  Use this
same pointer when converting the destination register to the required
type.
parent 2c64aea4
......@@ -103,11 +103,11 @@ static float64 (* const monadic_double[16])(float64 rFm) =
[NRM_CODE >> 20] = float64_mvf,
};
unsigned int DoubleCPDO(const unsigned int opcode)
unsigned int DoubleCPDO(const unsigned int opcode, FPREG *rFd)
{
FPA11 *fpa11 = GET_FPA11();
float64 rFm, rFd;
unsigned int Fd, Fm, opc;
float64 rFm;
unsigned int Fm, opc;
//printk("DoubleCPDO(0x%08x)\n",opcode);
......@@ -153,7 +153,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
if (dyadic_double[opc >> 20])
{
rFd = dyadic_double[opc >> 20](rFn, rFm);
rFd->fDouble = dyadic_double[opc >> 20](rFn, rFm);
}
else
{
......@@ -164,7 +164,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
{
if (monadic_double[opc >> 20])
{
rFd = monadic_double[opc >> 20](rFm);
rFd->fDouble = monadic_double[opc >> 20](rFm);
}
else
{
......@@ -172,8 +172,5 @@ unsigned int DoubleCPDO(const unsigned int opcode)
}
}
Fd = getFd(opcode);
fpa11->fpreg[Fd].fDouble = rFd;
return 1;
}
......@@ -89,11 +89,11 @@ static floatx80 (* const monadic_extended[16])(floatx80 rFm) =
[NRM_CODE >> 20] = floatx80_mvf,
};
unsigned int ExtendedCPDO(const unsigned int opcode)
unsigned int ExtendedCPDO(const unsigned int opcode, FPREG *rFd)
{
FPA11 *fpa11 = GET_FPA11();
floatx80 rFm, rFd;
unsigned int Fd, Fm, opc;
floatx80 rFm;
unsigned int Fm, opc;
//printk("ExtendedCPDO(0x%08x)\n",opcode);
......@@ -147,7 +147,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
if (dyadic_extended[opc >> 20])
{
rFd = dyadic_extended[opc >> 20](rFn, rFm);
rFd->fExtended = dyadic_extended[opc >> 20](rFn, rFm);
}
else
{
......@@ -158,7 +158,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
{
if (monadic_extended[opc >> 20])
{
rFd = monadic_extended[opc >> 20](rFm);
rFd->fExtended = monadic_extended[opc >> 20](rFm);
}
else
{
......@@ -166,8 +166,5 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
}
}
Fd = getFd(opcode);
fpa11->fpreg[Fd].fExtended = rFd;
return 1;
}
......@@ -22,13 +22,14 @@
#include "fpa11.h"
#include "fpopcode.h"
unsigned int SingleCPDO(const unsigned int opcode);
unsigned int DoubleCPDO(const unsigned int opcode);
unsigned int ExtendedCPDO(const unsigned int opcode);
unsigned int SingleCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int DoubleCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int ExtendedCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int EmulateCPDO(const unsigned int opcode)
{
FPA11 *fpa11 = GET_FPA11();
FPREG *rFd;
unsigned int Fd, nType, nDest, nRc = 1;
//printk("EmulateCPDO(0x%08x)\n",opcode);
......@@ -59,11 +60,14 @@ unsigned int EmulateCPDO(const unsigned int opcode)
}
}
Fd = getFd(opcode);
rFd = &fpa11->fpreg[Fd];
switch (nType)
{
case typeSingle : nRc = SingleCPDO(opcode); break;
case typeDouble : nRc = DoubleCPDO(opcode); break;
case typeExtended : nRc = ExtendedCPDO(opcode); break;
case typeSingle : nRc = SingleCPDO(opcode, rFd); break;
case typeDouble : nRc = DoubleCPDO(opcode, rFd); break;
case typeExtended : nRc = ExtendedCPDO(opcode, rFd); break;
default : nRc = 0;
}
......@@ -75,40 +79,33 @@ unsigned int EmulateCPDO(const unsigned int opcode)
/* If the operation succeeded, check to see if the result in the
destination register is the correct size. If not force it
to be. */
Fd = getFd(opcode);
switch (nDest)
{
case typeSingle:
{
if (typeDouble == nType)
fpa11->fpreg[Fd].fSingle =
float64_to_float32(fpa11->fpreg[Fd].fDouble);
rFd->fSingle = float64_to_float32(rFd->fDouble);
else
fpa11->fpreg[Fd].fSingle =
floatx80_to_float32(fpa11->fpreg[Fd].fExtended);
rFd->fSingle = floatx80_to_float32(rFd->fExtended);
}
break;
case typeDouble:
{
if (typeSingle == nType)
fpa11->fpreg[Fd].fDouble =
float32_to_float64(fpa11->fpreg[Fd].fSingle);
rFd->fDouble = float32_to_float64(rFd->fSingle);
else
fpa11->fpreg[Fd].fDouble =
floatx80_to_float64(fpa11->fpreg[Fd].fExtended);
rFd->fDouble = floatx80_to_float64(rFd->fExtended);
}
break;
case typeExtended:
{
if (typeSingle == nType)
fpa11->fpreg[Fd].fExtended =
float32_to_floatx80(fpa11->fpreg[Fd].fSingle);
rFd->fExtended = float32_to_floatx80(rFd->fSingle);
else
fpa11->fpreg[Fd].fExtended =
float64_to_floatx80(fpa11->fpreg[Fd].fDouble);
rFd->fExtended = float64_to_floatx80(rFd->fDouble);
}
break;
}
......
......@@ -85,11 +85,11 @@ static float32 (* const monadic_single[16])(float32 rFm) =
[NRM_CODE >> 20] = float32_mvf,
};
unsigned int SingleCPDO(const unsigned int opcode)
unsigned int SingleCPDO(const unsigned int opcode, FPREG *rFd)
{
FPA11 *fpa11 = GET_FPA11();
float32 rFm, rFd;
unsigned int Fd, Fm, opc;
float32 rFm;
unsigned int Fm, opc;
Fm = getFm(opcode);
if (CONSTANT_FM(opcode))
......@@ -115,7 +115,7 @@ unsigned int SingleCPDO(const unsigned int opcode)
dyadic_single[opc >> 20])
{
rFn = fpa11->fpreg[Fn].fSingle;
rFd = dyadic_single[opc >> 20](rFn, rFm);
rFd->fSingle = dyadic_single[opc >> 20](rFn, rFm);
}
else
{
......@@ -126,7 +126,7 @@ unsigned int SingleCPDO(const unsigned int opcode)
{
if (monadic_single[opc >> 20])
{
rFd = monadic_single[opc >> 20](rFm);
rFd->fSingle = monadic_single[opc >> 20](rFm);
}
else
{
......@@ -134,8 +134,5 @@ unsigned int SingleCPDO(const unsigned int opcode)
}
}
Fd = getFd(opcode);
fpa11->fpreg[Fd].fSingle = rFd;
return 1;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment