| 1 |
/* PR c/102989 */ |
| 2 |
/* { dg-do run { target bitint } } */ |
| 3 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 |
|
| 5 |
#include <stdatomic.h> |
| 6 |
|
| 7 |
extern void abort (void); |
| 8 |
|
| 9 |
#if __BITINT_MAXWIDTH__ >= 575 |
| 10 |
_Atomic _BitInt(575) v; |
| 11 |
_BitInt(575) count, res; |
| 12 |
const _BitInt(575) init = ~(_BitInt(575)) 0wb; |
| 13 |
|
| 14 |
void |
| 15 |
test_fetch_add () |
| 16 |
{ |
| 17 |
atomic_init (&v, 59465222573183779324781274162178653782927579944977967117312772499849358939735575735090252965265846823956223131844773977101864574011188590603103408821590130462520809924774161wb); |
| 18 |
count = 21849324526703540909725517290562575722142104889154621021004438836543599493803029317660194646869455042293514095831327249339063542203879269024249546998746919066599380031180974wb; |
| 19 |
|
| 20 |
if (atomic_fetch_add_explicit (&v, count, memory_order_relaxed) |
| 21 |
!= 59465222573183779324781274162178653782927579944977967117312772499849358939735575735090252965265846823956223131844773977101864574011188590603103408821590130462520809924774161wb) |
| 22 |
abort (); |
| 23 |
|
| 24 |
if (atomic_fetch_add_explicit (&v, -48324598397571087754171506195219221853271763472221035086980364394554212400270766919963305485900701475788840363160834710492683133292253640988518950921616217692973141455340373wb, |
| 25 |
memory_order_consume) |
| 26 |
!= -42350653636664946795744469057082365512495989716473331818714316710055654119727328532407752918486220628549098485331968443234754400938307745356420121730609534429183196118394433wb) |
| 27 |
abort (); |
| 28 |
|
| 29 |
if (atomic_fetch_add_explicit (&v, count, memory_order_acquire) |
| 30 |
!= 32989948702316232480335285257522007651797921361911553051336846941838746033267838132787142126234600390460896864515266515948244982922814218638834004898720831836147048500614762wb) |
| 31 |
abort (); |
| 32 |
|
| 33 |
if (atomic_fetch_add_explicit (&v, 6958312589905983216078981134518695082538588883298046610645489916662738759809700053844918067866491080683973037493524864531300139437943661326918145212620326291059845453630984wb, |
| 34 |
memory_order_release) |
| 35 |
!= 54839273229019773390060802548084583373940026251066174072341285778382345527070867450447336773104055432754410960346593765287308525126693487663083551897467750902746428531795736wb) |
| 36 |
abort (); |
| 37 |
|
| 38 |
if (atomic_fetch_add_explicit (&v, count, memory_order_acq_rel) |
| 39 |
!= 61797585818925756606139783682603278456478615134364220682986775695045084286880567504292254840970546513438383997840118629818608664564637148990001697110088077193806273985426720wb) |
| 40 |
abort (); |
| 41 |
|
| 42 |
if (atomic_fetch_add_explicit (&v, -40070085597220253007443375012839311464160438432662764715171645999337062215395237625623334979615599652975898123428005079853660189572782012739700306191422569739682093304494995wb, |
| 43 |
memory_order_seq_cst) |
| 44 |
!= -40018290390922969514385959536657740838944954527087078253040313514859928772582336763205751042781520939066937619336623790518010310384859186969521833442111587697897732057741874wb) |
| 45 |
abort (); |
| 46 |
|
| 47 |
if (atomic_fetch_add (&v, 7196090098608011755205055682070541953902689411792805630101863619558545582022760829169235622333653743217332966939875542415224317593660770300818700993340012969018217868600175wb) |
| 48 |
!= 43576824748409044508421925960326542714460281590856076988819568532251621565288359196329114508224401902755999970243440799304012017195734405274550937917412426520723560712112699wb) |
| 49 |
abort (); |
| 50 |
|
| 51 |
if (atomic_load (&v) != 50772914847017056263626981642397084668362971002648882618921432151810167147311120025498350130558055645973332937183316341719236334789395175575369638910752439489741778580712874wb) |
| 52 |
abort (); |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
test_fetch_sub () |
| 57 |
{ |
| 58 |
atomic_store_explicit (&v, -24875491091433158113922205635657739252057730543056417031972993454853665637813018617125143194799847437263037065304695383952916979113678037118532311779822859742705294727822376wb, |
| 59 |
memory_order_release); |
| 60 |
count = 6813702694653136917886567607003795360731391695538381923575500076220746287948057449348609672603971831069550813465757196210073636056135824219022209113495061317682354090030599wb; |
| 61 |
|
| 62 |
if (atomic_fetch_sub_explicit (&v, count, memory_order_relaxed) |
| 63 |
!= -24875491091433158113922205635657739252057730543056417031972993454853665637813018617125143194799847437263037065304695383952916979113678037118532311779822859742705294727822376wb) |
| 64 |
abort (); |
| 65 |
|
| 66 |
if (atomic_fetch_sub_explicit (&v, 8502925336737158389204618905966437550402192530184998378452912098895816391400915282714213521081597588768568861040471642522181200007537708168290327879425612502090295717806034wb, |
| 67 |
memory_order_consume) |
| 68 |
!= -31689193786086295031808773242661534612789122238594798955548493531074411925761076066473752867403819268332587878770452580162990615169813861337554520893317921060387648817852975wb) |
| 69 |
abort (); |
| 70 |
|
| 71 |
if (atomic_fetch_sub_explicit (&v, count, memory_order_acquire) |
| 72 |
!= -40192119122823453421013392148627972163191314768779797334001405629970228317161991349187966388485416857101156739810924222685171815177351569505844848772743533562477944535659009wb) |
| 73 |
abort (); |
| 74 |
|
| 75 |
if (atomic_fetch_sub_explicit (&v, -14654459030451169455889477114198307761108411115104251375487725308584250511764953921137486025925617622862411621191578047606524662379041353882420330350079004108508600686109553wb, |
| 76 |
memory_order_release) |
| 77 |
!= -47005821817476590338899959755631767523922706464318179257576905706190974605110048798536576061089388688170707553276681418895245451233487393724867057886238594880160298625689608wb) |
| 78 |
abort (); |
| 79 |
|
| 80 |
if (atomic_fetch_sub_explicit (&v, count, memory_order_acq_rel) |
| 81 |
!= -32351362787025420883010482641433459762814295349213927882089180397606724093345094877399090035163771065308295932085103371288720788854446039842446727536159590771651697939580055wb) |
| 82 |
abort (); |
| 83 |
|
| 84 |
if (atomic_fetch_sub_explicit (&v, 22886836433700729148520267039236396292049781709943309196356241086882444816631218673962641435859436811686812355905147988710440709035301495069683757516099446883747069843672565wb, |
| 85 |
memory_order_seq_cst) |
| 86 |
!= -39165065481678557800897050248437255123545687044752309805664680473827470381293152326747699707767742896377846745550860567498794424910581864061468936649654652089334052029610654wb) |
| 87 |
abort (); |
| 88 |
|
| 89 |
if (atomic_fetch_sub (&v, 49406467535448986167225179068150076098092817730200780462287871488076089290458383699602612866098591282427581289588523598202726797161439183859560135056424525356253246480887928wb) |
| 90 |
!= 61613298821172980080833943222149943601970205795910300955010606485738697355341562584447859386994342786734176611552061113466447383207492245852620383385192484985222264201066349wb) |
| 91 |
abort (); |
| 92 |
|
| 93 |
if (atomic_load_explicit (&v, memory_order_acquire) |
| 94 |
!= 12206831285723993913608764153999867503877388065709520492722734997662608064883178884845246520895751504306595321963537515263720586046053061993060248328767959628969017720178421wb) |
| 95 |
abort (); |
| 96 |
} |
| 97 |
|
| 98 |
void |
| 99 |
test_fetch_and () |
| 100 |
{ |
| 101 |
atomic_store (&v, init); |
| 102 |
|
| 103 |
if (atomic_fetch_and_explicit (&v, 0, memory_order_relaxed) != init) |
| 104 |
abort (); |
| 105 |
|
| 106 |
if (atomic_fetch_and_explicit (&v, init, memory_order_consume) != 0) |
| 107 |
abort (); |
| 108 |
|
| 109 |
if (atomic_fetch_and_explicit (&v, 0, memory_order_acquire) != 0) |
| 110 |
abort (); |
| 111 |
|
| 112 |
v = ~v; |
| 113 |
if (atomic_fetch_and_explicit (&v, init, memory_order_release) != init) |
| 114 |
abort (); |
| 115 |
|
| 116 |
if (atomic_fetch_and_explicit (&v, 0, memory_order_acq_rel) != init) |
| 117 |
abort (); |
| 118 |
|
| 119 |
if (atomic_fetch_and_explicit (&v, 0, memory_order_seq_cst) != 0) |
| 120 |
abort (); |
| 121 |
|
| 122 |
if (atomic_fetch_and (&v, 0) != 0) |
| 123 |
abort (); |
| 124 |
} |
| 125 |
|
| 126 |
void |
| 127 |
test_fetch_xor () |
| 128 |
{ |
| 129 |
v = init; |
| 130 |
count = 0; |
| 131 |
|
| 132 |
if (atomic_fetch_xor_explicit (&v, count, memory_order_relaxed) != init) |
| 133 |
abort (); |
| 134 |
|
| 135 |
if (atomic_fetch_xor_explicit (&v, ~count, memory_order_consume) != init) |
| 136 |
abort (); |
| 137 |
|
| 138 |
if (atomic_fetch_xor_explicit (&v, 0, memory_order_acquire) != 0) |
| 139 |
abort (); |
| 140 |
|
| 141 |
if (atomic_fetch_xor_explicit (&v, ~count, memory_order_release) != 0) |
| 142 |
abort (); |
| 143 |
|
| 144 |
if (atomic_fetch_xor_explicit (&v, 0, memory_order_acq_rel) != init) |
| 145 |
abort (); |
| 146 |
|
| 147 |
if (atomic_fetch_xor_explicit (&v, ~count, memory_order_seq_cst) != init) |
| 148 |
abort (); |
| 149 |
|
| 150 |
if (atomic_fetch_xor (&v, ~count) != 0) |
| 151 |
abort (); |
| 152 |
} |
| 153 |
|
| 154 |
void |
| 155 |
test_fetch_or () |
| 156 |
{ |
| 157 |
v = 0wb; |
| 158 |
count = 28269553036454149273332760011886696253239742350009903329945699220681916416wb; |
| 159 |
|
| 160 |
if (atomic_fetch_or_explicit (&v, count, memory_order_relaxed) != 0wb) |
| 161 |
abort (); |
| 162 |
|
| 163 |
count *= 2; |
| 164 |
if (atomic_fetch_or_explicit (&v, 56539106072908298546665520023773392506479484700019806659891398441363832832wb, |
| 165 |
memory_order_consume) |
| 166 |
!= 28269553036454149273332760011886696253239742350009903329945699220681916416wb) |
| 167 |
abort (); |
| 168 |
|
| 169 |
count *= 2; |
| 170 |
if (atomic_fetch_or_explicit (&v, count, memory_order_acquire) |
| 171 |
!= 84808659109362447819998280035660088759719227050029709989837097662045749248wb) |
| 172 |
abort (); |
| 173 |
|
| 174 |
count *= 2; |
| 175 |
if (atomic_fetch_or_explicit (&v, 226156424291633194186662080095093570025917938800079226639565593765455331328wb, |
| 176 |
memory_order_release) |
| 177 |
!= 197886871255179044913329320083206873772678196450069323309619894544773414912wb) |
| 178 |
abort (); |
| 179 |
|
| 180 |
count *= 2; |
| 181 |
if (atomic_fetch_or_explicit (&v, count, memory_order_acq_rel) |
| 182 |
!= 424043295546812239099991400178300443798596135250148549949185488310228746240wb) |
| 183 |
abort (); |
| 184 |
|
| 185 |
count *= 2; |
| 186 |
if (atomic_fetch_or_explicit (&v, count, memory_order_seq_cst) |
| 187 |
!= 876356144130078627473315560368487583850432012850307003228316675841139408896wb) |
| 188 |
abort (); |
| 189 |
|
| 190 |
count *= 2; |
| 191 |
if (atomic_fetch_or (&v, count) != 1780981841296611404219963880748861863954103768050623909786579050902960734208wb) |
| 192 |
abort (); |
| 193 |
} |
| 194 |
|
| 195 |
|
| 196 |
/* Test the OP routines with a result which isn't used. */ |
| 197 |
|
| 198 |
void |
| 199 |
test_add () |
| 200 |
{ |
| 201 |
v = 0; |
| 202 |
count = 1486842905609751694333995980623369134886360644481888406879896752089037065255179570086557965294767349553406889549100250674362935254187127254353474822610854717612397677wb; |
| 203 |
|
| 204 |
atomic_fetch_add (&v, count); |
| 205 |
if (v != 1486842905609751694333995980623369134886360644481888406879896752089037065255179570086557965294767349553406889549100250674362935254187127254353474822610854717612397677wb) |
| 206 |
abort (); |
| 207 |
|
| 208 |
atomic_fetch_add_explicit (&v, count, memory_order_consume); |
| 209 |
if (v != 2973685811219503388667991961246738269772721288963776813759793504178074130510359140173115930589534699106813779098200501348725870508374254508706949645221709435224795354wb) |
| 210 |
abort (); |
| 211 |
|
| 212 |
atomic_fetch_add (&v, 1486842905609751694333995980623369134886360644481888406879896752089037065255179570086557965294767349553406889549100250674362935254187127254353474822610854717612397677wb); |
| 213 |
if (v != 4460528716829255083001987941870107404659081933445665220639690256267111195765538710259673895884302048660220668647300752023088805762561381763060424467832564152837193031wb) |
| 214 |
abort (); |
| 215 |
|
| 216 |
atomic_fetch_add_explicit (&v, 1486842905609751694333995980623369134886360644481888406879896752089037065255179570086557965294767349553406889549100250674362935254187127254353474822610854717612397677wb, |
| 217 |
memory_order_release); |
| 218 |
if (v != 5947371622439006777335983922493476539545442577927553627519587008356148261020718280346231861179069398213627558196401002697451741016748509017413899290443418870449590708wb) |
| 219 |
abort (); |
| 220 |
|
| 221 |
atomic_fetch_add (&v, 1486842905609751694333995980623369134886360644481888406879896752089037065255179570086557965294767349553406889549100250674362935254187127254353474822610854717612397677wb); |
| 222 |
if (v != 7434214528048758471669979903116845674431803222409442034399483760445185326275897850432789826473836747767034447745501253371814676270935636271767374113054273588061988385wb) |
| 223 |
abort (); |
| 224 |
|
| 225 |
atomic_fetch_add_explicit (&v, count, memory_order_seq_cst); |
| 226 |
if (v != 8921057433658510166003975883740214809318163866891330441279380512534222391531077420519347791768604097320441337294601504046177611525122763526120848935665128305674386062wb) |
| 227 |
abort (); |
| 228 |
} |
| 229 |
|
| 230 |
void |
| 231 |
test_sub () |
| 232 |
{ |
| 233 |
v = res = 55339930658115792138308584702507715233391812567721958037499562620485942364609138719919541704955047331226014242859673113345829202990143617633801993282898070230404539826267403wb; |
| 234 |
count = 0; |
| 235 |
|
| 236 |
atomic_fetch_sub (&v, count + 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb); |
| 237 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 238 |
if (v != res) |
| 239 |
abort (); |
| 240 |
|
| 241 |
atomic_fetch_sub_explicit (&v, count + 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb, memory_order_consume); |
| 242 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 243 |
if (v != res) |
| 244 |
abort (); |
| 245 |
|
| 246 |
atomic_fetch_sub (&v, 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb); |
| 247 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 248 |
if (v != res) |
| 249 |
abort (); |
| 250 |
|
| 251 |
atomic_fetch_sub_explicit (&v, 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb, memory_order_release); |
| 252 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 253 |
if (v != res) |
| 254 |
abort (); |
| 255 |
|
| 256 |
atomic_fetch_sub (&v, count + 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb); |
| 257 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 258 |
if (v != res) |
| 259 |
abort (); |
| 260 |
|
| 261 |
atomic_fetch_sub_explicit (&v, count + 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb, memory_order_seq_cst); |
| 262 |
res -= 2266681016524228072657464685355732111725088152428495977635446886262656759828446929716740827028716649170693025791717921736186782036315322643449879013364541057wb; |
| 263 |
if (v != res) |
| 264 |
abort (); |
| 265 |
} |
| 266 |
|
| 267 |
void |
| 268 |
test_and () |
| 269 |
{ |
| 270 |
v = init; |
| 271 |
|
| 272 |
atomic_fetch_and (&v, 0); |
| 273 |
if (v != 0) |
| 274 |
abort (); |
| 275 |
|
| 276 |
v = init; |
| 277 |
atomic_fetch_and_explicit (&v, init, memory_order_consume); |
| 278 |
if (v != init) |
| 279 |
abort (); |
| 280 |
|
| 281 |
atomic_fetch_and (&v, 0); |
| 282 |
if (v != 0) |
| 283 |
abort (); |
| 284 |
|
| 285 |
v = ~v; |
| 286 |
atomic_fetch_and_explicit (&v, init, memory_order_release); |
| 287 |
if (v != init) |
| 288 |
abort (); |
| 289 |
|
| 290 |
atomic_fetch_and (&v, 0); |
| 291 |
if (v != 0) |
| 292 |
abort (); |
| 293 |
|
| 294 |
v = ~v; |
| 295 |
atomic_fetch_and_explicit (&v, 0, memory_order_seq_cst); |
| 296 |
if (v != 0) |
| 297 |
abort (); |
| 298 |
} |
| 299 |
|
| 300 |
void |
| 301 |
test_xor () |
| 302 |
{ |
| 303 |
v = init; |
| 304 |
count = 0; |
| 305 |
|
| 306 |
atomic_fetch_xor (&v, count); |
| 307 |
if (v != init) |
| 308 |
abort (); |
| 309 |
|
| 310 |
atomic_fetch_xor_explicit (&v, ~count, memory_order_consume); |
| 311 |
if (v != 0) |
| 312 |
abort (); |
| 313 |
|
| 314 |
atomic_fetch_xor (&v, 0); |
| 315 |
if (v != 0) |
| 316 |
abort (); |
| 317 |
|
| 318 |
atomic_fetch_xor_explicit (&v, ~count, memory_order_release); |
| 319 |
if (v != init) |
| 320 |
abort (); |
| 321 |
|
| 322 |
atomic_fetch_xor_explicit (&v, 0, memory_order_acq_rel); |
| 323 |
if (v != init) |
| 324 |
abort (); |
| 325 |
|
| 326 |
atomic_fetch_xor (&v, ~count); |
| 327 |
if (v != 0) |
| 328 |
abort (); |
| 329 |
} |
| 330 |
|
| 331 |
void |
| 332 |
test_or () |
| 333 |
{ |
| 334 |
v = 0; |
| 335 |
count = 19342813113834066795298816wb; |
| 336 |
|
| 337 |
atomic_fetch_or (&v, count); |
| 338 |
if (v != 19342813113834066795298816wb) |
| 339 |
abort (); |
| 340 |
|
| 341 |
count *= 2; |
| 342 |
atomic_fetch_or_explicit (&v, count, memory_order_consume); |
| 343 |
if (v != 58028439341502200385896448wb) |
| 344 |
abort (); |
| 345 |
|
| 346 |
count *= 2; |
| 347 |
atomic_fetch_or (&v, 77371252455336267181195264wb); |
| 348 |
if (v != 135399691796838467567091712wb) |
| 349 |
abort (); |
| 350 |
|
| 351 |
count *= 2; |
| 352 |
atomic_fetch_or_explicit (&v, 154742504910672534362390528wb, |
| 353 |
memory_order_release); |
| 354 |
if (v != 290142196707511001929482240wb) |
| 355 |
abort (); |
| 356 |
|
| 357 |
count *= 2; |
| 358 |
atomic_fetch_or (&v, count); |
| 359 |
if (v != 599627206528856070654263296wb) |
| 360 |
abort (); |
| 361 |
|
| 362 |
count *= 2; |
| 363 |
atomic_fetch_or_explicit (&v, count, memory_order_seq_cst); |
| 364 |
if (v != 1218597226171546208103825408wb) |
| 365 |
abort (); |
| 366 |
} |
| 367 |
|
| 368 |
void |
| 369 |
test_exchange (void) |
| 370 |
{ |
| 371 |
atomic_store (&v, -285679222948993342888321238830899996788334328454283006589115162661816862491992700267590986826514460282130796141107636816730207482542791159837024986802592659048696136633096wb); |
| 372 |
if (atomic_exchange (&v, 5310030317361876753340683501073244375280341322936688061997080395958520351093955920782059690068348979597317732862920837580508090330213951646930178946470395395144632931547601wb) |
| 373 |
!= -285679222948993342888321238830899996788334328454283006589115162661816862491992700267590986826514460282130796141107636816730207482542791159837024986802592659048696136633096wb |
| 374 |
|| atomic_load (&v) != 5310030317361876753340683501073244375280341322936688061997080395958520351093955920782059690068348979597317732862920837580508090330213951646930178946470395395144632931547601wb) |
| 375 |
abort (); |
| 376 |
if (atomic_exchange_explicit (&v, -4427613371507571222951705350055906255006016685171218855857415580222001757304647519678682295710994407542058879878792272713121656498918585491540313864044915269100507689612649wb, |
| 377 |
memory_order_relaxed) |
| 378 |
!= 5310030317361876753340683501073244375280341322936688061997080395958520351093955920782059690068348979597317732862920837580508090330213951646930178946470395395144632931547601wb |
| 379 |
|| (atomic_load_explicit (&v, memory_order_acquire) |
| 380 |
!= -4427613371507571222951705350055906255006016685171218855857415580222001757304647519678682295710994407542058879878792272713121656498918585491540313864044915269100507689612649wb)) |
| 381 |
abort (); |
| 382 |
|
| 383 |
count = 5310030317361876753340683501073244375280341322936688061997080395958520351093955920782059690068348979597317732862920837580508090330213951646930178946470395395144632931547601wb; |
| 384 |
if (atomic_compare_exchange_strong (&v, &count, |
| 385 |
8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb)) |
| 386 |
abort (); |
| 387 |
if (count != -4427613371507571222951705350055906255006016685171218855857415580222001757304647519678682295710994407542058879878792272713121656498918585491540313864044915269100507689612649wb |
| 388 |
|| atomic_load (&v) != -4427613371507571222951705350055906255006016685171218855857415580222001757304647519678682295710994407542058879878792272713121656498918585491540313864044915269100507689612649wb) |
| 389 |
abort (); |
| 390 |
if (!atomic_compare_exchange_strong (&v, &count, |
| 391 |
8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb)) |
| 392 |
abort (); |
| 393 |
if (count != -4427613371507571222951705350055906255006016685171218855857415580222001757304647519678682295710994407542058879878792272713121656498918585491540313864044915269100507689612649wb |
| 394 |
|| atomic_load (&v) != 8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb) |
| 395 |
abort (); |
| 396 |
|
| 397 |
count = 5310030317361876753340683501073244375280341322936688061997080395958520351093955920782059690068348979597317732862920837580508090330213951646930178946470395395144632931547601wb; |
| 398 |
if (atomic_compare_exchange_strong_explicit (&v, &count, |
| 399 |
-20263258027145541347005514871938569231358927704236809883668741851321168433670480594273940614283839738125120292424689828120954658857299483460682957837178666219043928324493674wb, |
| 400 |
memory_order_seq_cst, |
| 401 |
memory_order_relaxed)) |
| 402 |
abort (); |
| 403 |
if (count != 8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb |
| 404 |
|| atomic_load (&v) != 8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb) |
| 405 |
abort (); |
| 406 |
if (!atomic_compare_exchange_strong_explicit (&v, &count, |
| 407 |
-20263258027145541347005514871938569231358927704236809883668741851321168433670480594273940614283839738125120292424689828120954658857299483460682957837178666219043928324493674wb, |
| 408 |
memory_order_seq_cst, |
| 409 |
memory_order_seq_cst)) |
| 410 |
abort (); |
| 411 |
if (count != 8894166061872682036448354332319628975793195843703235778626260413018342611721096976767565811189387129127069300488196032026080940074010266394902215699511191435840967345778707wb |
| 412 |
|| atomic_load (&v) != -20263258027145541347005514871938569231358927704236809883668741851321168433670480594273940614283839738125120292424689828120954658857299483460682957837178666219043928324493674wb) |
| 413 |
abort (); |
| 414 |
|
| 415 |
count = atomic_load (&v); |
| 416 |
do |
| 417 |
res = count + 3438682542819842029328613486899299339199839206022263296398180581126218550036955367421469273900216774711772362599086182416923053671263751262393559525082445581168420546542404wb; |
| 418 |
while (!atomic_compare_exchange_weak (&v, &count, res)); |
| 419 |
if (atomic_load (&v) != -16824575484325699317676901385039269892159088498214546587270561270194949883633525226852471340383622963413347929825603645704031605186035732198289398312096220637875507777951270wb) |
| 420 |
abort (); |
| 421 |
|
| 422 |
count = atomic_load_explicit (&v, memory_order_acquire); |
| 423 |
do |
| 424 |
res = count + 55351299008567209999272942257960316150846002020561006740901388462123844029522178721330031429855007927083338249659817829635668878607777961512926342979905691183772323299904096wb; |
| 425 |
while (!atomic_compare_exchange_weak_explicit (&v, &count, res, |
| 426 |
memory_order_relaxed, |
| 427 |
memory_order_relaxed)); |
| 428 |
if (atomic_load (&v) != 38526723524241510681596040872921046258686913522346460153630827191928894145888653494477560089471384963669990319834214183931637273421742229314636944667809470545896815521952826wb) |
| 429 |
abort (); |
| 430 |
} |
| 431 |
#endif |
| 432 |
|
| 433 |
int |
| 434 |
main () |
| 435 |
{ |
| 436 |
#if __BITINT_MAXWIDTH__ >= 575 |
| 437 |
test_fetch_add (); |
| 438 |
test_fetch_sub (); |
| 439 |
test_fetch_and (); |
| 440 |
test_fetch_xor (); |
| 441 |
test_fetch_or (); |
| 442 |
test_add (); |
| 443 |
test_sub (); |
| 444 |
test_and (); |
| 445 |
test_xor (); |
| 446 |
test_or (); |
| 447 |
test_exchange (); |
| 448 |
#endif |
| 449 |
return 0; |
| 450 |
} |