1 /* { dg-do compile } */
2 /* { dg-options "-fopenmp -O2 -std=c99" } */
4 typedef __SIZE_TYPE__
size_t;
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
) ;
18 extern void *malloc (size_t __size
) __attribute__ ((__nothrow__
)) __attribute__ ((__malloc__
)) ;
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)));
25 extern int __attribute__ ((__nothrow__
)) atoi (__const
char *__nptr
);
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__
));
30 int main(int argc
, char * argv
[])
35 CC
= (int)atoi(argv
[3]);
40 float _Complex
* restrict A
;
41 A
= malloc((AA
) * (BB
) * (CC
) * sizeof(float _Complex
));
43 A_slice_stride
= (AA
) * (BB
) ;
47 f
= malloc(CC
* sizeof(float));
53 fp
= fopen(argv
[1],"rb");
54 fread(A
,sizeof(float _Complex
),AA
* BB
* CC
,fp
);
57 fp
= fopen(argv
[2],"rb");
58 fread(f
,sizeof(float),CC
,fp
);
62 DD
= (int)atoi(argv
[4]);
63 EE
= (int)atoi(argv
[5]);
65 num_s
= (EE
- DD
) + 1;
69 float * restrict INPUT
;
70 INPUT
= malloc(4 * 4 * sizeof(float));
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 ))];
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) {
89 h
= INPUT
[ ( ((3)-1) + ( ((1)-1)*4 ))];
90 FF
= INPUT
[ ( ((4)-1) + ( ((1)-1)*4 ))];
98 X
= malloc(m_max
* n_max
* sizeof(float));
102 Y
= malloc(m_max
* n_max
* sizeof(float));
106 Z
= malloc(m_max
* n_max
* sizeof(float));
113 float _Complex
* restrict P
;
114 P
= malloc(m_max
* n_max
* sizeof(float _Complex
));
117 float _Complex
* restrict Ps
;
118 Ps
= malloc((m_max
) * (n_max
) * (num_s
) * sizeof(float _Complex
));
120 Ps_slice_stride
= (m_max
) * (n_max
) ;
129 for ( n
= 1 ; n
<= 99 ; n
++ ) {
130 for ( m
= 1 ; m
<= 99 ; m
++ ) {
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
;
141 int KK
= atoi(argv
[8]);
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
);
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
++) {
174 s_index
= s
+ (DD
-1);
175 RR
= f
[ ( (s_index
)-1) ];
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
))];
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 ))];
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 ))];
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 ))];
207 #pragma omp parallel for private(m)
208 for ( n
= 1 ; n
<= n_max
; n
++) {
209 for ( m
= 1 ; m
<= m_max
; m
++) {
215 float f1
,f2
,p1
,p2
,TT
,h
,FFF
;
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
)) ) ]) ;
225 FFF
= (f1
+ f2
) / 2.0;
228 TT
= (1.0 / sqrtf(2.0)) * (((h
* p1
) + (0.5 * h
* (p2
- p1
))) * (1.0 / FFF
));
234 P
[ ( ((m
)-1) + ( ((n
)-1)*m_max
))] = SSS
+ ((__extension__
1.0iF
) * 0.0);
242 fp
= fopen(argv
[10],"wb");
243 fwrite(X
,sizeof(float),m_max
* n_max
,fp
);
246 fp
= fopen(argv
[11],"wb");
247 fwrite(Y
,sizeof(float),m_max
* n_max
,fp
);
250 fp
= fopen(argv
[12],"wb");
251 fwrite(Z
,sizeof(float),m_max
* n_max
,fp
);
254 fp
= fopen(argv
[13],"wb");
255 fwrite(P
,sizeof(float _Complex
),m_max
* n_max
,fp
);