summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/match.pd8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr91725.c7
4 files changed, 23 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0aa93bceb4b..360e606f47e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/91725
+ * match.pd ((A / (1 << B)) -> (A >> B)): Call tree_nonzero_bits instead
+ of get_nonzero_bits, only call it for integral types.
+
2019-09-11 Richard Biener <rguenther@suse.de>
Revert
diff --git a/gcc/match.pd b/gcc/match.pd
index 05009bb7a5a..5690cf3d349 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -325,9 +325,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (TYPE_UNSIGNED (TREE_TYPE (@1))
|| (element_precision (type)
== element_precision (TREE_TYPE (@1)))
- || (get_nonzero_bits (@0)
- & wi::mask (element_precision (TREE_TYPE (@1)) - 1, true,
- element_precision (type))) == 0))))
+ || (INTEGRAL_TYPE_P (type)
+ && (tree_nonzero_bits (@0)
+ & wi::mask (element_precision (TREE_TYPE (@1)) - 1,
+ true,
+ element_precision (type))) == 0)))))
(rshift @0 @2)))
/* Preserve explicit divisions by 0: the C++ front-end wants to detect
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8b3dfbbecf0..8ef80620c08 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/91725
+ * gcc.c-torture/compile/pr91725.c: New test.
+
2019-09-11 Richard Biener <rguenther@suse.de>
Revert
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr91725.c b/gcc/testsuite/gcc.c-torture/compile/pr91725.c
new file mode 100644
index 00000000000..f614a1c5e32
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr91725.c
@@ -0,0 +1,7 @@
+/* PR middle-end/91725 */
+
+unsigned long long
+foo (unsigned long long x, unsigned long long y, int z)
+{
+ return (x + y) / (1 << z);
+}