testsuite/libgomp.graphite/force-parallel-4.c

Go to the documentation of this file.
00001 /* Autopar with IF conditions.  */
00002 
00003 void abort();
00004 
00005 #define N 10000
00006 #define T 1000
00007 
00008 void foo(void)
00009 {
00010   int i;
00011   int A[2*N], B[2*N];
00012 
00013   /* Initialize array: carried no dependency.  */
00014   for (i = 0; i < 2*N; i++)
00015     B[i] = A[i] = i;
00016 
00017   for (i = 0; i < N; i++)
00018     {
00019       if (i < T)
00020     /* loop i1: carried no dependency.  */
00021     A[i] = A[i+T];
00022       else
00023     /* loop i2: carried dependency.  */
00024     A[i] = A[i+T+1];
00025     }
00026 
00027   /* If it runs a wrong answer, abort.  */
00028   for (i = 0; i < N; i++)
00029     {
00030       if (i < T)
00031     {
00032       if (A[i] != B[i+T])
00033         abort();
00034     }
00035       else
00036     {
00037       if (A[i] != B[i+T+1])
00038         abort();
00039     }
00040     }
00041 }
00042 
00043 int main(void)
00044 {
00045   foo();
00046   return 0;
00047 }
00048 
00049 /* Check that parallel code generation part make the right answer.  */
00050 /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
00051 /* { dg-final { cleanup-tree-dump "graphite" } } */
00052 /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
00053 /* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */
00054 /* { dg-final { cleanup-tree-dump "parloops" } } */
00055 /* { dg-final { cleanup-tree-dump "optimized" } } */

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7