Message ID | 52686543.1000506@redhat.com |
---|---|
State | New |
Headers | show |
> The most isolated patch I can come up with, especially since we ought to > fix this in 4.8 branch as well, is to only allow expansion of wide int > modes to const_int when they're positive. > > Thoughts? That's a fairly dangerous hack in my opinion, in particular this breaks the uniqueness of representation of -1 as constm1_rtx. Can't we find a really contained hack instead, especially if we want to backport it to 4.8?
On Thu, Oct 24, 2013 at 10:43 AM, Eric Botcazou <ebotcazou@adacore.com> wrote: >> The most isolated patch I can come up with, especially since we ought to >> fix this in 4.8 branch as well, is to only allow expansion of wide int >> modes to const_int when they're positive. >> >> Thoughts? > > That's a fairly dangerous hack in my opinion, in particular this breaks the > uniqueness of representation of -1 as constm1_rtx. Can't we find a really > contained hack instead, especially if we want to backport it to 4.8? Pass the mode through all 10 stackframes is the only good fix given recent activity on modes vs. const_int. Richard. > -- > Eric Botcazou
> That's a fairly dangerous hack in my opinion, in particular this breaks the > uniqueness of representation of -1 as constm1_rtx. Can't we find a really > contained hack instead, especially if we want to backport it to 4.8? In particular, can't Uros' patch be considered as such here? Frankly, the choice of 'true' vs 'false' for create_convert_operand_to in optabs isn't crystal clear...
Eric Botcazou <ebotcazou@adacore.com> writes: >> That's a fairly dangerous hack in my opinion, in particular this breaks the >> uniqueness of representation of -1 as constm1_rtx. Can't we find a really >> contained hack instead, especially if we want to backport it to 4.8? > > In particular, can't Uros' patch be considered as such here? Frankly, the > choice of 'true' vs 'false' for create_convert_operand_to in optabs isn't > crystal clear... Do we actually need to do a conversion here at all? It looks like the modes of "expected" and "desired" should already match "mem", so we could just use create_input_operand. Thanks, Richard
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index b0fc846..d055f56 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -545,7 +545,10 @@ immed_double_const (HOST_WIDE_INT i0, HOST_WIDE_INT i1, enum machine_mode mode) } /* If this integer fits in one word, return a CONST_INT. */ - if ((i1 == 0 && i0 >= 0) || (i1 == ~0 && i0 < 0)) + /* ??? On occasion we lose track of the original mode, and a CONST_INT gets + interpreted incorrectly for modes larger than HOST_BITS_PER_WIDE_INT. + If we only use CONST_INT for positive values, we work around that. */ + if (i1 == 0 && i0 >= 0) return GEN_INT (i0); /* We use VOIDmode for integers. */