summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-01-01 01:20:39 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2020-01-01 01:20:39 +0100
commit2efa10d528bb20bff299a899b1f226b6174b50da (patch)
treea7f908cf8e704324b930e7585e10d53058793740 /gcc/testsuite/gcc.c-torture
parentb3b13bf18692701d54d6754ba7e9f155906c8d17 (diff)
re PR tree-optimization/93098 (ICE with negative shifter)
PR tree-optimization/93098 * match.pd (popcount): For shift amounts, use integer_onep or wi::to_widest () == cst instead of tree_to_uhwi () == cst tests. Make sure that precision is power of two larger than or equal to 16. Ensure shift is never negative. Use HOST_WIDE_INT_UC macro instead of ULL suffixed constants. Formatting fixes. * gcc.c-torture/compile/pr93098.c: New test. From-SVN: r279809
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr93098.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr93098.c b/gcc/testsuite/gcc.c-torture/compile/pr93098.c
new file mode 100644
index 00000000000..fb80719f28c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr93098.c
@@ -0,0 +1,37 @@
+/* PR tree-optimization/93098 */
+
+int
+foo (unsigned long long x)
+{
+ x -= (x >> -1) & 0x5555555555555555ULL;
+ x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ return (x * 0x0101010101010101ULL) >> 56;
+}
+
+int
+bar (unsigned long long x)
+{
+ x -= (x >> 1) & 0x5555555555555555ULL;
+ x = (x & 0x3333333333333333ULL) + ((x >> -2) & 0x3333333333333333ULL);
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ return (x * 0x0101010101010101ULL) >> 56;
+}
+
+int
+baz (unsigned long long x)
+{
+ x -= (x >> 1) & 0x5555555555555555ULL;
+ x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
+ x = (x + (x >> -4)) & 0x0f0f0f0f0f0f0f0fULL;
+ return (x * 0x0101010101010101ULL) >> 56;
+}
+
+int
+qux (unsigned long long x)
+{
+ x -= (x >> 1) & 0x5555555555555555ULL;
+ x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ return (x * 0x0101010101010101ULL) >> -56;
+}