<div dir="ltr"><div>Thanks a lot for the explanation, that's very helpful!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 7, 2020 at 9:02 PM J. Gareth Moreton via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>The gist of it is that you're specifying the earliest CPU that
your program will run on (if it runs on an older CPU, it might
crash with SIGILL). -Cp dictates the instruction set version used
overall, while -Cf specifies the family of floating-point
instructions that will be used. Later versions of SSE have better
rounding functions, for example, although I think it's more
applicable to i386 where the older floating-point stack is used by
default. <br>
</p>
<p>Generally you'd set -Cp and -Op to the same value, and I think
-Op is set to match -Cp if it's omitted. I might need Florian to
confirm though. I have programmed one or two optimisations that
depend on the value of -Op - the one that springs to mind is where
a group of MOV instructions are morphed into an XCHG instruction -
XCHG is slower than the 3 MOV instructions until relatively
recently, so it won't perform this optimisation by default unless
optimising for size or if -Op is set to a particular value (I
think at least "CoreI").</p>
<p>When vectorisation starts making a proper appearance in the
compiler, I'll be very likely developing optimisations for fused
multiply-add (FMA), which only came about after AVX.<br>
</p>
<p>Gareth aka. Kit<br>
</p>
<div>On 08/09/2020 00:03, Ben Grasset via
fpc-devel wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">For example, a valid FPC command line would be:
<div><br>
</div>
<div>fpc -O3 -CfAVX2 -CpCOREAVX2 -OpCOREAVX2 file.pas</div>
<div><br>
</div>
<div>To what extent is each of those flags enabling the
generation of AVX2 instructions? Are they all necessary, or
does their functionality overlap to some degree? Which is most
important?</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="gmail-m_-4071735898273218845DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid rgb(211,212,222)">
<tbody><tr>
<td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
<td style="width:470px;padding-top:12px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" style="color:rgb(68,83,234)" target="_blank">www.avast.com</a>
</td>
</tr>
</tbody></table><a href="#m_-4071735898273218845_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></div>
_______________________________________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
</blockquote></div></div>