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