diff gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1a.c	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,39 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+unsigned short udata_sh[N] =
+  { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
+#define SUM 210
+
+__attribute__ ((noinline)) int
+foo ()
+{
+  int i;
+  unsigned int intsum = 0;
+
+  /* widenning sum: sum shorts into int.  */
+  for (i = 0; i < N; i++)
+    {
+      intsum += udata_sh[i];
+    }
+
+  /* check results:  */
+  if (intsum != SUM)
+    abort ();
+
+  return 0;
+}
+
+int
+main (void)
+{
+  check_vect ();
+  return foo ();
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_hi_to_si } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_hi_to_si } } } } */