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