* gcc.target/powerpc/builtins-1-be.c <vclzb>: Rename duplicate test
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr58673-2.c
blob108fff5fd37a2388b0b461bcf281c09d63892559
1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power8 -O3 -funroll-loops" } */
7 #include <stddef.h>
8 #include <stdlib.h>
9 #include <math.h>
10 #include <string.h>
12 typedef long unsigned int size_t;
13 typedef struct _IO_FILE FILE;
14 typedef float real;
15 typedef real rvec[3];
16 typedef real matrix[3][3];
17 typedef real tensor[3][3];
18 enum
20 F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC,
21 F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ,
22 F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES,
23 F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE,
24 F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD,
25 F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES,
26 F_DVDL, F_DVDLKIN, F_NRE
28 typedef union
30 struct
33 bham;
34 struct
36 real rA, krA, rB, krB;
38 harmonic;
40 t_iparams;
41 typedef struct
43 t_iparams *iparams;
45 t_idef;
46 typedef struct
49 t_inputrec;
50 typedef struct
53 t_commrec;
54 typedef struct
57 t_forcerec;
58 typedef struct
61 t_mdatoms;
62 typedef struct
65 t_filenm;
66 enum
68 eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy,
69 eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory =
70 eoObsNR, eoInter, eoUseVirial, eoNR
72 extern char *eoNames[eoNR];
73 typedef struct
75 int bPrint;
77 t_coupl_LJ;
78 typedef struct
80 int eObs;
81 t_iparams xi;
83 t_coupl_iparams;
84 typedef struct
86 real act_value[eoObsNR];
87 real av_value[eoObsNR];
88 real ref_value[eoObsNR];
89 int bObsUsed[eoObsNR];
90 int nLJ, nBU, nQ, nIP;
91 t_coupl_LJ *tcLJ;
93 t_coupl_rec;
94 void xvgr_legend ();
95 real calc_deviation ();
96 void pr_dev ();
97 static void
98 pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile,
99 t_filenm fnm[])
101 static FILE *prop;
102 static FILE **out = ((void *) 0);
103 static FILE **qq = ((void *) 0);
104 static FILE **ip = ((void *) 0);
105 char buf[256];
106 char *leg[] = {
107 "C12", "C6"
109 char **raleg;
110 int i, j, index;
111 if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0))
112 && (ip == ((void *) 0)))
114 for (i = j = 0; (i < eoObsNR); i++)
116 if (tcr->bObsUsed[i])
118 raleg[j++] =
119 (__extension__
120 (__builtin_constant_p (eoNames[i])
121 && ((size_t) (const void *) ((eoNames[i]) + 1) -
122 (size_t) (const void *) (eoNames[i]) ==
123 1) ? (((const char *) (eoNames[i]))[0] ==
124 '\0' ? (char *) calloc ((size_t) 1,
125 (size_t) 1) : (
127 size_t
128 __len
130 strlen
131 (eoNames
132 [i])
135 char
136 *__retval
138 (char
140 malloc
141 (__len);
142 __retval;}
143 )): __strdup (eoNames[i])));
144 raleg[j++] =
145 (__extension__
146 (__builtin_constant_p (buf)
147 && ((size_t) (const void *) ((buf) + 1) -
148 (size_t) (const void *) (buf) ==
149 1) ? (((const char *) (buf))[0] ==
150 '\0' ? (char *) calloc ((size_t) 1,
151 (size_t) 1) : (
153 size_t
154 __len
156 strlen
157 (buf)
160 char
161 *__retval
163 (char
165 malloc
166 (__len);
167 __retval;}
168 )): __strdup (buf)));
171 if (tcr->nLJ)
173 for (i = 0; (i < tcr->nLJ); i++)
175 if (tcr->tcLJ[i].bPrint)
177 xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])),
178 leg);
185 void
186 do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t,
187 int step, real ener[], t_forcerec * fr, t_inputrec * ir,
188 int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver,
189 int nmols, t_commrec * cr, matrix box, tensor virial,
190 tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt)
192 int i, j, ati, atj, atnr2, type, ftype;
193 real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf;
194 real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind;
195 int bTest, bPrint;
196 t_coupl_iparams *tip;
197 if (bPrint)
199 pr_ff (tcr, t, idef, cr, nfile, fnm);
201 for (i = 0; (i < eoObsNR); i++)
203 deviation[i] =
204 calc_deviation (tcr->av_value[i], tcr->act_value[i],
205 tcr->ref_value[i]);
206 prdev[i] = tcr->ref_value[i] - tcr->act_value[i];
208 if (bPrint)
209 pr_dev (tcr, t, prdev, cr, nfile, fnm);
210 for (i = 0; (i < atnr2); i++)
212 factor = dt * deviation[tip->eObs];
213 switch (ftype)
215 case F_BONDS:
216 if (fabs (tip->xi.harmonic.krA) > 1.2e-38)
217 idef->iparams[type].harmonic.krA *=
218 (1 + factor / tip->xi.harmonic.krA);