diff options
author | Andrew Carlotti <andrew.carlotti@arm.com> | 2024-08-13 16:15:11 +0100 |
---|---|---|
committer | Andrew Carlotti <andrew.carlotti@arm.com> | 2024-08-19 15:49:46 +0100 |
commit | a4b39dc4bfad2b224cd2041568d469b5724f8f88 (patch) | |
tree | 98da48fd31722732be3493759261af4c475dfd18 /gcc | |
parent | 8871489c5162067c72a9b9ab05fe2179560e9986 (diff) | |
download | gcc-a4b39dc4bfad2b224cd2041568d469b5724f8f88.zip gcc-a4b39dc4bfad2b224cd2041568d469b5724f8f88.tar.gz gcc-a4b39dc4bfad2b224cd2041568d469b5724f8f88.tar.bz2 |
aarch64: Refactor check_required_extensions
Replace TARGET_GENERAL_REGS_ONLY check with an explicit check that
aarch64_isa_flags enables all required extensions. This will be more
flexible when repurposing this function for non-SVE intrinsics.
gcc/ChangeLog:
* config/aarch64/aarch64-sve-builtins.cc
(check_required_registers): Remove target check and rename to...
(report_missing_registers): ...this.
(check_required_extensions): Refactor.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/aarch64/aarch64-sve-builtins.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 0a560ea..1fe380d 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -1094,27 +1094,19 @@ report_missing_extension (location_t location, tree fndecl, reported_missing_extension_p = true; } -/* Check whether the registers required by SVE function fndecl are available. - Report an error against LOCATION and return false if not. */ -static bool -check_required_registers (location_t location, tree fndecl) +/* Report an error against LOCATION that the user has tried to use + function FNDECL when non-general registers are disabled. */ +static void +report_missing_registers (location_t location, tree fndecl) { /* Avoid reporting a slew of messages for a single oversight. */ if (reported_missing_registers_p) - return false; - - if (TARGET_GENERAL_REGS_ONLY) - { - /* SVE registers are not usable when -mgeneral-regs-only option - is specified. */ - error_at (location, - "ACLE function %qD is incompatible with the use of %qs", - fndecl, "-mgeneral-regs-only"); - reported_missing_registers_p = true; - return false; - } + return; - return true; + error_at (location, + "ACLE function %qD is incompatible with the use of %qs", + fndecl, "-mgeneral-regs-only"); + reported_missing_registers_p = true; } /* Check whether all the AARCH64_FL_* values in REQUIRED_EXTENSIONS are @@ -1124,9 +1116,19 @@ static bool check_required_extensions (location_t location, tree fndecl, aarch64_feature_flags required_extensions) { + if ((required_extensions & ~aarch64_isa_flags) == 0) + return true; + auto missing_extensions = required_extensions & ~aarch64_asm_isa_flags; + if (missing_extensions == 0) - return check_required_registers (location, fndecl); + { + /* All required extensions are enabled in aarch64_asm_isa_flags, so the + error must be the use of general-regs-only. */ + report_missing_registers (location, fndecl); + return false; + } + if (missing_extensions & AARCH64_FL_SM_OFF) { |