]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ifcvt: cond zero arith: re-expand output pattern [NFC]
authorVineet Gupta <vineetg@rivosinc.com>
Mon, 22 Dec 2025 16:52:33 +0000 (08:52 -0800)
committerVineet Gupta <vineetg@rivosinc.com>
Mon, 22 Dec 2025 17:03:46 +0000 (09:03 -0800)
Current code assigns the new czero insn into XEXP(a, 0) which feels
like a kludge. Instead use expand_simple_binop to recreate it.

gcc/ChangeLog:

* ifcvt.cc (noce_try_cond_zero_arith): Use expand_simple_binop
to re-expand the final pattern.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/ifcvt.cc

index 486bf16ea160f91dc07a53b6536fc0339c80e390..ef59a93e987e9c70b96edae3830d8c5fa580cca9 100644 (file)
@@ -3236,20 +3236,19 @@ noce_try_cond_zero_arith (struct noce_if_info *if_info)
       target = expand_simple_binop (mode, IOR, a_bin, target, if_info->x, 0,
                                    OPTAB_WIDEN);
 
-      if (!target)
-       goto end_seq_n_fail;
-
-      if (target != if_info->x)
-       noce_emit_move_insn (if_info->x, target);
     }
   else
     {
-      if (REG_P (XEXP (a, 1)))
-       XEXP (a, 1) = target;
-
-      noce_emit_move_insn (if_info->x, a);
+      target = expand_simple_binop (mode, op, a_op0, target, if_info->x, 0,
+                                   OPTAB_WIDEN);
     }
 
+  if (!target)
+    goto end_seq_n_fail;
+
+  if (target != if_info->x)
+    noce_emit_move_insn (if_info->x, target);
+
   seq = end_ifcvt_sequence (if_info);
   if (!seq || !targetm.noce_conversion_profitable_p (seq, if_info))
     goto fail;