This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SVE ACLE] Add initial support for arm_sve.h


This patch adds the target framework for handling the SVE ACLE,
starting with four functions: svadd, svptrue, svsub and svsubr.

The ACLE has both overloaded and non-overloaded names.  Without
the equivalent of clang's __attribute__((overloadable)), a header
file that declared all functions would need three sets of declarations:

- the non-overloaded forms (used for both C and C++)
- _Generic-based macros to handle overloading in C
- normal overloaded inline functions for C++

This would likely require a lot of cut-&-paste.  It would probably
also lead to poor diagnosics and be slow to parse.

Another consideration is that some functions require certain arguments
to be integer constant expressions.  We can (sort of) enforce that
for calls to built-in functions using resolve_overloaded_builtin,
but it would be harder to enforce with inline forwarder functions.

For these reasons and others, the patch takes the approach of adding
a pragma that gets the compiler to insert the definitions itself.
This requires a slight variation on the existing lang hooks for
built-in functions, but otherwise it seems to just work.

It was easier to add the support without enumerating every function
at build time.  This in turn meant that it was easier if the SVE
builtins occupied a distinct numberspace from the existing AArch64 ones.
The patch therefore divides the built-in functions codes into "major"
and "minor" codes.  At present the major code is just "general" or "SVE".

For now, the patch is only expected to work for fixed-length SVE.
Some uses of the ACLE do manage to squeak through the front-end
in the normal vector-length agnostic mode, but that's more by
accident than design.  We're planning to work on proper frontend
support for "sizeless" types in parallel with the backend changes.

Other things not handled yet:

- support for the SVE AAPCS
- handling the built-ins correctly when the compiler is invoked
  without SVE enabled (e.g. if SVE is enabled later by a pragma)

Both of these are blockers to merging the support into trunk.

The aim is to make sure when adding a function that the function
produces the expected assembly output for all relevant combinations.
The patch adds a new check-function-bodies test to try to make
that easier.

Tested on aarch64-linux-gnu (with and without SVE) and committed
to aarch64/sve-acle-branch.

Richard


Attachment: initial-sve-acle.diff.gz
Description: application/gzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]