https://gcc.gnu.org/g:817b03a2fb85cb6a934b06122ca261b07b70b824
commit r16-6331-g817b03a2fb85cb6a934b06122ca261b07b70b824 Author: Vineet Gupta <[email protected]> Date: Mon Dec 22 08:52:33 2025 -0800 ifcvt: cond zero arith: re-expand output pattern [NFC] 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 <[email protected]> Diff: --- gcc/ifcvt.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index 486bf16ea160..ef59a93e987e 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -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;
