Commit a64e20ce authored by Ralph Siemsen's avatar Ralph Siemsen Committed by Russell King

[PATCH] performance improvements [Part 3]

NWFPE performance improvements, part three.

A minor simplification - as (opcode & MASK_ARITHMETIC_OPCODE) >> 20
is frequently used, compute that quantity once and store it.
parent 5f7d2c16
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Reformat all but softfloat files to get a consistent coding style. * Reformat all but softfloat files to get a consistent coding style.
Used "indent -kr -i8 -ts8 -sob -l132 -ss" and a few manual fixups. Used "indent -kr -i8 -ts8 -sob -l132 -ss" and a few manual fixups.
* Removed dead code and fixed function protypes to match definitions. * Removed dead code and fixed function protypes to match definitions.
* Consolidated use of (opcode && MASK_ARITHMETIC_OPCODE) >> 20.
2002-01-19 Russell King <rmk@arm.linux.org.uk> 2002-01-19 Russell King <rmk@arm.linux.org.uk>
......
...@@ -104,9 +104,7 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -104,9 +104,7 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
float64 rFm; float64 rFm;
unsigned int Fm, opc; unsigned int Fm, opc_mask_shift;
//printk("DoubleCPDO(0x%08x)\n",opcode);
Fm = getFm(opcode); Fm = getFm(opcode);
if (CONSTANT_FM(opcode)) { if (CONSTANT_FM(opcode)) {
...@@ -126,7 +124,7 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -126,7 +124,7 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd)
} }
} }
opc = opcode & MASK_ARITHMETIC_OPCODE; opc_mask_shift = (opcode & MASK_ARITHMETIC_OPCODE) >> 20;
if (!MONADIC_INSTRUCTION(opcode)) { if (!MONADIC_INSTRUCTION(opcode)) {
unsigned int Fn = getFn(opcode); unsigned int Fn = getFn(opcode);
float64 rFn; float64 rFn;
...@@ -144,14 +142,14 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -144,14 +142,14 @@ unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd)
return 0; return 0;
} }
if (dyadic_double[opc >> 20]) { if (dyadic_double[opc_mask_shift]) {
rFd->fDouble = dyadic_double[opc >> 20](rFn, rFm); rFd->fDouble = dyadic_double[opc_mask_shift](rFn, rFm);
} else { } else {
return 0; return 0;
} }
} else { } else {
if (monadic_double[opc >> 20]) { if (monadic_double[opc_mask_shift]) {
rFd->fDouble = monadic_double[opc >> 20](rFm); rFd->fDouble = monadic_double[opc_mask_shift](rFm);
} else { } else {
return 0; return 0;
} }
......
...@@ -91,9 +91,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -91,9 +91,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
floatx80 rFm; floatx80 rFm;
unsigned int Fm, opc; unsigned int Fm, opc_mask_shift;
//printk("ExtendedCPDO(0x%08x)\n",opcode);
Fm = getFm(opcode); Fm = getFm(opcode);
if (CONSTANT_FM(opcode)) { if (CONSTANT_FM(opcode)) {
...@@ -117,7 +115,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -117,7 +115,7 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd)
} }
} }
opc = opcode & MASK_ARITHMETIC_OPCODE; opc_mask_shift = (opcode & MASK_ARITHMETIC_OPCODE) >> 20;
if (!MONADIC_INSTRUCTION(opcode)) { if (!MONADIC_INSTRUCTION(opcode)) {
unsigned int Fn = getFn(opcode); unsigned int Fn = getFn(opcode);
floatx80 rFn; floatx80 rFn;
...@@ -139,14 +137,14 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -139,14 +137,14 @@ unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd)
return 0; return 0;
} }
if (dyadic_extended[opc >> 20]) { if (dyadic_extended[opc_mask_shift]) {
rFd->fExtended = dyadic_extended[opc >> 20](rFn, rFm); rFd->fExtended = dyadic_extended[opc_mask_shift](rFn, rFm);
} else { } else {
return 0; return 0;
} }
} else { } else {
if (monadic_extended[opc >> 20]) { if (monadic_extended[opc_mask_shift]) {
rFd->fExtended = monadic_extended[opc >> 20](rFm); rFd->fExtended = monadic_extended[opc_mask_shift](rFm);
} else { } else {
return 0; return 0;
} }
......
/* /*
NetWinder Floating Point Emulator NetWinder Floating Point Emulator
(c) Rebel.COM, 1998,1999 (c) Rebel.COM, 1998,1999
(c) Philip Blundell, 2001
Direct questions, comments to Scott Bambrough <scottb@netwinder.org> Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
...@@ -88,7 +89,7 @@ unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -88,7 +89,7 @@ unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
float32 rFm; float32 rFm;
unsigned int Fm, opc; unsigned int Fm, opc_mask_shift;
Fm = getFm(opcode); Fm = getFm(opcode);
if (CONSTANT_FM(opcode)) { if (CONSTANT_FM(opcode)) {
...@@ -99,20 +100,21 @@ unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd) ...@@ -99,20 +100,21 @@ unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd)
return 0; return 0;
} }
opc = opcode & MASK_ARITHMETIC_OPCODE; opc_mask_shift = (opcode & MASK_ARITHMETIC_OPCODE) >> 20;
if (!MONADIC_INSTRUCTION(opcode)) { if (!MONADIC_INSTRUCTION(opcode)) {
unsigned int Fn = getFn(opcode); unsigned int Fn = getFn(opcode);
float32 rFn; float32 rFn;
if (fpa11->fType[Fn] == typeSingle && dyadic_single[opc >> 20]) { if (fpa11->fType[Fn] == typeSingle &&
dyadic_single[opc_mask_shift]) {
rFn = fpa11->fpreg[Fn].fSingle; rFn = fpa11->fpreg[Fn].fSingle;
rFd->fSingle = dyadic_single[opc >> 20](rFn, rFm); rFd->fSingle = dyadic_single[opc_mask_shift](rFn, rFm);
} else { } else {
return 0; return 0;
} }
} else { } else {
if (monadic_single[opc >> 20]) { if (monadic_single[opc_mask_shift]) {
rFd->fSingle = monadic_single[opc >> 20](rFm); rFd->fSingle = monadic_single[opc_mask_shift](rFm);
} else { } else {
return 0; return 0;
} }
......
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