This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][GCC][mid-end] Align cost calculations of mod with div. (PR middle-end/79665)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Tamar Christina <Tamar dot Christina at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, "jakub at redhat dot com" <jakub at redhat dot com>, "law at redhat dot com" <law at redhat dot com>, "ian at airs dot com" <ian at airs dot com>, "rguenther at suse dot de" <rguenther at suse dot de>
- Date: Thu, 27 Apr 2017 11:03:12 +0200
- Subject: Re: [PATCH][GCC][mid-end] Align cost calculations of mod with div. (PR middle-end/79665)
- Authentication-results: sourceware.org; auth=none
- References: <VI1PR0801MB20317C44F61338A73D1F2B57FF110@VI1PR0801MB2031.eurprd08.prod.outlook.com>
On Wed, Apr 26, 2017 at 6:02 PM, Tamar Christina
<Tamar.Christina@arm.com> wrote:
> Hi all,
>
> r245676 (PR/79665) introduced a change to calculate the costs of signed
> and unsigned div operations independently and when both are possible to
> allow you to specify a preference via cost mode.
>
> From the cover letter https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01408.html
> this was also supposed to apply to modulo but it only changed division.
> This adds the changes to modulo as well.
>
> I believe this to be a regression from GCC7 since now modulo generates worse code
> and blocks CSE when e.g. div and mod are used together.
>
> Bootstrapped on aarch64-none-linux-gnu and x86_64-linux
> and reg-tested on aarch64-none-linux-gnu with no regressions.
>
> OK for trunk and back-port to GCC7?
The only non-obvious part is that now fixed-point modulo go to binop
(might have been
a bug before).
It's less obvious why mod now generates worse code -- the mod path
didn't change.
Yes, I see how it may block CSE so it qualifies as a regression.
Ok for trunk. Ok for branch after 7.1 is out.
Thanks,
Richard.
> Thanks,
> Tamar
>
>
> gcc/
> 2017-04-26 Tamar Christina <tamar.christina@arm.com>
>
> PR middle-end/79665
> * expr.c (expand_expr_real_2): Move TRUNC_MOD_EXPR, FLOOR_MOD_EXPR,
> CEIL_MOD_EXPR, ROUND_MOD_EXPR cases.