From e0700fbe35286d31fe64782b255c8d2caec673dc Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 18 Jun 2024 12:22:32 +0100 Subject: Add force_highpart_subreg This patch adds a force_highpart_subreg to go along with the recently added force_lowpart_subreg. gcc/ * explow.h (force_highpart_subreg): Declare. * explow.cc (force_highpart_subreg): New function. * builtins.cc (expand_builtin_issignaling): Use it. * expmed.cc (emit_store_flag_1): Likewise. --- gcc/explow.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gcc/explow.cc') diff --git a/gcc/explow.cc b/gcc/explow.cc index 2a91cf7..b4a0df8 100644 --- a/gcc/explow.cc +++ b/gcc/explow.cc @@ -778,6 +778,20 @@ force_lowpart_subreg (machine_mode outermode, rtx op, return force_subreg (outermode, op, innermode, byte); } +/* Try to return an rvalue expression for the OUTERMODE highpart of OP, + which has mode INNERMODE. Allow OP to be forced into a new register + if necessary. + + Return null on failure. */ + +rtx +force_highpart_subreg (machine_mode outermode, rtx op, + machine_mode innermode) +{ + auto byte = subreg_highpart_offset (outermode, innermode); + return force_subreg (outermode, op, innermode, byte); +} + /* If X is a memory ref, copy its contents to a new temp reg and return that reg. Otherwise, return X. */ -- cgit v1.1