On Thu, Jan 13, 2022 at 9:48 AM Nikolay Nikolov via fpc-devel <
[email protected]> wrote:
> What do other win64 compilers do? Do they generate x87 FPU code for 64-bit
> Windows?
>
Yes. Given the following:
#include <stdio.h>
long double do_three(long double x, long double y, long double z) {
return (((x * x) / y) + z);
}
int main () {
printf("%d\n", sizeof(long double));
printf("%.19Lf\n", do_three(9.4567575785454772685L,
2.1211991522332311497L, 16.1216453784376343456L));
}
GCC 11.2 produces this assembly with "gcc -O3 -march=native -S test.c" on
64-bit Windows 10:
do_three:
.seh_endprologue
fldt (%rdx)
fldt (%r8)
fldt (%r9)
fxch %st(2)
movq %rcx, %rax
fmul %st(0), %st
fdivp %st, %st(1)
faddp %st, %st(1)
fstpt (%rcx)
ret
.seh_endproc
and Clang 13.0 produces this with the same command line arguments passed:
do_three: # @do_three
# %bb.0:
movq %rcx, %rax
fldt (%rdx)
fldt (%r8)
fldt (%r9)
fxch %st(2)
fmul %st, %st(0)
fdivp %st, %st(1)
faddp %st, %st(1)
fstpt (%rcx)
retq
Running the program prints this with both compilers:
16
58.2818846964779790909
So the answer to Mattias's question about C compilers from before is "they
just directly support it on Windows".
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel