https://gcc.gnu.org/g:668936caf0662a4eea62144c98fdfc8cf30b79d8

commit r16-2611-g668936caf0662a4eea62144c98fdfc8cf30b79d8
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Tue Jul 29 15:58:32 2025 +0100

    aarch64: Fix function_expander::get_reg_target
    
    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.

Diff:
---
 gcc/config/aarch64/aarch64-sve-builtins.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 2b627a950602..01833a8de732 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -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;
 }

Reply via email to