* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / graphite / id-28.c
blobdd5fb9f70e24631264055401a685d1319f957478
1 /* { dg-do compile { target cilkplus } } */
2 /* { dg-options "-fcilkplus -floop-nest-optimize -O3" } */
4 #if HAVE_IO
5 #include <stdio.h>
6 #endif
7 #include <math.h>
8 #define NUMBER 5
10 int func1 (int *a1, int *a2)
12 return __sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER:1]);
15 int func2 (int *a1, int *a2)
17 return (__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) +
18 __sec_reduce_mul (a1[0:NUMBER] + a2[0:NUMBER]));
21 int func3 (int *a1, int *a2)
23 return (int) sqrt ((double)(__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) +
24 a2[0] + a2[1] + a2[3]));
27 int func4 (int *a1, int *a2)
29 return a1[NUMBER-1] * (__sec_reduce_add (a1[0:NUMBER] * a2[0:NUMBER]) + a2[0] + a2[1] + a2[3])/a1[NUMBER-2];
31 int main(void)
33 int array[NUMBER], array2[NUMBER];
34 int return_value = 0;
35 int ii = 0;
36 int argc = 1;
37 __asm volatile ("" : "+r" (argc));
38 for (ii = 0; ii < NUMBER; ii++)
40 array[ii] = argc; /* This should calculate to 1. */
41 array2[ii] = argc * argc + argc; /* This should calculate to 2. */
44 return_value = func1 (array, array2);
45 #if HAVE_IO
46 printf("Return_value = %d\n", return_value);
47 #endif
48 if (return_value != (2+2+2+2+2))
49 return 1;
51 return_value = func2 (array2, array);
52 #if HAVE_IO
53 printf("Return_value = %d\n", return_value);
54 #endif
55 if (return_value != (3*3*3*3*3) + (2+2+2+2+2))
56 return 2;
58 return_value = func3 (array, array2);
59 #if HAVE_IO
60 printf("Return_value = %d\n", return_value);
61 #endif
62 if (return_value != 4)
63 return 3;
65 return_value = func4 (array, array2);
66 #if HAVE_IO
67 printf("Return_value = %d\n", return_value);
68 #endif
69 if (return_value != 16)
70 return 4;
72 return 0;