{"id":19008,"date":"2025-08-12T12:12:16","date_gmt":"2025-08-12T12:12:16","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=19008"},"modified":"2025-08-12T13:15:15","modified_gmt":"2025-08-12T13:15:15","slug":"assembler-instructions-for-atomics-c","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=19008","title":{"rendered":"Assembler instructions for atomics (C++)"},"content":{"rendered":"<table>\n<tr>\n<th>std::atomic<\/th>\n<th>Intel \/ AMD<\/th>\n<th>ARM (with LSE)<\/th>\n<\/tr>\n<tr>\n<td>fetch_add()<\/td>\n<td rowspan=\"2\">LOCK XADD<sup>1,2,3,4,5<\/sup><\/td>\n<td rowspan=\"2\">LDADD<sup>1<\/sup>, LDADDA<sup>2<\/sup>, LDADDL<sup>3<\/sup>, LDADDAL<sup>4,5<\/sup><\/td>\n<\/tr>\n<tr>\n<td>fetch_sub()<\/td>\n<\/tr>\n<tr>\n<td>fetch_and()<\/td>\n<td>LOCK AND<sup>1,2,3,4,5<\/sup><\/td>\n<td>LDCLR<sup>1<\/sup>, LDCLRA<sup>2<\/sup>, LDCLRL<sup>3<\/sup>, LDCLRAL<sup>4,5<\/sup><\/td>\n<\/tr>\n<tr>\n<td>fetch_or()<\/td>\n<td>LOCK OR<sup>1,2,3,4,5<\/sup><\/td>\n<td>LDSET<sup>1<\/sup>, LDSETA<sup>2<\/sup>, LDSETL<sup>3<\/sup>, LDSETAL<sup>4,5<\/sup><\/td>\n<\/tr>\n<tr>\n<td>fetch_xor()<\/td>\n<td>LOCK XOR<sup>1,2,3,4,5<\/sup><\/td>\n<td>LDEOR<sup>1<\/sup>, LDEORA<sup>2<\/sup>, LDEORL<sup>3<\/sup>, LDEORAL<sup>4,5<\/sup><\/td>\n<\/tr>\n<tr>\n<td>compare_exchange_strong()<\/td>\n<td rowspan=\"2\">LOCK CMPXCHG<sup>1,2,3,4,5<\/sup><\/td>\n<td rowspan=\"2\">CAS<sup>1<\/sup>, CASA<sup>2<\/sup>, CASL<sup>3<\/sup> CASAL<sup>4,5<\/sup><\/td>\n<\/tr>\n<tr>\n<td>compare_exchange_weak()<\/td>\n<\/tr>\n<\/table>\n<p>Memory order: relaxed<sup>1<\/sup>, acquire<sup>2<\/sup>, release<sup>3<\/sup>, seq_cst<sup>4<\/sup>, acq_rel<sup>5<\/sup><\/p>\n","protected":false},"excerpt":{"rendered":"<p>std::atomic Intel \/ AMD ARM (with LSE) fetch_add() LOCK XADD1,2,3,4,5 LDADD1, LDADDA2, LDADDL3, LDADDAL4,5 fetch_sub() fetch_and() LOCK AND1,2,3,4,5 LDCLR1, LDCLRA2,<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[63],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19008"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19008"}],"version-history":[{"count":13,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19008\/revisions"}],"predecessor-version":[{"id":19021,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/19008\/revisions\/19021"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19008"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}