1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-tree-optimized" } */
3 
4 void
test1(double * out1,double * out2,double * out3,double * in1,double * in2,int len)5 test1 (double *out1, double *out2, double *out3, double *in1,
6        double *in2, int len)
7 {
8   int i;
9   double *__restrict o1 = __builtin_assume_aligned (out1, 16);
10   double *__restrict o2 = __builtin_assume_aligned (out2, 16);
11   double *__restrict o3 = __builtin_assume_aligned (out3, 16);
12   double *__restrict i1 = __builtin_assume_aligned (in1, 16);
13   double *__restrict i2 = __builtin_assume_aligned (in2, 16);
14   for (i = 0; i < len; ++i)
15     {
16       o1[i] = i1[i] * i2[i];
17       o2[i] = i1[i] + i2[i];
18       o3[i] = i1[i] - i2[i];
19     }
20 }
21 
22 void
test2(double * out1,double * out2,double * out3,double * in1,double * in2,int len)23 test2 (double *out1, double *out2, double *out3, double *in1,
24        double *in2, int len)
25 {
26   int i, align = 32, misalign = 16;
27   out1 = __builtin_assume_aligned (out1, align, misalign);
28   out2 = __builtin_assume_aligned (out2, align, 16);
29   out3 = __builtin_assume_aligned (out3, 32, misalign);
30   in1 = __builtin_assume_aligned (in1, 32, 16);
31   in2 = __builtin_assume_aligned (in2, 32, 0);
32   for (i = 0; i < len; ++i)
33     {
34       out1[i] = in1[i] * in2[i];
35       out2[i] = in1[i] + in2[i];
36       out3[i] = in1[i] - in2[i];
37     }
38 }
39 
40 /* { dg-final { scan-tree-dump-not "__builtin_assume_aligned" "optimized" } } */
41