Skip to content

Commit 9f262a0

Browse files
authored
[LSFE] Update fetch_add to add atomic floating-point operations (ARM-software#307)
Add details of atomic floating-point operations for `fetch_add`, for 16-bit, 32-bit and 64-bit floating-point types. No support for 8-bit and 128-bit types.
1 parent 92cd879 commit 9f262a0

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

‎atomicsabi64/atomicsabi64.rst‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ changes to the content of the document for that release.
217217
| Issue | Date | Change |
218218
+=========+==============================+===================================================================+
219219
| 00alp0 | 5\ :sup:`th` September 2024 | Alpha Release. |
220+
| 00alp1 | 5\ :sup:`th` February 2025 | Added table for floating-point atomic `fetch_add` operations |
220221
+---------+------------------------------+-------------------------------------------------------------------+
221222

222223

@@ -1061,6 +1062,97 @@ compare-exchange. The result is returned in ``X0`` and ``X1``.
10611062
+-------------------------------------+---------------+--------------------------------------+
10621063

10631064

1065+
32-bit floating-point types
1066+
---------------------------
1067+
1068+
In what follows, register ``X1`` contains the location ``loc`` and ``S1``
1069+
contains ``val``. The value initially loaded from memory is returned in
1070+
``S0``.
1071+
1072+
.. table::
1073+
1074+
+-----------------------------------------------------+--------------------------------------+
1075+
| Atomic Operation | AArch64 |
1076+
+=====================================+===============+======================================+
1077+
| ``fetch_add(loc,val,relaxed)`` | ``Armv8-A`` | .. code-block:: none |
1078+
| | | |
1079+
| | | loop: |
1080+
| | | LDXR W0, [X1] |
1081+
| | | FMOV S0, W0 |
1082+
| | | FADD S1, S1, S0 |
1083+
| | | FMOV W0, S1 |
1084+
| | | STXR W3, W0, [X1] |
1085+
| | | CBNZ W3, loop |
1086+
| +---------------+--------------------------------------+
1087+
| | ``FEAT_LSFE`` | .. code-block:: none |
1088+
| | | |
1089+
| | | LDFADD S1, S0, [X1] |
1090+
+-------------------------------------+---------------+--------------------------------------+
1091+
| ``fetch_add(loc,val,acquire)`` | ``Armv8-A`` | .. code-block:: none |
1092+
| | | |
1093+
| | | loop: |
1094+
| | | LDAXR W0, [X1] |
1095+
| | | FMOV S0, W0 |
1096+
| | | FADD S1, S1, S0 |
1097+
| | | FMOV W0, S1 |
1098+
| | | STXR W3, W0, [X1] |
1099+
| | | CBNZ W3, loop |
1100+
| +---------------+--------------------------------------+
1101+
| | ``FEAT_LSFE`` | .. code-block:: none |
1102+
| | | |
1103+
| | | LDFADDA S1, S0, [X1] |
1104+
+-------------------------------------+---------------+--------------------------------------+
1105+
| ``fetch_add(loc,val,release)`` | ``Armv8-A`` | .. code-block:: none |
1106+
| | | |
1107+
| | | loop: |
1108+
| | | LDXR W0, [X1] |
1109+
| | | FMOV S0, W0 |
1110+
| | | FADD S1, S1, S0 |
1111+
| | | FMOV W0, S1 |
1112+
| | | STLXR W3, W0, [X1] |
1113+
| | | CBNZ W3, loop |
1114+
| +---------------+--------------------------------------+
1115+
| | ``FEAT_LSFE`` | .. code-block:: none |
1116+
| | | |
1117+
| | | LDFADDL S1, S0, [X1] |
1118+
+-------------------------------------+---------------+--------------------------------------+
1119+
| ``fetch_add(loc,val,acq_rel)`` | ``Armv8-A`` | .. code-block:: none |
1120+
| ``fetch_add(loc,val,seq_cst)`` | | |
1121+
| | | loop: |
1122+
| | | LDAXR W0, [X1] |
1123+
| | | FMOV S0, W0 |
1124+
| | | FADD S1, S1, S0 |
1125+
| | | FMOV W0, S1 |
1126+
| | | STLXR W3, W0, [X1] |
1127+
| | | CBNZ W3, loop |
1128+
| +---------------+--------------------------------------+
1129+
| | ``FEAT_LSFE`` | .. code-block:: none |
1130+
| | | |
1131+
| | | LDFADDAL S1, S0, [X1] |
1132+
+-------------------------------------+---------------+--------------------------------------+
1133+
1134+
8-bit floating-point types
1135+
--------------------------
1136+
1137+
Floating-point atomic operations not supported for 8-bit types.
1138+
1139+
16-bit floating-point types
1140+
---------------------------
1141+
1142+
The mappings for 16-bit types are the same as 32-bit types except the registers
1143+
used are ``H``-registers, and they use the ``H`` variants of instructions.
1144+
1145+
64-bit floating-point types
1146+
---------------------------
1147+
1148+
The mappings for 64-bit types are the same as 32-bit types except the registers
1149+
used are ``D``-registers and ``X``-general purpose registers.
1150+
1151+
128-bit floating-point types
1152+
----------------------------
1153+
1154+
Floating-point atomic operations not supported for 128-bit types.
1155+
10641156

10651157
Special Cases
10661158
=============

0 commit comments

Comments
 (0)