[fpc-devel] Detecting SSE and AVX compiler options

J. Gareth Moreton gareth at moreton-family.com
Sun Feb 3 06:26:13 CET 2019


 Hi everyone,

 So I'm looking to improve some of the mathematical routines.  However,
not all of them are internal functions and are stored in the Math unit.. 
Some of them are written in assembly language but use the old
floating-point stack, or use a slow hack when there's a good alternative
available in SSE 4.1, for example, and I would like to see about rewriting
some of these functions for x86_64.  However, while I can safely assume
the presence of SSE2 on this architecture, what's the best way to detect if
"-iCOREAVX" etc are specified?  Also, if "-iCOREAVX", does it
automatically set "-fAVX" as well?  I rather make sure I'm not making
incorrect assumptions before I start writing assembly language routines.

 As an example of a function that can benefit from a speed-up under
x86_64... the floor() and floor64() functions:
 function floor64(x: float): Int64;
   begin
     Result:=Trunc(x)-ord(Frac(x)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190203/52ee0d67/attachment.html>


More information about the fpc-devel mailing list