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

[NWFPE] performance improvements [Part 6]

NWFPE performance improvements, part 6.  Builds on patch 1468/1.

Break NWFPE initialization into separate function and call it from
entry.S as appropriate.  Also avoid nRc variable usage in EmulateAll().
This buys 6% speedup in NWFPE.  (Note that this is over half of the
total speedup between original RMK and the netwinder cvs version).

(note that 2.5 already has the separate initialisation, and this
cset actually makes 2.5 conform to 2.4 function naming for this
part. --rmk)
parent 50ddb9ba
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
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. * Consolidated use of (opcode && MASK_ARITHMETIC_OPCODE) >> 20.
* Make 80-bit precision a compile-time option. * Make 80-bit precision a compile-time option. (1%)
* Only initialize FPE state once in repeat-FP situations. (6%)
2002-01-19 Russell King <rmk@arm.linux.org.uk> 2002-01-19 Russell King <rmk@arm.linux.org.uk>
......
...@@ -94,9 +94,12 @@ void SetRoundingPrecision(const unsigned int opcode) ...@@ -94,9 +94,12 @@ void SetRoundingPrecision(const unsigned int opcode)
#endif #endif
} }
void nwfpe_init(union fp_state *fp) void nwfpe_init_fpa(union fp_state *fp)
{ {
FPA11 *fpa11 = (FPA11 *)fp; FPA11 *fpa11 = (FPA11 *)fp;
#ifdef NWFPE_DEBUG
printk("NWFPE: setting up state.\n");
#endif
memset(fpa11, 0, sizeof(FPA11)); memset(fpa11, 0, sizeof(FPA11));
resetFPA11(); resetFPA11();
SetRoundingMode(ROUND_TO_NEAREST); SetRoundingMode(ROUND_TO_NEAREST);
...@@ -107,8 +110,11 @@ void nwfpe_init(union fp_state *fp) ...@@ -107,8 +110,11 @@ void nwfpe_init(union fp_state *fp)
/* Emulate the instruction in the opcode. */ /* Emulate the instruction in the opcode. */
unsigned int EmulateAll(unsigned int opcode) unsigned int EmulateAll(unsigned int opcode)
{ {
unsigned int nRc = 1, code; unsigned int code;
#ifdef NWFPE_DEBUG
printk("NWFPE: emulating opcode %08x\n", opcode);
#endif
code = opcode & 0x00000f00; code = opcode & 0x00000f00;
if (code == 0x00000100 || code == 0x00000200) { if (code == 0x00000100 || code == 0x00000200) {
/* For coprocessor 1 or 2 (FPA11) */ /* For coprocessor 1 or 2 (FPA11) */
...@@ -118,21 +124,19 @@ unsigned int EmulateAll(unsigned int opcode) ...@@ -118,21 +124,19 @@ unsigned int EmulateAll(unsigned int opcode)
/* Emulate conversion opcodes. */ /* Emulate conversion opcodes. */
/* Emulate register transfer opcodes. */ /* Emulate register transfer opcodes. */
/* Emulate comparison opcodes. */ /* Emulate comparison opcodes. */
nRc = EmulateCPRT(opcode); return EmulateCPRT(opcode);
} else { } else {
/* Emulate monadic arithmetic opcodes. */ /* Emulate monadic arithmetic opcodes. */
/* Emulate dyadic arithmetic opcodes. */ /* Emulate dyadic arithmetic opcodes. */
nRc = EmulateCPDO(opcode); return EmulateCPDO(opcode);
} }
} else if (code == 0x0c000000) { } else if (code == 0x0c000000) {
/* Emulate load/store opcodes. */ /* Emulate load/store opcodes. */
/* Emulate load/store multiple opcodes. */ /* Emulate load/store multiple opcodes. */
nRc = EmulateCPDT(opcode); return EmulateCPDT(opcode);
} else {
/* Invalid instruction detected. Return FALSE. */
nRc = 0;
} }
} }
return (nRc); /* Invalid instruction detected. Return FALSE. */
return 0;
} }
...@@ -87,6 +87,6 @@ typedef struct tagFPA11 { ...@@ -87,6 +87,6 @@ typedef struct tagFPA11 {
extern void SetRoundingMode(const unsigned int); extern void SetRoundingMode(const unsigned int);
extern void SetRoundingPrecision(const unsigned int); extern void SetRoundingPrecision(const unsigned int);
extern void nwfpe_init(union fp_state *fp); extern void nwfpe_init_fpa(union fp_state *fp);
#endif #endif
...@@ -98,7 +98,7 @@ static int __init fpe_init(void) ...@@ -98,7 +98,7 @@ static int __init fpe_init(void)
orig_fp_enter = kern_fp_enter; orig_fp_enter = kern_fp_enter;
orig_fp_init = fp_init; orig_fp_init = fp_init;
kern_fp_enter = nwfpe_enter; kern_fp_enter = nwfpe_enter;
fp_init = nwfpe_init; fp_init = nwfpe_init_fpa;
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