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.

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").

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.

Gareth aka. Kit

On 08/09/2020 00:03, Ben Grasset via fpc-devel wrote:
For example, a valid FPC command line would be:

fpc -O3 -CfAVX2 -CpCOREAVX2 -OpCOREAVX2 file.pas

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?

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to