This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][GCC][mid-end] Align cost calculations of mod with div. (PR middle-end/79665)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]