[fpc-devel] Detecting SSE and AVX compiler options

J. Gareth Moreton gareth at moreton-family.com
Sun Feb 3 21:52:56 CET 2019


 It just seems highly dependent on the source code and can easily break if
it's changed... and not just the Floor function, but also possibly if Trunc
and Frac are modified in some way.  The code does boil down to two
instructions in SSE 4.1 and AVX, but it depends on many different nodes
with an exact arrangement, and if something is changed (but still
functionally equivalent), the optimisation will break.

 Adding a platform-specific internal function and having floor() point to
it on said platform is probably out of the question, although will help
alleviate some of the dependencies.  This is actually an interesting
conundrum.
 Gareth aka. Kit

 On Sun 03/02/19 21:44 , Florian Klämpfl florian at freepascal.org sent:
 Am 03.02.19 um 22:29 schrieb Jonas Maebe: 
 > On 03/02/19 21:26, J. Gareth Moreton wrote: 
 >> One thing that I should ask though... if a unit like Math is compiled 
 >> with -fAVX, then another project that uses it is built without any 
 >> special floating-point types, is Math recompiled or will it use the 
 >> code already built, thereby possibly putting AVX code into a non-AVX 
 >> project? 
 > 
 > The latter. 

 This is why I proposed to use inlining, especially as it seems to boil 
 down to two instructions. 

 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [1] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel 

 

Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190203/4b39dc35/attachment.html>


More information about the fpc-devel mailing list