RISC-V: Add testcases for signed imm SAT_ADD form1
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-97.c
blob796361572f16bfdd93c70c23a3b8c3b2266d6228
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 16
9 char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
12 __attribute__ ((noinline))
13 int main1 ()
15 struct {
16 char *p;
17 char *q;
18 } s;
19 int i;
21 /* Check that datarefs analysis can determine that the access via pointer
22 s.p is based off array x, which enables us to antialias this access from
23 the access to array cb. */
24 s.p = x;
25 for (i = 0; i < N; i++)
27 s.p[i] = cb[i];
30 /* check results: */
31 #pragma GCC novector
32 for (i = 0; i < N; i++)
34 if (s.p[i] != cb[i])
35 abort ();
38 /* Check that datarefs analysis can determine that the access via pointer
39 s.p is based off array x, and that the access via pointer s.q is based off
40 array cb, which enables us to antialias these two accesses. */
41 s.q = cb;
42 for (i = 0; i < N; i++)
44 s.p[i] = s.q[i];
47 /* check results: */
48 #pragma GCC novector
49 for (i = 0; i < N; i++)
51 if (s.p[i] != s.q[i])
52 abort ();
55 return 0;
58 int main (void)
60 check_vect ();
62 return main1 ();
66 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
67 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
68 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */