NOTES 1.4 KB

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