This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,avr] Fix PR80929, work around middle-end PR81444
- From: Denis Chertykov <chertykov at gmail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 15 Jul 2017 10:43:25 +0400
- Subject: Re: [patch,avr] Fix PR80929, work around middle-end PR81444
- Authentication-results: sourceware.org; auth=none
- References: <8535f632-7864-b046-f9bb-9f99546c9007@gjlay.de>
2017-07-14 18:16 GMT+04:00 Georg-Johann Lay <avr@gjlay.de>:
> Hi, this patch restores some of the divmod handling.
>
> It addresses two issues:
>
> 1) rtx_costs might be called with code = LSHIFTRT for a mul_highpart. This
> is the case when outer_code = TRUNCATE. This patch uses a new function to
> compute the costs for that case (also used for code = TRUNCATE).
>
> 2) Due to PR81444, the middle-end is calling the cost functions with strange
> RTXes like
>
> (truncate:HI (lshiftrt:PSI (mult:PSI (zero_extend:PSI (reg:TI 42))
> (zero_extend:PSI (reg:TI 42)))
> (const_int 16 [0x10])))
>
> i.e. completely messed up modes. The correct RTX would be
>
> (truncate:HI (lshiftrt:SI (mult:SI (zero_extend:SI (reg:HI 42))
> (zero_extend:SI (reg:HI 42)))
> (const_int 16 [0x10])))
>
> The is worked around by also considering PSImode in the cost computation.
>
> FYI, I am currently also just reg-testing a fix for PR81444, cf.
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81444#c1
>
> Ok to apply the patch below (trunk and v7)?
>
> Johann
>
> PR 80929
> * config/avr/avr.c (avr_mul_highpart_cost): New static function.
> (avr_rtx_costs_1) [TRUNCATE]: Use it to compute mul_highpart cost.
> [LSHIFTRT, outer_code = TRUNCATE]: Same.
Approved. Please apply.