https://gcc.gnu.org/g:cb4770a61f27f0980afa6883f54a9a6c21a50f1a
commit cb4770a61f27f0980afa6883f54a9a6c21a50f1a 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]> (cherry picked from commit 817b03a2fb85cb6a934b06122ca261b07b70b824) Diff: --- gcc/ifcvt.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index 599a7ec9caae..68ca8448eb5e 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3239,20 +3239,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;
