public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3283] testsuite: add another test for the rotate vectorization miscompilation
@ 2020-09-18 13:07 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-18 13:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3d3fe967b0961cb59f5df03ae2a55d83dc4bbd34

commit r11-3283-g3d3fe967b0961cb59f5df03ae2a55d83dc4bbd34
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Sep 18 15:05:53 2020 +0200

    testsuite: add another test for the rotate vectorization miscompilation
    
    This time with short and char where the used mask used to be larger
    than it should have been.
    
    2020-09-18  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/97081
            * gcc.dg/vect/pr97081-2.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr97081-2.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/pr97081-2.c b/gcc/testsuite/gcc.dg/vect/pr97081-2.c
new file mode 100644
index 00000000000..98ad3c3fe17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97081-2.c
@@ -0,0 +1,32 @@
+/* PR tree-optimization/97081 */
+
+#include "tree-vect.h"
+
+unsigned short s[1024];
+unsigned char c[1024];
+
+__attribute__((noipa)) void
+foo (int n)
+{
+  for (int i = 0; i < 1024; i++)
+    s[i] = (s[i] << n) | (s[i] >> (__SIZEOF_SHORT__ * __CHAR_BIT__ - n));
+  for (int i = 0; i < 1024; i++)
+    c[i] = (c[i] << n) | (c[i] >> (__CHAR_BIT__ - n));
+}
+
+int
+main ()
+{
+  check_vect ();
+  for (int i = 0; i < 1024; i++)
+    {
+      s[i] = i;
+      c[i] = i;
+    }
+  foo (3);
+  for (int i = 0; i < 1024; i++)
+    if (s[i] != (unsigned short) ((i << 3) | (i >> (__SIZEOF_SHORT__ * __CHAR_BIT__ - 3)))
+        || c[i] != (unsigned char) ((((unsigned char) i) << 3) | (((unsigned char) i) >> (__CHAR_BIT__ - 3))))
+      __builtin_abort ();
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-18 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 13:07 [gcc r11-3283] testsuite: add another test for the rotate vectorization miscompilation Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).