0

Following my previous question (I assume that 64-bit compiler uses only SSE instructions for floating point calculations):

  • How transcendental math functions (sin, atan, exp, log, etc.) are implemented in 64-bit Delphi compiler? AFAIK there are no SSE hardware implementations. What software library is used, what about the performance and accuracy compared with the current FPU hardware implementation?

See also

Community
  • 1
  • 1
kludg
  • 27,213
  • 5
  • 67
  • 118

1 Answers1

2

Obviously, nobody except for Embarcadero can answer this for sure before the product is released.

It is very likely that any decent x64 compiler will use the SSE2 instruction set as a baseline and therefore attempt to do as much floating point computation using SSE features as possible, minimising the use of the x87 FPU. However, it should also be said that there is no technical reason that would prevent the use of the x87 FPU in x64 application code (despite rumours to the contrary which have been around for some time; if you want more info on that point, please have a look at Agner Fog's Calling Convention Manual, specifically chapter 6.1 "Can floating point registers be used in 64-bit Windows?").

PhiS
  • 4,540
  • 25
  • 35
  • Allen Bauer (Embarcadero) twittered that Extended=Double on x64 (same as in .NET) http://www.delphifeeds.com/go/s/73529 because of x64 calling conventions and 64-bit alignment issues. – Jeroen Wiert Pluimers Nov 02 '10 at 19:27
  • 1
    @Jeroen - but there's nothing in the ABI/calling convention preventing you from passing 80-bit values; if a parameter doesn't fit the registers (max. 64-bits), the recommendation is that it be passed by reference. Re. alignment - AFAIK most of the compilers that support 80-bit floats on x64 align them to 16byte boundaries. Delphi could do the same. Hence, these aren't really issues that technically prevent Embarcadero from implementing 80bit FP math. – PhiS Nov 03 '10 at 11:41
  • If I remember correctly, there is some sharing of the FPU stack or registers, and the other registers. I know for sure that was so in the MMX world. If that is still so in the x64 world, it will make this very difficult. This apart from potentially supporting other processor architectures that do not even have support this 80-bit data type. By omitting it in the first 64-bit implementation, they set a base-line but leave the option open for introduction of 80-bit floating point support in the future. – Jeroen Wiert Pluimers Nov 03 '10 at 11:59
  • 1
    @Jeroen - FPU x87 and MMX registers are shared, true. But MMX registers aren't used in the Win64 calling convention, and IIRC their state is supposed to be cleared (EMMS instruction), i.e. FPU mode, not MMX mode. there's no register sharing among x87 and XMM regs, the latter of which are used for parameter transfer. Also, AFAIK there isn't any x64 CPU without x87 FPU. (Intel even introduced a new x87 instruction with the SSE3 instruction set, so I presume Intel don't consider the x87 deprecated.) I really do hope that they will support 80-bits though. – PhiS Nov 03 '10 at 12:52
  • @PhiS: thanks for all the info; make sure that both Allen Bauer and Barry Kelly know about this too. – Jeroen Wiert Pluimers Nov 03 '10 at 19:02
  • @Jeroen - Cheers, trying my best. – PhiS Nov 04 '10 at 07:53