On Wed, 13 Dec 2023, Jonas Maebe via fpc-devel wrote:

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.

Please don't:
Attributes are designed for runtime consumption. I'm heavily opposed to
start using them to influence the code generation. The compiler should
remain ignorant of their meaning and use.

Maybe a single {$PRAGMA XYZ} directive can be introduced to control this
kind of stuff, with a fixed list of XYZ. Backends can intepret the XYZ pragmas as they see fit.

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

Reply via email to