[fpc-devel] What exactly are the differences in what each of the "-Cp", "-Cf", and "-Op" command line flags enable as far as optimizations?
operator97 at gmail.com
Wed Sep 9 15:33:21 CEST 2020
Thanks a lot for the explanation, that's very helpful!
On Mon, Sep 7, 2020 at 9:02 PM J. Gareth Moreton via fpc-devel <
fpc-devel at lists.freepascal.org> wrote:
> 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 at lists.freepascal.orghttps://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free.
> fpc-devel maillist - fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel