diff options
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 2e48bde2983..a761c45745a 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1303,6 +1303,18 @@ operand_subword (op, i, validate_address, mode) REAL_VALUE_FROM_CONST_DOUBLE (rv, op); REAL_VALUE_TO_TARGET_SINGLE (rv, l); + /* If 32 bits is an entire word for the target, but not for the host, + then sign-extend on the host so that the number will look the same + way on the host that it would on the target. See for instance + simplify_unary_operation. The #if is needed to avoid compiler + warnings. */ + +#if HOST_BITS_PER_LONG > 32 + if (BITS_PER_WORD < HOST_BITS_PER_LONG && BITS_PER_WORD == 32 + && (l & ((long) 1 << 31))) + l |= ((long) (-1) << 32); +#endif + if (BITS_PER_WORD == 16) { if ((i & 0x1) == !WORDS_BIG_ENDIAN) |