public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6744] ifcvt: Allow constants for noce_convert_multiple.
@ 2022-01-19 17:38 Robin Dapp
  0 siblings, 0 replies; only message in thread
From: Robin Dapp @ 2022-01-19 17:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9b8eaa282250ad260e01d164093b597579db00d9

commit r12-6744-g9b8eaa282250ad260e01d164093b597579db00d9
Author: Robin Dapp <rdapp@linux.ibm.com>
Date:   Wed Nov 27 13:45:41 2019 +0100

    ifcvt: Allow constants for noce_convert_multiple.
    
    This lifts the restriction of not allowing constants for
    noce_convert_multiple.  The code later checks if a valid sequence
    is produced anyway.
    
    gcc/ChangeLog:
    
            * ifcvt.cc (noce_convert_multiple_sets): Allow constants.
            (bb_ok_for_noce_convert_multiple_sets): Likewise.

Diff:
---
 gcc/ifcvt.cc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
index 0f7a126ad92..c696563918d 100644
--- a/gcc/ifcvt.cc
+++ b/gcc/ifcvt.cc
@@ -3288,7 +3288,9 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
 	 we'll end up trying to emit r4:HI = cond ? (r1:SI) : (r3:HI).
 	 Wrap the two cmove operands into subregs if appropriate to prevent
 	 that.  */
-      if (GET_MODE (new_val) != GET_MODE (temp))
+
+      if (!CONSTANT_P (new_val)
+	  && GET_MODE (new_val) != GET_MODE (temp))
 	{
 	  machine_mode src_mode = GET_MODE (new_val);
 	  machine_mode dst_mode = GET_MODE (temp);
@@ -3299,7 +3301,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
 	    }
 	  new_val = lowpart_subreg (dst_mode, new_val, src_mode);
 	}
-      if (GET_MODE (old_val) != GET_MODE (temp))
+      if (!CONSTANT_P (old_val)
+	  && GET_MODE (old_val) != GET_MODE (temp))
 	{
 	  machine_mode src_mode = GET_MODE (old_val);
 	  machine_mode dst_mode = GET_MODE (temp);
@@ -3441,9 +3444,9 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb)
       if (!REG_P (dest))
 	return false;
 
-      if (!(REG_P (src)
-	   || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src))
-	       && subreg_lowpart_p (src))))
+      if (!((REG_P (src) || CONSTANT_P (src))
+	    || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src))
+	      && subreg_lowpart_p (src))))
 	return false;
 
       /* Destination must be appropriate for a conditional write.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-19 17:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 17:38 [gcc r12-6744] ifcvt: Allow constants for noce_convert_multiple Robin Dapp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).