View Issue Details

IDProjectCategoryView StatusLast Update
0037905FPCCompilerpublic2020-10-12 11:38
ReporterKlaus1 Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionduplicate 
Product Version3.2.0 
Summary0037905: datatype extended is casted of double in Win64 give haevy error by Float to string when FPU87 10 byte
DescriptionHello,
for a tool I must convert the native FPU 10 byte value in a string. But is not posibility, there the Extended is castrated to Double. When I save the status with XSAVE the FPU values are in 10 byte values and for display need as string.
In system -> {$ifdef FPC_HAS_TYPE_EXTENDED}
  { win64 doesn't support the legacy fpu }
That is a very old story. It is true ONLY FOR KERNEL DRIVER in Win64. Please read the microsoft documentation.
That is a heavy error. Extended must are 10 byte and not Double. Please correct this in the next compiler version.
Regards Klaus
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Relationships

duplicate of 0034378 resolvedJonas Maebe Compiler understands type "Extended" as "Double". 

Activities

Florian

2020-10-10 09:50

administrator   ~0126203

The bug tracker allows to add URL.

Jonas Maebe

2020-10-10 11:16

manager   ~0126207

https://docs.microsoft.com/en-us/windows/win32/dxtecharts/sixty-four-bit-programming-for-game-developers#compatibility-of-32-bit-applications-on-64-bit-platforms

"The x87, MMX, and 3DNow! instruction sets are deprecated in 64-bit modes. The instructions sets are still present for backward compatibility for 32-bit mode; however, to avoid compatibility issues in the future, their use in current and future projects is discouraged."

nanobit

2020-10-10 12:18

reporter   ~0126212

The situation is as follows:
1) x87 usage can be Win64 ABI-compliant, but is officially deprecated for up to double-precision.
Support of 80bit would mean: SSE for single/double, FPU x87 for 80bit.
Some compilers (unlike MSVC) support this. But support could be much broader with softFPU.
2) The x87 support by Windows is specified in the current Win64 ABI:
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019
Example of usage: https://sourceforge.net/p/biop/git/ci/master/tree/uTExtendedX87.pas
3) The support of hardware FPU will not disappear before emulators step in.
Thus, software can assume FPU x87 is available. Without official x87 deprecation notice,
Microsoft has to ensure support, because the removal would break many apps produced by different compilers.
The web contains deprecation-comments from old times when the MS Win64 ABI about x87 was not stable yet.

My conclusion: It would be nice to have a softFPU for 80bit and larger.

Klaus1

2020-10-10 17:31

reporter   ~0126218

Hello,
the FPU x87 format is (IEEE754 double extended) format with 80 bit. The FPU use this INTERN for all calculations and is is posibility this
value to save in memory for lather. Wenn I use the assembler order XSAVE all the FPU value will saved in memory. It is not deprecated and is used
in many programs. For a convert the binary of 10 byte the compiler has FloatToString routines. When but the compiler extended to double castrated
this routines give a mistake. That is was I will. The FloatToString routines sould work with this format. I think it is the dream of Microsoft not
interes of the use the FPU, unix et al have not problems...
Apropros the FPU compiler give it for DOS and that is very depreceated and so should also the FPU in Win64 normal function.
In the article "calling conventions" (pkt.6.1) is a good discus of use the FPU in Win64. Found in https://www.agner.org/optimize see 5
Regards Klaus.

nanobit

2020-10-10 17:51

reporter   ~0126219

Klaus1, I meant deprecated for up to double-precision in the sense of efficiency.
Win32 apps and win64 apps can use the same x87 functionality, but only if the compiler supports this.

Sven Barth

2020-10-10 23:46

manager   ~0126230

Considering that Microsoft's official C(++) compiler does not allow access to 80-bit precision floating point type without resorting to assembly plus everyone nowadays only working with 64-bit precision floating point types (especially on non-x86 platforms, but also due to SSE and friends) I'd say just forget the Extended type. If you need it, use the SoftFPU unit.

Issue History

Date Modified Username Field Change
2020-10-10 09:42 Klaus1 New Issue
2020-10-10 09:50 Florian Status new => feedback
2020-10-10 09:50 Florian FPCTarget => -
2020-10-10 09:50 Florian Note Added: 0126203
2020-10-10 11:16 Jonas Maebe Note Added: 0126207
2020-10-10 12:18 nanobit Note Added: 0126212
2020-10-10 17:31 Klaus1 Note Added: 0126218
2020-10-10 17:31 Klaus1 Status feedback => new
2020-10-10 17:51 nanobit Note Added: 0126219
2020-10-10 23:46 Sven Barth Note Added: 0126230
2020-10-11 21:19 Florian Assigned To => Florian
2020-10-11 21:19 Florian Status new => resolved
2020-10-11 21:19 Florian Resolution open => duplicate
2020-10-11 21:19 Florian Fixed in Revision => 34378
2020-10-12 11:37 Sven Barth Relationship added duplicate of 0034378
2020-10-12 11:38 Sven Barth Fixed in Revision 34378 =>