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) = ...@@ -103,11 +103,11 @@ static float64 (* const monadic_double[16])(float64 rFm) =
[NRM_CODE >> 20] = float64_mvf, [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(); FPA11 *fpa11 = GET_FPA11();
float64 rFm, rFd; float64 rFm;
unsigned int Fd, Fm, opc; unsigned int Fm, opc;
//printk("DoubleCPDO(0x%08x)\n",opcode); //printk("DoubleCPDO(0x%08x)\n",opcode);
...@@ -153,7 +153,7 @@ unsigned int DoubleCPDO(const unsigned int opcode) ...@@ -153,7 +153,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
if (dyadic_double[opc >> 20]) if (dyadic_double[opc >> 20])
{ {
rFd = dyadic_double[opc >> 20](rFn, rFm); rFd->fDouble = dyadic_double[opc >> 20](rFn, rFm);
} }
else else
{ {
...@@ -164,7 +164,7 @@ unsigned int DoubleCPDO(const unsigned int opcode) ...@@ -164,7 +164,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
{ {
if (monadic_double[opc >> 20]) if (monadic_double[opc >> 20])
{ {
rFd = monadic_double[opc >> 20](rFm); rFd->fDouble = monadic_double[opc >> 20](rFm);
} }
else else
{ {
...@@ -172,8 +172,5 @@ unsigned int DoubleCPDO(const unsigned int opcode) ...@@ -172,8 +172,5 @@ unsigned int DoubleCPDO(const unsigned int opcode)
} }
} }
Fd = getFd(opcode);
fpa11->fpreg[Fd].fDouble = rFd;
return 1; return 1;
} }
...@@ -89,11 +89,11 @@ static floatx80 (* const monadic_extended[16])(floatx80 rFm) = ...@@ -89,11 +89,11 @@ static floatx80 (* const monadic_extended[16])(floatx80 rFm) =
[NRM_CODE >> 20] = floatx80_mvf, [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(); FPA11 *fpa11 = GET_FPA11();
floatx80 rFm, rFd; floatx80 rFm;
unsigned int Fd, Fm, opc; unsigned int Fm, opc;
//printk("ExtendedCPDO(0x%08x)\n",opcode); //printk("ExtendedCPDO(0x%08x)\n",opcode);
...@@ -147,7 +147,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode) ...@@ -147,7 +147,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
if (dyadic_extended[opc >> 20]) if (dyadic_extended[opc >> 20])
{ {
rFd = dyadic_extended[opc >> 20](rFn, rFm); rFd->fExtended = dyadic_extended[opc >> 20](rFn, rFm);
} }
else else
{ {
...@@ -158,7 +158,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode) ...@@ -158,7 +158,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
{ {
if (monadic_extended[opc >> 20]) if (monadic_extended[opc >> 20])
{ {
rFd = monadic_extended[opc >> 20](rFm); rFd->fExtended = monadic_extended[opc >> 20](rFm);
} }
else else
{ {
...@@ -166,8 +166,5 @@ unsigned int ExtendedCPDO(const unsigned int opcode) ...@@ -166,8 +166,5 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
} }
} }
Fd = getFd(opcode);
fpa11->fpreg[Fd].fExtended = rFd;
return 1; return 1;
} }
...@@ -22,13 +22,14 @@ ...@@ -22,13 +22,14 @@
#include "fpa11.h" #include "fpa11.h"
#include "fpopcode.h" #include "fpopcode.h"
unsigned int SingleCPDO(const unsigned int opcode); unsigned int SingleCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int DoubleCPDO(const unsigned int opcode); unsigned int DoubleCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int ExtendedCPDO(const unsigned int opcode); unsigned int ExtendedCPDO(const unsigned int opcode, FPREG *rfd);
unsigned int EmulateCPDO(const unsigned int opcode) unsigned int EmulateCPDO(const unsigned int opcode)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
FPREG *rFd;
unsigned int Fd, nType, nDest, nRc = 1; unsigned int Fd, nType, nDest, nRc = 1;
//printk("EmulateCPDO(0x%08x)\n",opcode); //printk("EmulateCPDO(0x%08x)\n",opcode);
...@@ -59,11 +60,14 @@ unsigned int EmulateCPDO(const unsigned int opcode) ...@@ -59,11 +60,14 @@ unsigned int EmulateCPDO(const unsigned int opcode)
} }
} }
Fd = getFd(opcode);
rFd = &fpa11->fpreg[Fd];
switch (nType) switch (nType)
{ {
case typeSingle : nRc = SingleCPDO(opcode); break; case typeSingle : nRc = SingleCPDO(opcode, rFd); break;
case typeDouble : nRc = DoubleCPDO(opcode); break; case typeDouble : nRc = DoubleCPDO(opcode, rFd); break;
case typeExtended : nRc = ExtendedCPDO(opcode); break; case typeExtended : nRc = ExtendedCPDO(opcode, rFd); break;
default : nRc = 0; default : nRc = 0;
} }
...@@ -75,40 +79,33 @@ unsigned int EmulateCPDO(const unsigned int opcode) ...@@ -75,40 +79,33 @@ unsigned int EmulateCPDO(const unsigned int opcode)
/* If the operation succeeded, check to see if the result in the /* If the operation succeeded, check to see if the result in the
destination register is the correct size. If not force it destination register is the correct size. If not force it
to be. */ to be. */
Fd = getFd(opcode);
switch (nDest) switch (nDest)
{ {
case typeSingle: case typeSingle:
{ {
if (typeDouble == nType) if (typeDouble == nType)
fpa11->fpreg[Fd].fSingle = rFd->fSingle = float64_to_float32(rFd->fDouble);
float64_to_float32(fpa11->fpreg[Fd].fDouble);
else else
fpa11->fpreg[Fd].fSingle = rFd->fSingle = floatx80_to_float32(rFd->fExtended);
floatx80_to_float32(fpa11->fpreg[Fd].fExtended);
} }
break; break;
case typeDouble: case typeDouble:
{ {
if (typeSingle == nType) if (typeSingle == nType)
fpa11->fpreg[Fd].fDouble = rFd->fDouble = float32_to_float64(rFd->fSingle);
float32_to_float64(fpa11->fpreg[Fd].fSingle);
else else
fpa11->fpreg[Fd].fDouble = rFd->fDouble = floatx80_to_float64(rFd->fExtended);
floatx80_to_float64(fpa11->fpreg[Fd].fExtended);
} }
break; break;
case typeExtended: case typeExtended:
{ {
if (typeSingle == nType) if (typeSingle == nType)
fpa11->fpreg[Fd].fExtended = rFd->fExtended = float32_to_floatx80(rFd->fSingle);
float32_to_floatx80(fpa11->fpreg[Fd].fSingle);
else else
fpa11->fpreg[Fd].fExtended = rFd->fExtended = float64_to_floatx80(rFd->fDouble);
float64_to_floatx80(fpa11->fpreg[Fd].fDouble);
} }
break; break;
} }
......
...@@ -85,11 +85,11 @@ static float32 (* const monadic_single[16])(float32 rFm) = ...@@ -85,11 +85,11 @@ static float32 (* const monadic_single[16])(float32 rFm) =
[NRM_CODE >> 20] = float32_mvf, [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(); FPA11 *fpa11 = GET_FPA11();
float32 rFm, rFd; float32 rFm;
unsigned int Fd, Fm, opc; unsigned int Fm, opc;
Fm = getFm(opcode); Fm = getFm(opcode);
if (CONSTANT_FM(opcode)) if (CONSTANT_FM(opcode))
...@@ -115,7 +115,7 @@ unsigned int SingleCPDO(const unsigned int opcode) ...@@ -115,7 +115,7 @@ unsigned int SingleCPDO(const unsigned int opcode)
dyadic_single[opc >> 20]) dyadic_single[opc >> 20])
{ {
rFn = fpa11->fpreg[Fn].fSingle; rFn = fpa11->fpreg[Fn].fSingle;
rFd = dyadic_single[opc >> 20](rFn, rFm); rFd->fSingle = dyadic_single[opc >> 20](rFn, rFm);
} }
else else
{ {
...@@ -126,7 +126,7 @@ unsigned int SingleCPDO(const unsigned int opcode) ...@@ -126,7 +126,7 @@ unsigned int SingleCPDO(const unsigned int opcode)
{ {
if (monadic_single[opc >> 20]) if (monadic_single[opc >> 20])
{ {
rFd = monadic_single[opc >> 20](rFm); rFd->fSingle = monadic_single[opc >> 20](rFm);
} }
else else
{ {
...@@ -134,8 +134,5 @@ unsigned int SingleCPDO(const unsigned int opcode) ...@@ -134,8 +134,5 @@ unsigned int SingleCPDO(const unsigned int opcode)
} }
} }
Fd = getFd(opcode);
fpa11->fpreg[Fd].fSingle = rFd;
return 1; 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