]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Add -mveclibabi=aocl [PR56504]
authorFilip Kastl <fkastl@suse.cz>
Wed, 13 Nov 2024 15:11:14 +0000 (16:11 +0100)
committerFilip Kastl <fkastl@suse.cz>
Wed, 13 Nov 2024 15:11:14 +0000 (16:11 +0100)
commit99ec0eb32a03506142f30c158276b4131aa73fe8
treeb8016d2ff70bc969fb5ff5a22e5ed574803e3cac
parent0342d024ff9af258df3bc8a23c9e999bea6be3e0
i386: Add -mveclibabi=aocl [PR56504]

We currently support generating vectorized math calls to the AMD core
math library (ACML) (-mveclibabi=acml).  That library is end-of-life and
its successor is the math library from AMD Optimizing CPU Libraries
(AOCL).

This patch adds support for AOCL (-mveclibabi=aocl).  That significantly
broadens the range of vectorized math functions optimized for AMD CPUs
that GCC can generate calls to.

See the edit to invoke.texi for a complete list of added functions.
Compared to the list of functions in AOCL LibM docs I left out these
vectorized function families:

- sincos and all functions working with arrays ... Because these
  functions have pointer arguments and that would require a bigger
  rework of ix86_veclibabi_aocl().  Also, I'm not sure if GCC even ever
  generates calls to these functions.
- linearfrac ... Because these functions are specific to the AMD
  library.  There's no equivalent glibc function nor GCC internal
  function nor GCC built-in.
- powx, sqrt, fabs ... Because GCC doesn't vectorize these functions
  into calls and uses instructions instead.

I also left amd_vrd2_expm1() (the AMD docs list the function but I
wasn't able to link calls to it with the current version of the
library).

gcc/ChangeLog:

PR target/56504
* config/i386/i386-options.cc (ix86_option_override_internal):
Add ix86_veclibabi_type_aocl case.
* config/i386/i386-options.h (ix86_veclibabi_aocl): Add extern
ix86_veclibabi_aocl().
* config/i386/i386-opts.h (enum ix86_veclibabi): Add
ix86_veclibabi_type_aocl into the ix86_veclibabi enum.
* config/i386/i386.cc (ix86_veclibabi_aocl): New function.
* config/i386/i386.opt: Add the 'aocl' type.
* doc/invoke.texi: Document -mveclibabi=aocl.

gcc/testsuite/ChangeLog:

PR target/56504
* gcc.target/i386/vectorize-aocl1.c: New test.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
gcc/config/i386/i386-options.cc
gcc/config/i386/i386-options.h
gcc/config/i386/i386-opts.h
gcc/config/i386/i386.cc
gcc/config/i386/i386.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/i386/vectorize-aocl1.c [new file with mode: 0644]