PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Documentation/arm/nwfpe/NOTES

https://bitbucket.org/evzijst/gittest
#! | 29 lines | 23 code | 6 blank | 0 comment | 0 complexity | 6e5490e3fd7ce73630b782c18e9322a9 MD5 | raw file
 1There seems to be a problem with exp(double) and our emulator.  I haven't
 2been able to track it down yet.  This does not occur with the emulator
 3supplied by Russell King.
 4
 5I also found one oddity in the emulator.  I don't think it is serious but
 6will point it out.  The ARM calling conventions require floating point
 7registers f4-f7 to be preserved over a function call.  The compiler quite
 8often uses an stfe instruction to save f4 on the stack upon entry to a
 9function, and an ldfe instruction to restore it before returning.
10
11I was looking at some code, that calculated a double result, stored it in f4
12then made a function call. Upon return from the function call the number in
13f4 had been converted to an extended value in the emulator.
14
15This is a side effect of the stfe instruction.  The double in f4 had to be
16converted to extended, then stored.  If an lfm/sfm combination had been used,
17then no conversion would occur.  This has performance considerations.  The
18result from the function call and f4 were used in a multiplication.  If the
19emulator sees a multiply of a double and extended, it promotes the double to
20extended, then does the multiply in extended precision.
21
22This code will cause this problem:
23
24double x, y, z;
25z = log(x)/log(y);
26
27The result of log(x) (a double) will be calculated, returned in f0, then
28moved to f4 to preserve it over the log(y) call.  The division will be done
29in extended precision, due to the stfe instruction used to save f4 in log(y).