aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-02 11:32:19 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-02 11:40:47 +0100
commit037fe26ee1ac18581bf0ad646d48591c97d10bd3 (patch)
treea6f69e57d3e6391e15795c1382babe8437afd09b /gcc/optabs.h
parent337d6362458ab033d3bfe287dda37f9da5577406 (diff)
downloadgcc-037fe26ee1ac18581bf0ad646d48591c97d10bd3.zip
gcc-037fe26ee1ac18581bf0ad646d48591c97d10bd3.tar.gz
gcc-037fe26ee1ac18581bf0ad646d48591c97d10bd3.tar.bz2
expansion: Further improve double-word modulo, division and divmod [PR97459]
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. 2020-12-02 Jakub Jelinek <jakub@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.
Diffstat (limited to 'gcc/optabs.h')
-rw-r--r--gcc/optabs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 84aaa7a..87fed90 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -183,6 +183,8 @@ extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int,
enum optab_methods);
extern rtx expand_vector_broadcast (machine_mode, rtx);
+extern rtx expand_doubleword_divmod (machine_mode, rtx, rtx, rtx *, bool);
+
/* Generate code for a simple binary or unary operation. "Simple" in
this case means "can be unambiguously described by a (mode, code)
pair and mapped to a single optab." */