Are these really Windows compiler unsupported Delphi Intrinsic Routines?
Posted by jpluimers on 2019/03/19
Odd, the [WayBack/Archive.is] Delphi Intrinsic Routines – RAD Studio indicates quite a few compiler intrinsics are not available on Windows.
I wonder if this list is correct:
Routine Description DCC32 DCC64 DCCOSX DCCAARM DCCIOSARM DCCIOSARM64 DCCIOS32 System.AtomicCmpExchange AtomicCmpExchange is used for comparing and exchanging memory values. System.AtomicDecrement AtomicDecrement is used for decrementing memory values. System.AtomicExchange AtomicExchange is used for exchanging memory values. System.AtomicIncrement AtomicIncrement is used for incrementing memory values. System.BuiltInArcTan Calculates the arctangent of a given number. System.BuiltInArcTan2 Calculates the arctangent angle and quadrant of a given number. System.BuiltInCos Calculates the cosine of an angle. System.BuiltInLn Calculates the natural logarithm of a real expression. System.BuiltInLnXPlus1 Calculates the natural logarithm of (X+1). System.BuiltInLog10 Calculates log base 10. System.BuiltInLog2 Calculates log base 2. System.BuiltInSin Calculates the sine of the angle. System.BuiltInSqrt Calculates the square root of X. System.BuiltInTan Calculates the tangent of X.
Especially since this compiles fine with the DCC32 compiler:
program CompilerIntrinsicsConsoleProject; {$APPTYPE CONSOLE} {$R *.res} var I, J, K: Integer; begin System.AtomicCmpExchange(I, J, K); System.AtomicDecrement(I); System.AtomicExchange(I, J); System.AtomicIncrement(J); end.
–jeroen
rvelthuis said
The table at: http://docwiki.embarcadero.com/RADStudio/Rio/en/Delphi_Intrinsic_Routines is quite a bit different, at least right now. Only the BuiltinXXX math functions seem to be missing in most compilers, probably because these use the FPU, which is only used in Win32 and macOS32. The AtomicXXX functions exist everywhere.
David Millington said
Rudy, you’re right. There’s a comment of mine that doesn’t seem to have been approved from when this was posted. I got the docs checked and updated, and yes, the BuiltIn* methods map directly to assembly statements and so are missing when there is no FPU and so no single statement for the builtin.
rvelthuis said
I also wondered about the table when I saw it a few months ago. They all exist and they work as expected for Win32 and Win64, AFAIK. Can’t test for macOS, currently, but I doubt they are not implemented for the Mac (Mac on Intel and Win32 assembler are quite similar).