On Thu, Jul 28, 2011 at 11:34 PM, Paolo Bonzini <bonz...@gnu.org> wrote:
> Ok, you removed ignore_address_wrap_around, so we're almost there.
>
> On 07/28/2011 07:59 PM, H.J. Lu wrote:
>>
>> @@ -712,7 +715,16 @@ convert_modes (enum machine_mode mode, enum
>> machine_mode oldmode, rtx x, int uns
>>    if (GET_CODE (x) == SUBREG&&  SUBREG_PROMOTED_VAR_P (x)
>>        &&  GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))>= GET_MODE_SIZE
>> (mode)
>>        &&  SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp)
>> -    x = gen_lowpart (mode, x);
>> +    {
>> +      temp = rtl_hooks.gen_lowpart_no_emit (mode, x);
>> +      if (temp)
>> +       x = temp;
>> +      else
>> +       {
>> +         gcc_assert (!no_emit);
>> +         x = gen_lowpart (mode, x);
>> +       }
>> +    }
>
> +    {
> +       /* gen_lowpart_no_emit should always succeed here.  */
> +       x = rtl_hooks.gen_lowpart_no_emit (mode, x);
> +    }
>
>>
>>    if (GET_MODE (x) != VOIDmode)
>>      oldmode = GET_MODE (x);
>> @@ -776,6 +788,10 @@ convert_modes (enum machine_mode mode, enum
>> machine_mode oldmode, rtx x, int uns
>>          return gen_int_mode (val, mode);
>>        }
>>
>> +      temp = rtl_hooks.gen_lowpart_no_emit (mode, x);
>> +      if (temp)
>> +       return temp;
>> +      gcc_assert (!no_emit);
>>        return gen_lowpart (mode, x);
>
> Right now, gen_lowpart_no_emit will never return NULL, so these tests in
> convert_modes are dead.  Instead, please include in your patch mine at
> http://permalink.gmane.org/gmane.comp.gcc.patches/242085 and adjust as
> follows.
>
> +      temp = rtl_hooks.gen_lowpart_no_emit (mode, x);
> +      if (no_emit)
> +        return rtl_hooks.gen_lowpart_no_emit (mode, x);
> +      else
> +        return gen_lowpart (mode, x);
>
>>      }
>
> If it does not work, PLEASE say why instead of posting another "updated
> patch".

The whole approach doesn't work. The testcase at

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49721#c1

shows GCC depends on transforming:

(zero_extend:DI (plus:SI (FOO:SI) (const_int Y)))

to

(plus:DI (zero_extend:DI (FOO:SI)) (const_int Y))

Otherwise we either get compiler crash or wrong codes.


-- 
H.J.

Reply via email to