@@ -2209,12 +2209,21 @@ For a simpler introduction to the ordering constraints, see the
2209
2209
same address in this global order. This corresponds to the C++0x/C1x
2210
2210
``memory_order_seq_cst `` and Java volatile.
2211
2211
2212
- .. _ singlethread :
2212
+ .. _ syncscope :
2213
2213
2214
- If an atomic operation is marked ``singlethread ``, it only *synchronizes
2215
- with * or participates in modification and seq\_ cst total orderings with
2216
- other operations running in the same thread (for example, in signal
2217
- handlers).
2214
+ If an atomic operation is marked ``syncscope("singlethread") ``, it only
2215
+ *synchronizes with * and only participates in the seq\_ cst total orderings of
2216
+ other operations running in the same thread (for example, in signal handlers).
2217
+
2218
+ If an atomic operation is marked ``syncscope("<target-scope>") ``, where
2219
+ ``<target-scope> `` is a target specific synchronization scope, then it is target
2220
+ dependent if it *synchronizes with * and participates in the seq\_ cst total
2221
+ orderings of other operations.
2222
+
2223
+ Otherwise, an atomic operation that is not marked ``syncscope("singlethread") ``
2224
+ or ``syncscope("<target-scope>") `` *synchronizes with * and participates in the
2225
+ seq\_ cst total orderings of other operations that are not marked
2226
+ ``syncscope("singlethread") `` or ``syncscope("<target-scope>") ``.
2218
2227
2219
2228
.. _fastmath :
2220
2229
@@ -7380,7 +7389,7 @@ Syntax:
7380
7389
::
7381
7390
7382
7391
<result> = load [volatile] <ty>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>][, !invariant.load !<index>][, !invariant.group !<index>][, !nonnull !<index>][, !dereferenceable !<deref_bytes_node>][, !dereferenceable_or_null !<deref_bytes_node>][, !align !<align_node>]
7383
- <result> = load atomic [volatile] <ty>, <ty>* <pointer> [singlethread ] <ordering>, align <alignment> [, !invariant.group !<index>]
7392
+ <result> = load atomic [volatile] <ty>, <ty>* <pointer> [syncscope("<target-scope>") ] <ordering>, align <alignment> [, !invariant.group !<index>]
7384
7393
!<index> = !{ i32 1 }
7385
7394
!<deref_bytes_node> = !{i64 <dereferenceable_bytes>}
7386
7395
!<align_node> = !{ i64 <value_alignment> }
@@ -7401,14 +7410,14 @@ modify the number or order of execution of this ``load`` with other
7401
7410
:ref: `volatile operations <volatile >`.
7402
7411
7403
7412
If the ``load `` is marked as ``atomic ``, it takes an extra :ref: `ordering
7404
- <ordering>` and optional ``singlethread `` argument. The `` release `` and
7405
- ``acq_rel `` orderings are not valid on ``load `` instructions. Atomic loads
7406
- produce :ref: `defined <memmodel >` results when they may see multiple atomic
7407
- stores. The type of the pointee must be an integer, pointer, or floating-point
7408
- type whose bit width is a power of two greater than or equal to eight and less
7409
- than or equal to a target-specific size limit. ``align `` must be explicitly
7410
- specified on atomic loads, and the load has undefined behavior if the alignment
7411
- is not set to a value which is at least the size in bytes of the
7413
+ <ordering>` and optional ``syncscope("<target-scope>") `` argument. The
7414
+ ``release `` and `` acq_rel `` orderings are not valid on ``load `` instructions.
7415
+ Atomic loads produce :ref: `defined <memmodel >` results when they may see
7416
+ multiple atomic stores. The type of the pointee must be an integer, pointer, or
7417
+ floating-point type whose bit width is a power of two greater than or equal to
7418
+ eight and less than or equal to a target-specific size limit. ``align `` must be
7419
+ explicitly specified on atomic loads, and the load has undefined behavior if the
7420
+ alignment is not set to a value which is at least the size in bytes of the
7412
7421
pointee. ``!nontemporal `` does not have any defined semantics for atomic loads.
7413
7422
7414
7423
The optional constant ``align `` argument specifies the alignment of the
@@ -7509,7 +7518,7 @@ Syntax:
7509
7518
::
7510
7519
7511
7520
store [volatile] <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>][, !invariant.group !<index>] ; yields void
7512
- store atomic [volatile] <ty> <value>, <ty>* <pointer> [singlethread ] <ordering>, align <alignment> [, !invariant.group !<index>] ; yields void
7521
+ store atomic [volatile] <ty> <value>, <ty>* <pointer> [syncscope("<target-scope>") ] <ordering>, align <alignment> [, !invariant.group !<index>] ; yields void
7513
7522
7514
7523
Overview:
7515
7524
"""""""""
@@ -7529,14 +7538,14 @@ allowed to modify the number or order of execution of this ``store`` with other
7529
7538
structural type <t_opaque>`) can be stored.
7530
7539
7531
7540
If the ``store `` is marked as ``atomic ``, it takes an extra :ref: `ordering
7532
- <ordering>` and optional ``singlethread `` argument. The `` acquire `` and
7533
- ``acq_rel `` orderings aren't valid on ``store `` instructions. Atomic loads
7534
- produce :ref: `defined <memmodel >` results when they may see multiple atomic
7535
- stores. The type of the pointee must be an integer, pointer, or floating-point
7536
- type whose bit width is a power of two greater than or equal to eight and less
7537
- than or equal to a target-specific size limit. ``align `` must be explicitly
7538
- specified on atomic stores, and the store has undefined behavior if the
7539
- alignment is not set to a value which is at least the size in bytes of the
7541
+ <ordering>` and optional ``syncscope("<target-scope>") `` argument. The
7542
+ ``acquire `` and `` acq_rel `` orderings aren't valid on ``store `` instructions.
7543
+ Atomic loads produce :ref: `defined <memmodel >` results when they may see
7544
+ multiple atomic stores. The type of the pointee must be an integer, pointer, or
7545
+ floating-point type whose bit width is a power of two greater than or equal to
7546
+ eight and less than or equal to a target-specific size limit. ``align `` must be
7547
+ explicitly specified on atomic stores, and the store has undefined behavior if
7548
+ the alignment is not set to a value which is at least the size in bytes of the
7540
7549
pointee. ``!nontemporal `` does not have any defined semantics for atomic stores.
7541
7550
7542
7551
The optional constant ``align `` argument specifies the alignment of the
@@ -7597,7 +7606,7 @@ Syntax:
7597
7606
7598
7607
::
7599
7608
7600
- fence [singlethread ] <ordering> ; yields void
7609
+ fence [syncscope("<target-scope>") ] <ordering> ; yields void
7601
7610
7602
7611
Overview:
7603
7612
"""""""""
@@ -7631,17 +7640,17 @@ A ``fence`` which has ``seq_cst`` ordering, in addition to having both
7631
7640
``acquire `` and ``release `` semantics specified above, participates in
7632
7641
the global program order of other ``seq_cst `` operations and/or fences.
7633
7642
7634
- The optional ":ref: `singlethread <singlethread >`" argument specifies
7635
- that the fence only synchronizes with other fences in the same thread.
7636
- (This is useful for interacting with signal handlers.)
7643
+ A ``fence `` instruction can also take an optional
7644
+ ":ref: `syncscope <syncscope >`" argument.
7637
7645
7638
7646
Example:
7639
7647
""""""""
7640
7648
7641
7649
.. code-block :: llvm
7642
7650
7643
- fence acquire ; yields void
7644
- fence singlethread seq_cst ; yields void
7651
+ fence acquire ; yields void
7652
+ fence syncscope("singlethread") seq_cst ; yields void
7653
+ fence syncscope("agent") seq_cst ; yields void
7645
7654
7646
7655
.. _i_cmpxchg :
7647
7656
@@ -7653,7 +7662,7 @@ Syntax:
7653
7662
7654
7663
::
7655
7664
7656
- cmpxchg [weak] [volatile] <ty>* <pointer>, <ty> <cmp>, <ty> <new> [singlethread ] <success ordering> <failure ordering> ; yields { ty, i1 }
7665
+ cmpxchg [weak] [volatile] <ty>* <pointer>, <ty> <cmp>, <ty> <new> [syncscope("<target-scope>") ] <success ordering> <failure ordering> ; yields { ty, i1 }
7657
7666
7658
7667
Overview:
7659
7668
"""""""""
@@ -7682,10 +7691,8 @@ must be at least ``monotonic``, the ordering constraint on failure must be no
7682
7691
stronger than that on success, and the failure ordering cannot be either
7683
7692
``release `` or ``acq_rel ``.
7684
7693
7685
- The optional "``singlethread ``" argument declares that the ``cmpxchg ``
7686
- is only atomic with respect to code (usually signal handlers) running in
7687
- the same thread as the ``cmpxchg ``. Otherwise the cmpxchg is atomic with
7688
- respect to all other code in the system.
7694
+ A ``cmpxchg `` instruction can also take an optional
7695
+ ":ref: `syncscope <syncscope >`" argument.
7689
7696
7690
7697
The pointer passed into cmpxchg must have alignment greater than or
7691
7698
equal to the size in memory of the operand.
@@ -7739,7 +7746,7 @@ Syntax:
7739
7746
7740
7747
::
7741
7748
7742
- atomicrmw [volatile] <operation> <ty>* <pointer>, <ty> <value> [singlethread ] <ordering> ; yields ty
7749
+ atomicrmw [volatile] <operation> <ty>* <pointer>, <ty> <value> [syncscope("<target-scope>") ] <ordering> ; yields ty
7743
7750
7744
7751
Overview:
7745
7752
"""""""""
@@ -7773,6 +7780,9 @@ be a pointer to that type. If the ``atomicrmw`` is marked as
7773
7780
order of execution of this ``atomicrmw `` with other :ref: `volatile
7774
7781
operations <volatile>`.
7775
7782
7783
+ A ``atomicrmw `` instruction can also take an optional
7784
+ ":ref: `syncscope <syncscope >`" argument.
7785
+
7776
7786
Semantics:
7777
7787
""""""""""
7778
7788
0 commit comments