1! { dg-do run } 2 3program main 4 integer igot, iexp, iexpr 5 real fgot, fexp 6 integer i 7 integer, parameter :: N = 32 8 logical lgot, lexp 9 10 fgot = 1234.0 11 fexp = 1266.0 12 13 !$acc parallel loop copy (fgot) 14 do i = 1, N 15 !$acc atomic update 16 fgot = fgot + 1.0 17 !$acc end atomic 18 end do 19 !$acc end parallel loop 20 21 if (fgot /= fexp) call abort 22 23 fgot = 1.0 24 fexp = 2.0**32 25 26 !$acc parallel loop copy (fgot) 27 do i = 1, N 28 !$acc atomic update 29 fgot = fgot * 2.0 30 !$acc end atomic 31 end do 32 !$acc end parallel loop 33 34 if (fgot /= fexp) call abort 35 36 fgot = 32.0 37 fexp = fgot - N 38 39 !$acc parallel loop copy (fgot) 40 do i = 1, N 41 !$acc atomic update 42 fgot = fgot - 1.0 43 !$acc end atomic 44 end do 45 !$acc end parallel loop 46 47 if (fgot /= fexp) call abort 48 49 fgot = 2**32.0 50 fexp = 1.0 51 52 !$acc parallel loop copy (fgot) 53 do i = 1, N 54 !$acc atomic update 55 fgot = fgot / 2.0 56 !$acc end atomic 57 end do 58 !$acc end parallel loop 59 60 if (fgot /= fexp) call abort 61 62 lgot = .TRUE. 63 lexp = .FALSE. 64 65 !$acc parallel copy (lgot) 66 !$acc atomic update 67 lgot = lgot .and. .FALSE. 68 !$acc end atomic 69 !$acc end parallel 70 71 if (lgot .neqv. lexp) call abort 72 73 lgot = .FALSE. 74 lexp = .FALSE. 75 76 !$acc parallel copy (lgot) 77 !$acc atomic update 78 lgot = lgot .or. .FALSE. 79 !$acc end atomic 80 !$acc end parallel 81 82 if (lgot .neqv. lexp) call abort 83 84 lgot = .FALSE. 85 lexp = .FALSE. 86 87 !$acc parallel copy (lgot) 88 !$acc atomic update 89 lgot = lgot .eqv. .TRUE. 90 !$acc end atomic 91 !$acc end parallel 92 93 if (lgot .neqv. lexp) call abort 94 95 lgot = .FALSE. 96 lexp = .TRUE. 97 98 !$acc parallel copy (lgot) 99 !$acc atomic update 100 lgot = lgot .neqv. .TRUE. 101 !$acc end atomic 102 !$acc end parallel 103 104 if (lgot .neqv. lexp) call abort 105 106 fgot = 1234.0 107 fexp = 1266.0 108 109 !$acc parallel loop copy (fgot) 110 do i = 1, N 111 !$acc atomic update 112 fgot = 1.0 + fgot 113 !$acc end atomic 114 end do 115 !$acc end parallel loop 116 117 if (fgot /= fexp) call abort 118 119 fgot = 1.0 120 fexp = 2.0**32 121 122 !$acc parallel loop copy (fgot) 123 do i = 1, N 124 !$acc atomic update 125 fgot = 2.0 * fgot 126 !$acc end atomic 127 end do 128 !$acc end parallel loop 129 130 if (fgot /= fexp) call abort 131 132 fgot = 32.0 133 fexp = 32.0 134 135 !$acc parallel loop copy (fgot) 136 do i = 1, N 137 !$acc atomic update 138 fgot = 2.0 - fgot 139 !$acc end atomic 140 end do 141 !$acc end parallel loop 142 143 if (fgot /= fexp) call abort 144 145 fgot = 2.0**16 146 fexp = 2.0**16 147 148 !$acc parallel loop copy (fgot) 149 do i = 1, N 150 !$acc atomic update 151 fgot = 2.0 / fgot 152 !$acc end atomic 153 end do 154 !$acc end parallel loop 155 156 if (fgot /= fexp) call abort 157 158 lgot = .TRUE. 159 lexp = .FALSE. 160 161 !$acc parallel copy (lgot) 162 !$acc atomic update 163 lgot = .FALSE. .and. lgot 164 !$acc end atomic 165 !$acc end parallel 166 167 if (lgot .neqv. lexp) call abort 168 169 lgot = .FALSE. 170 lexp = .FALSE. 171 172 !$acc parallel copy (lgot) 173 !$acc atomic update 174 lgot = .FALSE. .or. lgot 175 !$acc end atomic 176 !$acc end parallel 177 178 if (lgot .neqv. lexp) call abort 179 180 lgot = .FALSE. 181 lexp = .FALSE. 182 183 !$acc parallel copy (lgot) 184 !$acc atomic update 185 lgot = .TRUE. .eqv. lgot 186 !$acc end atomic 187 !$acc end parallel 188 189 if (lgot .neqv. lexp) call abort 190 191 lgot = .FALSE. 192 lexp = .TRUE. 193 194 !$acc parallel copy (lgot) 195 !$acc atomic update 196 lgot = .TRUE. .neqv. lgot 197 !$acc end atomic 198 !$acc end parallel 199 200 if (lgot .neqv. lexp) call abort 201 202 igot = 1 203 iexp = N 204 205 !$acc parallel loop copy (igot) 206 do i = 1, N 207 !$acc atomic update 208 igot = max (igot, i) 209 !$acc end atomic 210 end do 211 !$acc end parallel loop 212 213 if (igot /= iexp) call abort 214 215 igot = N 216 iexp = 1 217 218 !$acc parallel loop copy (igot) 219 do i = 1, N 220 !$acc atomic update 221 igot = min (igot, i) 222 !$acc end atomic 223 end do 224 !$acc end parallel loop 225 226 if (igot /= iexp) call abort 227 228 igot = -1 229 iexp = 0 230 231 !$acc parallel loop copy (igot) 232 do i = 0, N - 1 233 iexpr = ibclr (-2, i) 234 !$acc atomic update 235 igot = iand (igot, iexpr) 236 !$acc end atomic 237 end do 238 !$acc end parallel loop 239 240 if (igot /= iexp) call abort 241 242 igot = 0 243 iexp = -1 244 245 !$acc parallel loop copy (igot) 246 do i = 0, N - 1 247 iexpr = lshift (1, i) 248 !$acc atomic update 249 igot = ior (igot, iexpr) 250 !$acc end atomic 251 end do 252 !$acc end parallel loop 253 254 if (igot /= iexp) call abort 255 256 igot = -1 257 iexp = 0 258 259 !$acc parallel loop copy (igot) 260 do i = 0, N - 1 261 iexpr = lshift (1, i) 262 !$acc atomic update 263 igot = ieor (igot, iexpr) 264 !$acc end atomic 265 end do 266 !$acc end parallel loop 267 268 if (igot /= iexp) call abort 269 270 igot = 1 271 iexp = N 272 273 !$acc parallel loop copy (igot) 274 do i = 1, N 275 !$acc atomic update 276 igot = max (i, igot) 277 !$acc end atomic 278 end do 279 !$acc end parallel loop 280 281 if (igot /= iexp) call abort 282 283 igot = N 284 iexp = 1 285 286 !$acc parallel loop copy (igot) 287 do i = 1, N 288 !$acc atomic update 289 igot = min (i, igot) 290 !$acc end atomic 291 end do 292 !$acc end parallel loop 293 294 if (igot /= iexp) call abort 295 296 igot = -1 297 iexp = 0 298 299 !$acc parallel loop copy (igot) 300 do i = 0, N - 1 301 iexpr = ibclr (-2, i) 302 !$acc atomic update 303 igot = iand (iexpr, igot) 304 !$acc end atomic 305 end do 306 !$acc end parallel loop 307 308 if (igot /= iexp) call abort 309 310 igot = 0 311 iexp = -1 312 313 !$acc parallel loop copy (igot) 314 do i = 0, N - 1 315 iexpr = lshift (1, i) 316 !$acc atomic update 317 igot = ior (iexpr, igot) 318 !$acc end atomic 319 end do 320 !$acc end parallel loop 321 322 if (igot /= iexp) call abort 323 324 igot = -1 325 iexp = 0 326 327 !$acc parallel loop copy (igot) 328 do i = 0, N - 1 329 iexpr = lshift (1, i) 330 !$acc atomic update 331 igot = ieor (iexpr, igot) 332 !$acc end atomic 333 end do 334 !$acc end parallel loop 335 336 if (igot /= iexp) call abort 337 338end program 339