https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79487
--- Comment #6 from Dominik Vogt <vogt at linux dot vnet.ibm.com> --- This experimental patch fixes the problem: diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index aa45973..2e67cff 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1897,6 +1897,8 @@ simplify_const_unary_operation (enum rtx_code code, machine_mode mode, mode class. */ /* Don't perform the operation if flag_signaling_nans is on and the operand is a signaling NaN. */ + if (d.decimal) + real_convert (&d, GET_MODE (op), &d); if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)) && !(HONOR_SNANS (mode) && REAL_VALUE_ISSIGNALING_NAN (d))) real_convert (&d, mode, &d);