Jonas Maebe via fpc-devel wrote:
On 09/12/2023 10:07, Adriaan van Os via fpc-devel wrote:

Another question. Is there a way to put pragmas in fpc source code to be passed to CLang, eg. those mentioned here <https://llvm.org/docs/Vectorizers.html> ? That would gain a lot, at little cost.

No. However, FPC command line parameters (e.g. -O, -Cp) and directives/modifiers (e.g. inline, const, constref, ...) get translated into LLVM directives wherever possible.

So if/when we would get FPC equivalents of such directives, I could translate those to LLVM IR as well.

Then I suggest the following (and I can prepare a patch to the code and docs if 
it were to be accepted)

$vectorize ON}
{$vectorize OFF}
{$vectorize WIDTH=VALUE}
{$vectorize TYPE=FIXED}
{$vectorize TYPE=SCALABLE}
{$vectorize PREDICATE=ON}
{$vectorize PREDICATE=OFF}

For a description, see 
<https://llvm.org/docs/Vectorizers.html#command-line-flags>. And

{$unroll ON}
{$unroll OFF}
{$unroll FULL}
{$unroll COUNT=VALUE}

For a description, see <https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations>.

LLVM equivalents of these compiler switches will be passed (by Jonas) to Clang 
as IR methadata.

Also, I suggest

-Cl<xxx>   Pass xxx to Clang as pragma on the command-line.

Regards,

Adriaan van Os

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

Reply via email to