On 09/12/2023 13:35, Adriaan van Os via fpc-devel wrote:
Jonas Maebe via fpc-devel wrote:
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>.

I'd rather not introduce directives that are specific to clang, and especially none only apply to the next loop. We don't have a single directive yet that works like this.

Maybe attributes would be more appropriate, although I don't think Delphi (or FPC) currently supports attributes for statements.

Also, I suggest

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

You can already pass command line options to clang using the generic -ao command line parameter.


Jonas

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

Reply via email to