https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112483
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- What about this patch: ``` diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 69d87579d9c..f3745d86aea 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -4392,7 +4392,7 @@ simplify_ashift: real_convert (&f1, mode, CONST_DOUBLE_REAL_VALUE (trueop1)); rtx tmp = simplify_gen_unary (ABS, mode, op0, mode); if (REAL_VALUE_NEGATIVE (f1)) - tmp = simplify_gen_unary (NEG, mode, op0, mode); + tmp = simplify_unary_operation (NEG, mode, tmp, mode); return tmp; } if (GET_CODE (op0) == NEG || GET_CODE (op0) == ABS) ``` We only generate NEG if it simplifies from the ABS. Most likely due to constants.