On 12/1/20 2:00 PM, Jakub Jelinek wrote:
> Hi!
>
> The following patch implements what Thomas wrote about, in particular
> that we can handle also double-word divison by the constants for which
> the earlier patch optimized modulo (if it would be otherwise a library
> call) and that we can also easily handle such constants shifted to the left.
> Unfortunately, seems CSE isn't able to optimize away the two almost
> identical sequences (one to compute remainder, one to compute quotient),
> probably because of the ADD_OVERFLOW introduced jumps, so the patch also
> adjusts expand_DIVMOD.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2020-12-01  Jakub Jelinek  <ja...@redhat.com>
>
>       PR rtl-optimization/97459
>       * optabs.h (expand_doubleword_divmod): Declare.
>       * optabs.c (expand_doubleword_divmod): New function.
>       (expand_binop): Use it.
>       * internal-fn.c (expand_DIVMOD): Likewise.
>
>       * gcc.target/i386/pr97282.c (foo): Use 123456 divisor instead of
>       10.
>       * gcc.dg/pr97459-1.c (TESTS): Add tests for 10, 12 and
>       6144.
>       * gcc.dg/pr97459-2.c (TESTS): Likewise.
>       * gcc.dg/pr97459-3.c: New test.
>       * gcc.dg/pr97459-4.c: New test.
>       * gcc.dg/pr97459-5.c: New test.
>       * gcc.dg/pr97459-6.c: New test.
OK
jeff

Reply via email to