82 lines
3.0 KiB
Diff
82 lines
3.0 KiB
Diff
|
|
From 4553f252c10968037edceba4abe3984dc9bbad2a Mon Sep 17 00:00:00 2001
|
||
|
|
From: Richard Sandiford <richard.sandiford@arm.com>
|
||
|
|
Date: Fri, 1 Dec 2023 08:36:15 +0000
|
||
|
|
Subject: [PATCH 045/157] [Backport][SME] aarch64: Add a result_mode helper
|
||
|
|
function
|
||
|
|
|
||
|
|
Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a1bc121c00e30bd1bdaa62d87cbe64eb88e74f45
|
||
|
|
|
||
|
|
SME will add more intrinsics whose expansion code requires
|
||
|
|
the mode of the function return value. This patch adds an
|
||
|
|
associated helper routine.
|
||
|
|
|
||
|
|
gcc/
|
||
|
|
* config/aarch64/aarch64-sve-builtins.h
|
||
|
|
(function_expander::result_mode): New member function.
|
||
|
|
* config/aarch64/aarch64-sve-builtins-base.cc
|
||
|
|
(svld234_impl::expand): Use it.
|
||
|
|
* config/aarch64/aarch64-sve-builtins.cc
|
||
|
|
(function_expander::get_reg_target): Likewise.
|
||
|
|
---
|
||
|
|
gcc/config/aarch64/aarch64-sve-builtins-base.cc | 2 +-
|
||
|
|
gcc/config/aarch64/aarch64-sve-builtins.cc | 2 +-
|
||
|
|
gcc/config/aarch64/aarch64-sve-builtins.h | 9 +++++++++
|
||
|
|
3 files changed, 11 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
|
||
|
|
index 56c9d75e7..c9bf13792 100644
|
||
|
|
--- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc
|
||
|
|
+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
|
||
|
|
@@ -1272,7 +1272,7 @@ public:
|
||
|
|
rtx
|
||
|
|
expand (function_expander &e) const OVERRIDE
|
||
|
|
{
|
||
|
|
- machine_mode tuple_mode = TYPE_MODE (TREE_TYPE (e.call_expr));
|
||
|
|
+ machine_mode tuple_mode = e.result_mode ();
|
||
|
|
insn_code icode = convert_optab_handler (vec_mask_load_lanes_optab,
|
||
|
|
tuple_mode, e.vector_mode (0));
|
||
|
|
return e.use_contiguous_load_insn (icode);
|
||
|
|
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
|
||
|
|
index e168c8334..91af96687 100644
|
||
|
|
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
|
||
|
|
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
|
||
|
|
@@ -2796,7 +2796,7 @@ function_expander::get_fallback_value (machine_mode mode, unsigned int nops,
|
||
|
|
rtx
|
||
|
|
function_expander::get_reg_target ()
|
||
|
|
{
|
||
|
|
- machine_mode target_mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl)));
|
||
|
|
+ machine_mode target_mode = result_mode ();
|
||
|
|
if (!possible_target || GET_MODE (possible_target) != target_mode)
|
||
|
|
possible_target = gen_reg_rtx (target_mode);
|
||
|
|
return possible_target;
|
||
|
|
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h
|
||
|
|
index 0d130b871..52994cde0 100644
|
||
|
|
--- a/gcc/config/aarch64/aarch64-sve-builtins.h
|
||
|
|
+++ b/gcc/config/aarch64/aarch64-sve-builtins.h
|
||
|
|
@@ -528,6 +528,8 @@ public:
|
||
|
|
insn_code direct_optab_handler_for_sign (optab, optab, unsigned int = 0,
|
||
|
|
machine_mode = E_VOIDmode);
|
||
|
|
|
||
|
|
+ machine_mode result_mode () const;
|
||
|
|
+
|
||
|
|
bool overlaps_input_p (rtx);
|
||
|
|
|
||
|
|
rtx convert_to_pmode (rtx);
|
||
|
|
@@ -877,6 +879,13 @@ function_base::call_properties (const function_instance &instance) const
|
||
|
|
return flags;
|
||
|
|
}
|
||
|
|
|
||
|
|
+/* Return the mode of the result of a call. */
|
||
|
|
+inline machine_mode
|
||
|
|
+function_expander::result_mode () const
|
||
|
|
+{
|
||
|
|
+ return TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl)));
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|