https://gcc.gnu.org/g:1a4a0c08153faf413a8ac24a16d5deb45d7cd3e0

commit 1a4a0c08153faf413a8ac24a16d5deb45d7cd3e0
Author: Andrew Pinski <[email protected]>
Date:   Thu Jan 8 18:58:57 2026 -0800

    ifcvt: Reject inner floating modes of a subreg for noce_try_cond_zero_arith 
[PR123491]
    
    Like the check that was added in 
r16-6374-g2680785a6d14d7d78550edb8361f3b47eb5c4cb6,
    except this is for the new code that was added with 
r16-6436-g92f2a86794ad88d773b102.
    Basically the code only expects to work with scalar integer modes but forgot
    to check that.
    
    Pushed as obvious after bootstrap/test on x86_64-linux-gnu.
    
            PR rtl-optimization/123491
    gcc/ChangeLog:
    
            * ifcvt.cc (noce_try_cond_zero_arith): Reject non-scalar
            integer modes for the inner mode of the subreg.
    
    Signed-off-by: Andrew Pinski <[email protected]>
    (cherry picked from commit ab6621a77fbc1602d7def3c2b0a8d79a2f0edd96)

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

diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
index 36ba65286ff9..905b48f564b2 100644
--- a/gcc/ifcvt.cc
+++ b/gcc/ifcvt.cc
@@ -3216,9 +3216,13 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info)
         afterwards.  */
       if (GET_CODE (tmp) != SUBREG  || !subreg_lowpart_p (tmp))
        return false;
-      start_sequence ();
-
       tmp = SUBREG_REG (tmp);
+      /* Only handle integer scalar modes for the inner mode of
+        the subreg.  */
+      if (!SCALAR_INT_MODE_P (GET_MODE (tmp)))
+       return false;
+
+      start_sequence ();
       target = gen_reg_rtx (GET_MODE (tmp));
       target = noce_emit_cmove (if_info, target, code,
                                XEXP (cond, 0), XEXP (cond, 1),

Reply via email to