https://gcc.gnu.org/g:55c432ca2de691f74d1ceedc4310757597650498
commit r17-1763-g55c432ca2de691f74d1ceedc4310757597650498 Author: Hu, Lin1 <[email protected]> Date: Tue Jun 2 00:13:52 2026 -0700 dojump: use simplify_expand_binop for vector boolean mask When either op0 or op1 is a constant, expand_binop can emit an extra AND during expansion. Use simplify_expand_binop here to avoid creating it in the first place. gcc/ChangeLog: * dojump.cc (do_compare_rtx_and_jump): Use simplify_expand_binop instead of expand_binop. Diff: --- gcc/dojump.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/dojump.cc b/gcc/dojump.cc index 599a546b0deb..1ed22116a270 100644 --- a/gcc/dojump.cc +++ b/gcc/dojump.cc @@ -1244,12 +1244,11 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp, auto nunits = TYPE_VECTOR_SUBPARTS (TREE_TYPE (val)).to_constant (); if (maybe_ne (GET_MODE_PRECISION (mode), nunits)) { - op0 = expand_binop (mode, and_optab, op0, - GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), - NULL_RTX, true, OPTAB_WIDEN); - op1 = expand_binop (mode, and_optab, op1, - GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), - NULL_RTX, true, OPTAB_WIDEN); + rtx mask_imm = GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1); + op0 = simplify_expand_binop (mode, and_optab, op0, mask_imm, + NULL_RTX, true, OPTAB_WIDEN); + op1 = simplify_expand_binop (mode, and_optab, op1, mask_imm, + NULL_RTX, true, OPTAB_WIDEN); } }
