OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [gomp/] [pr25990.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-fopenmp -O2 -std=c99" } */
3
 
4
typedef __SIZE_TYPE__ size_t;
5
 
6
typedef struct {
7
  int _flags;
8
} FILE;
9
 
10
extern FILE *fopen (__const char *__restrict __filename,
11
      __const char *__restrict __modes);
12
extern size_t fread (void *__restrict __ptr, size_t __size,
13
       size_t __n, FILE *__restrict __stream) ;
14
extern int fclose (FILE *__stream);
15
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
16
        size_t __n, FILE *__restrict __s) ;
17
 
18
extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
19
 
20
extern size_t strlen (__const char *__s)
21
     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
22
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
23
     __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
24
 
25
extern int __attribute__ ((__nothrow__)) atoi (__const char *__nptr);
26
 
27
extern float cabsf (float _Complex __z) __attribute__ ((__nothrow__)); extern float __cabsf (float _Complex __z) __attribute__ ((__nothrow__));
28
extern float sqrtf (float __x) __attribute__ ((__nothrow__)); extern float __sqrtf (float __x) __attribute__ ((__nothrow__));
29
 
30
int main(int argc , char * argv[])
31
{
32
  int AA, BB, CC;
33
  AA = 99;
34
  BB = 99;
35
  CC = (int)atoi(argv[3]);
36
  int m,n,s;
37
  int DD,EE,num_s;
38
 
39
 
40
  float _Complex * restrict A;
41
  A = malloc((AA) * (BB) * (CC) * sizeof(float _Complex));
42
  int A_slice_stride;
43
  A_slice_stride = (AA) * (BB) ;
44
 
45
 
46
  float * restrict f;
47
  f = malloc(CC * sizeof(float));
48
 
49
 
50
 
51
  FILE *fp;
52
 
53
  fp = fopen(argv[1],"rb");
54
  fread(A,sizeof(float _Complex),AA * BB * CC,fp);
55
  fclose(fp);
56
 
57
  fp = fopen(argv[2],"rb");
58
  fread(f,sizeof(float),CC,fp);
59
  fclose(fp);
60
 
61
 
62
  DD = (int)atoi(argv[4]);
63
  EE = (int)atoi(argv[5]);
64
 
65
  num_s = (EE - DD) + 1;
66
 
67
 
68
 
69
  float * restrict INPUT;
70
  INPUT = malloc(4 * 4 * sizeof(float));
71
 
72
 
73
 
74
  int m_max = 99;
75
  int n_max = 00;
76
  float h = 0.1;
77
  float FF = 10;
78
 
79
  if ((__extension__ (__builtin_constant_p (5) && ((__builtin_constant_p (argv[6]) && strlen (argv[6]) < ((size_t) (5))) || (__builtin_constant_p ("plane") && strlen ("plane") < ((size_t) (5)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (argv[6]) && __builtin_constant_p ("plane") && (__s1_len = strlen (argv[6]), __s2_len = strlen ("plane"), (!((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) || __s2_len >= 4)) ? __builtin_strcmp (argv[6], "plane") : (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) && (__s1_len = strlen (argv[6]), __s1_len < 4) ? (__builtin_constant_p ("plane") && ((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) ? __builtin_strcmp (argv[6], "plane") : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("plane"); register int __result = (((__const unsigned char *) (__const char *) (argv[6]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (argv[6]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("plane") && ((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) && (__s2_len = strlen ("plane"), __s2_len < 4) ? (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) ? __builtin_strcmp (argv[6], "plane") : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (argv[6]); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("plane"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("plane"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("plane"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("plane"))[3]); } } __result; }))) : __builtin_strcmp (argv[6], "plane")))); }) : (__extension__ (__builtin_constant_p (5) && ((__builtin_constant_p (argv[6]) && strlen (argv[6]) < ((size_t) (5))) || (__builtin_constant_p ("plane") && strlen ("plane") < ((size_t) (5)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (argv[6]) && __builtin_constant_p ("plane") && (__s1_len = strlen (argv[6]), __s2_len = strlen ("plane"), (!((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) || __s2_len >= 4)) ? __builtin_strcmp (argv[6], "plane") : (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) && (__s1_len = strlen (argv[6]), __s1_len < 4) ? (__builtin_constant_p ("plane") && ((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) ? __builtin_strcmp (argv[6], "plane") : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("plane"); register int __result = (((__const unsigned char *) (__const char *) (argv[6]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (argv[6]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("plane") && ((size_t)(const void *)(("plane") + 1) - (size_t)(const void *)("plane") == 1) && (__s2_len = strlen ("plane"), __s2_len < 4) ? (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) ? __builtin_strcmp (argv[6], "plane") : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (argv[6]); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("plane"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("plane"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("plane"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("plane"))[3]); } } __result; }))) : __builtin_strcmp (argv[6], "plane")))); }) : strncmp (argv[6], "plane", 5)))))==0) {
80
      m_max = INPUT[ ( ((1)-1) + ( ((1)-1)*4 ))];
81
      n_max = INPUT[ ( ((2)-1) + ( ((1)-1)*4 ))];
82
      h = INPUT[ ( ((3)-1) + ( ((1)-1)*4 ))];
83
      FF = INPUT[ ( ((4)-1) + ( ((1)-1)*4 ))];
84
  }
85
 
86
  if ((__extension__ (__builtin_constant_p (6) && ((__builtin_constant_p (argv[6]) && strlen (argv[6]) < ((size_t) (6))) || (__builtin_constant_p ("sphere") && strlen ("sphere") < ((size_t) (6)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (argv[6]) && __builtin_constant_p ("sphere") && (__s1_len = strlen (argv[6]), __s2_len = strlen ("sphere"), (!((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) || __s2_len >= 4)) ? __builtin_strcmp (argv[6], "sphere") : (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) && (__s1_len = strlen (argv[6]), __s1_len < 4) ? (__builtin_constant_p ("sphere") && ((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) ? __builtin_strcmp (argv[6], "sphere") : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("sphere"); register int __result = (((__const unsigned char *) (__const char *) (argv[6]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (argv[6]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("sphere") && ((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) && (__s2_len = strlen ("sphere"), __s2_len < 4) ? (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) ? __builtin_strcmp (argv[6], "sphere") : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (argv[6]); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("sphere"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("sphere"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("sphere"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("sphere"))[3]); } } __result; }))) : __builtin_strcmp (argv[6], "sphere")))); }) : (__extension__ (__builtin_constant_p (6) && ((__builtin_constant_p (argv[6]) && strlen (argv[6]) < ((size_t) (6))) || (__builtin_constant_p ("sphere") && strlen ("sphere") < ((size_t) (6)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (argv[6]) && __builtin_constant_p ("sphere") && (__s1_len = strlen (argv[6]), __s2_len = strlen ("sphere"), (!((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) || __s2_len >= 4)) ? __builtin_strcmp (argv[6], "sphere") : (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) && (__s1_len = strlen (argv[6]), __s1_len < 4) ? (__builtin_constant_p ("sphere") && ((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) ? __builtin_strcmp (argv[6], "sphere") : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("sphere"); register int __result = (((__const unsigned char *) (__const char *) (argv[6]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (argv[6]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (argv[6]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("sphere") && ((size_t)(const void *)(("sphere") + 1) - (size_t)(const void *)("sphere") == 1) && (__s2_len = strlen ("sphere"), __s2_len < 4) ? (__builtin_constant_p (argv[6]) && ((size_t)(const void *)((argv[6]) + 1) - (size_t)(const void *)(argv[6]) == 1) ? __builtin_strcmp (argv[6], "sphere") : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (argv[6]); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("sphere"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("sphere"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("sphere"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("sphere"))[3]); } } __result; }))) : __builtin_strcmp (argv[6], "sphere")))); }) : strncmp (argv[6], "sphere", 6)))))==0) {
87
      m_max = 181;
88
      n_max = 361;
89
      h = INPUT[ ( ((3)-1) + ( ((1)-1)*4 ))];
90
      FF = INPUT[ ( ((4)-1) + ( ((1)-1)*4 ))];
91
  }
92
 
93
 
94
 
95
 
96
 
97
  float * restrict X;
98
  X = malloc(m_max * n_max * sizeof(float));
99
 
100
 
101
  float * restrict Y;
102
  Y = malloc(m_max * n_max * sizeof(float));
103
 
104
 
105
  float * restrict Z;
106
  Z = malloc(m_max * n_max * sizeof(float));
107
 
108
 
109
 
110
 
111
 
112
 
113
  float _Complex * restrict P;
114
  P = malloc(m_max * n_max * sizeof(float _Complex));
115
 
116
 
117
  float _Complex * restrict Ps;
118
  Ps = malloc((m_max) * (n_max) * (num_s) * sizeof(float _Complex));
119
  int Ps_slice_stride;
120
  Ps_slice_stride = (m_max) * (n_max) ;
121
 
122
 
123
  float GG;
124
  float HH;
125
 
126
 
127
 
128
 
129
  for ( n = 1 ; n <= 99 ; n++ ) {
130
      for ( m = 1 ; m <= 99 ; m++ ) {
131
 
132
 
133
 
134
 
135
 
136
          X[ ( ((m)-1) + ( ((n)-1)*m_max ))] = FF ;
137
          Y[ ( ((m)-1) + ( ((n)-1)*m_max ))] = FF ;
138
          Z[ ( ((m)-1) + ( ((n)-1)*m_max ))] = FF ;
139
      }
140
  }
141
  int KK = atoi(argv[8]);
142
  int LL = 3 * KK;
143
 
144
 
145
  float * restrict MM;
146
  MM = malloc(4 * LL * sizeof(float));
147
  for ( n = 1 ; n <= n_max ; n++) {
148
      for ( m = 1 ; m <= m_max ; m++) {
149
          for ( s = 1 ; s <= num_s ; s++) {
150
              Ps[ ( ((m)-1) + (((n)-1)*(m_max)) + (((s)-1)*(Ps_slice_stride)) ) ] = 0.0 + 0.0 * (__extension__ 1.0iF);
151
          }
152
      }
153
  }
154
 
155
 
156
  int liter ;
157
 
158
#pragma omp parallel for private(m,liter,s)
159
  for ( n = 1 ; n <= n_max ; n++) {
160
      for ( m = 1 ; m <= m_max ; m++) {
161
          for ( liter = 1 ; liter <= KK ; liter++ ) {
162
              for ( s = 1 ; s <= num_s ; s++) {
163
 
164
 
165
                  int LM_column;
166
                  float NN[4];
167
                  float OO[4];
168
                  float PP[4];
169
                  float QQ[4];
170
                  float k;
171
                  int s_index;
172
                  float RR;
173
 
174
                  s_index = s + (DD -1);
175
                  RR = f[ ( (s_index)-1) ];
176
                  k = 99.0;
177
 
178
                  NN[1 -1] = X[ ( ((m)-1) + ( ((n)-1)*m_max ))];
179
                  NN[2 -1] = Y[ ( ((m)-1) + ( ((n)-1)*m_max ))];
180
                  NN[3 -1] = Z[ ( ((m)-1) + ( ((n)-1)*m_max ))];
181
                  NN[4 -1] = 1.0;
182
 
183
                  LM_column = ((liter -1) * 3) + 1;
184
                  OO[1 -1] = MM[ ( ((1)-1) + ( ((LM_column)-1)*4 ))];
185
                  OO[2 -1] = MM[ ( ((2)-1) + ( ((LM_column)-1)*4 ))];
186
                  OO[3 -1] = MM[ ( ((3)-1) + ( ((LM_column)-1)*4 ))];
187
                  OO[4 -1] = MM[ ( ((4)-1) + ( ((LM_column)-1)*4 ))];
188
 
189
                  LM_column = ((liter -1) * 3) + 2;
190
                  PP[1 -1] = MM[ ( ((1)-1) + ( ((LM_column)-1)*4 ))];
191
                  PP[2 -1] = MM[ ( ((2)-1) + ( ((LM_column)-1)*4 ))];
192
                  PP[3 -1] = MM[ ( ((3)-1) + ( ((LM_column)-1)*4 ))];
193
                  PP[4 -1] = MM[ ( ((4)-1) + ( ((LM_column)-1)*4 ))];
194
 
195
                  LM_column = ((liter -1) * 3) + 3;
196
                  QQ[1 -1] = MM[ ( ((1)-1) + ( ((LM_column)-1)*4 ))];
197
                  QQ[2 -1] = MM[ ( ((2)-1) + ( ((LM_column)-1)*4 ))];
198
                  QQ[3 -1] = MM[ ( ((3)-1) + ( ((LM_column)-1)*4 ))];
199
                  QQ[4 -1] = MM[ ( ((4)-1) + ( ((LM_column)-1)*4 ))];
200
 
201
              }
202
          }
203
      }
204
  }
205
 
206
 
207
#pragma omp parallel for private(m)
208
  for ( n = 1 ; n <= n_max ; n++) {
209
      for ( m = 1 ; m <= m_max ; m++) {
210
 
211
 
212
 
213
          int s;
214
          float SSS;
215
          float f1,f2,p1,p2,TT,h,FFF;
216
          SSS = 0.0;
217
          for ( s = 2 ; s <= num_s ; s++) {
218
              f1 = f[ ( ((s-1) + (DD - 1))-1) ];
219
              f2 = f[ ( ((s) + (DD - 1))-1) ];
220
              p1 = cabsf(Ps[ ( ((m)-1) + (((n)-1)*(m_max)) + ((((s-1))-1)*(Ps_slice_stride)) ) ]) ;
221
              p2 = cabsf(Ps[ ( ((m)-1) + (((n)-1)*(m_max)) + (((s)-1)*(Ps_slice_stride)) ) ]) ;
222
 
223
              h = f2 - f1;
224
 
225
              FFF = (f1 + f2) / 2.0;
226
 
227
 
228
              TT = (1.0 / sqrtf(2.0)) * (((h * p1) + (0.5 * h * (p2 - p1))) * (1.0 / FFF));
229
 
230
              SSS += TT;
231
 
232
          }
233
 
234
          P[ ( ((m)-1) + ( ((n)-1)*m_max ))] = SSS + ((__extension__ 1.0iF) * 0.0);
235
      }
236
  }
237
 
238
 
239
 
240
 
241
 
242
  fp = fopen(argv[10],"wb");
243
  fwrite(X,sizeof(float),m_max * n_max,fp);
244
  fclose(fp);
245
 
246
  fp = fopen(argv[11],"wb");
247
  fwrite(Y,sizeof(float),m_max * n_max,fp);
248
  fclose(fp);
249
 
250
  fp = fopen(argv[12],"wb");
251
  fwrite(Z,sizeof(float),m_max * n_max,fp);
252
  fclose(fp);
253
 
254
  fp = fopen(argv[13],"wb");
255
  fwrite(P,sizeof(float _Complex),m_max * n_max,fp);
256
  fclose(fp);
257
 
258
 
259
 
260
  return(0);
261
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.