]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix function_expander::get_reg_target
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 29 Jul 2025 14:58:32 +0000 (15:58 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 29 Jul 2025 14:58:32 +0000 (15:58 +0100)
function_expander::get_reg_target didn't actually check for a register,
meaning that it could return a memory target instead.  That doesn't
really matter for the current direct and indirect uses (svundef*,
svcreate*, and svset*) but it will for later patches.

gcc/
* config/aarch64/aarch64-sve-builtins.cc
(function_expander::get_reg_target): Check whether the target
is a valid register_operand.

gcc/config/aarch64/aarch64-sve-builtins.cc

index 2b627a9506021850bc82c805f66de138489d3fe1..01833a8de732cdf13d973168a1adcb9706967134 100644 (file)
@@ -4004,7 +4004,8 @@ rtx
 function_expander::get_reg_target ()
 {
   machine_mode target_mode = result_mode ();
-  if (!possible_target || GET_MODE (possible_target) != target_mode)
+  if (!possible_target
+      || !register_operand (possible_target, target_mode))
     possible_target = gen_reg_rtx (target_mode);
   return possible_target;
 }