diff options
Diffstat (limited to 'gcc/explow.c')
-rw-r--r-- | gcc/explow.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/gcc/explow.c b/gcc/explow.c index 0563a23..6109832 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -100,36 +100,33 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c) case CONST_INT: if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT) { - unsigned HOST_WIDE_INT l1 = INTVAL (x); - HOST_WIDE_INT h1 = (l1 >> (HOST_BITS_PER_WIDE_INT - 1)) ? -1 : 0; - unsigned HOST_WIDE_INT l2 = c; - HOST_WIDE_INT h2 = c < 0 ? -1 : 0; - unsigned HOST_WIDE_INT lv; - HOST_WIDE_INT hv; - - if (add_double_with_sign (l1, h1, l2, h2, &lv, &hv, false)) + double_int di_x = double_int::from_shwi (INTVAL (x)); + double_int di_c = double_int::from_shwi (c); + + bool overflow; + double_int v = di_x.add_with_sign (di_c, false, &overflow); + if (overflow) gcc_unreachable (); - return immed_double_const (lv, hv, VOIDmode); + return immed_double_int_const (v, VOIDmode); } return GEN_INT (INTVAL (x) + c); case CONST_DOUBLE: { - unsigned HOST_WIDE_INT l1 = CONST_DOUBLE_LOW (x); - HOST_WIDE_INT h1 = CONST_DOUBLE_HIGH (x); - unsigned HOST_WIDE_INT l2 = c; - HOST_WIDE_INT h2 = c < 0 ? -1 : 0; - unsigned HOST_WIDE_INT lv; - HOST_WIDE_INT hv; - - if (add_double_with_sign (l1, h1, l2, h2, &lv, &hv, false)) + double_int di_x = double_int::from_pair (CONST_DOUBLE_HIGH (x), + CONST_DOUBLE_LOW (x)); + double_int di_c = double_int::from_shwi (c); + + bool overflow; + double_int v = di_x.add_with_sign (di_c, false, &overflow); + if (overflow) /* Sorry, we have no way to represent overflows this wide. To fix, add constant support wider than CONST_DOUBLE. */ gcc_assert (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_DOUBLE_INT); - return immed_double_const (lv, hv, VOIDmode); + return immed_double_int_const (v, VOIDmode); } case MEM: |