aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Carlotti <andrew.carlotti@arm.com>2024-08-13 16:15:11 +0100
committerAndrew Carlotti <andrew.carlotti@arm.com>2024-08-19 15:49:46 +0100
commita4b39dc4bfad2b224cd2041568d469b5724f8f88 (patch)
tree98da48fd31722732be3493759261af4c475dfd18
parent8871489c5162067c72a9b9ab05fe2179560e9986 (diff)
downloadgcc-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.
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins.cc38
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)
{