@@ -1231,6 +1231,68 @@ Memory Instructions
1231
1231
\end {array}
1232
1232
1233
1233
1234
+ .. _exec-load-lane :
1235
+
1236
+ :math: `\V128 \K {.}\LOAD {N}\K {\_lane}~\memarg ~x`
1237
+ .....................................................
1238
+
1239
+ 1. Let :math: `F` be the :ref: `current <exec-notation-textual >` :ref: `frame <syntax-frame >`.
1240
+
1241
+ 2. Assert: due to :ref: `validation <valid-load-extend >`, :math: `F.\AMODULE .\MIMEMS [0 ]` exists.
1242
+
1243
+ 3. Let :math: `a` be the :ref: `memory address <syntax-memaddr >` :math: `F.\AMODULE .\MIMEMS [0 ]`.
1244
+
1245
+ 4. Assert: due to :ref: `validation <valid-load-extend >`, :math: `S.\SMEMS [a]` exists.
1246
+
1247
+ 5. Let :math: `\X {mem}` be the :ref: `memory instance <syntax-meminst >` :math: `S.\SMEMS [a]`.
1248
+
1249
+ 6. Assert: due to :ref: `validation <valid-load-extend >`, a value of :ref: `value type <syntax-valtype >` |V128 | is on the top of the stack.
1250
+
1251
+ 7. Pop the value :math: `\V128 .\CONST ~v` from the stack.
1252
+
1253
+ 8. Assert: due to :ref: `validation <valid-load-extend >`, a value of :ref: `value type <syntax-valtype >` |I32 | is on the top of the stack.
1254
+
1255
+ 9. Pop the value :math: `\I32 .\CONST ~i` from the stack.
1256
+
1257
+ 10. Let :math: `\X {ea}` be the integer :math: `i + \memarg .\OFFSET `.
1258
+
1259
+ 11. If :math: `\X {ea} + N/8 ` is larger than the length of :math: `\X {mem}.\MIDATA `, then:
1260
+
1261
+ a. Trap.
1262
+
1263
+ 12. Let :math: `b^\ast ` be the byte sequence :math: `\X {mem}.\MIDATA [\X {ea} \slice N/8 ]`.
1264
+
1265
+ 13. Let :math: `r` be the constant for which :math: `\bytes _{\iN }(r) = b^\ast `.
1266
+
1267
+ 14. Let :math: `L` be :math: `128 / N`.
1268
+
1269
+ 15. Let :math: `c` be the result of computing :math: `\lanes ^{-1 }_{\K {i}N\K {x}L}(\lanes _{\K {i}N\K {x}L}(v) \with [x] = r)`.
1270
+
1271
+ 16. Push the value :math: `\V128 .\CONST ~c` to the stack.
1272
+
1273
+ .. math ::
1274
+ ~\\[-1 ex]
1275
+ \begin {array}{l}
1276
+ \begin {array}{lcl@{\qquad }l}
1277
+ S; F; (\I32 .\CONST ~i)~(\V128 .\CONST ~v)~(\V128 \K {.}\LOAD {N}\K {\_lane}~\memarg ~x) &\stepto & S; F; (\V128 .\CONST ~c)
1278
+ \end {array}
1279
+ \\ \qquad
1280
+ \begin {array}[t]{@{}r@{~}l@{}}
1281
+ (\iff & \X {ea} = i + \memarg .\OFFSET \\
1282
+ \wedge & \X {ea} + N/8 \leq |S.\SMEMS [F.\AMODULE .\MIMEMS [0 ]].\MIDATA | \\
1283
+ \wedge & \bytes _{\iN }(r) = S.\SMEMS [F.\AMODULE .\MIMEMS [0 ]].\MIDATA [\X {ea} \slice N/8 ]) \\
1284
+ \wedge & L = 128 /N \\
1285
+ \wedge & c = \lanes ^{-1 }_{\K {i}N\K {x}L}(\lanes _{\K {i}N\K {x}L}(v) \with [x] = r)
1286
+ \end {array}
1287
+ \\[ 1 ex]
1288
+ \begin {array}{lcl@{\qquad }l}
1289
+ S; F; (\I32 .\CONST ~k)~(\V128 .\CONST ~v)~(\V128 .\LOAD {N}\K {\_lane}~\memarg ~x) &\stepto & S; F; \TRAP
1290
+ \end {array}
1291
+ \\ \qquad
1292
+ (\otherwise ) \\
1293
+ \end {array}
1294
+
1295
+
1234
1296
.. _exec-store :
1235
1297
.. _exec-storen :
1236
1298
@@ -1308,6 +1370,63 @@ Memory Instructions
1308
1370
\end {array}
1309
1371
1310
1372
1373
+ .. _exec-store-lane :
1374
+
1375
+ :math: `\V128 \K {.}\STORE {N}\K {\_lane}~\memarg ~x`
1376
+ ......................................................
1377
+
1378
+ 1. Let :math: `F` be the :ref: `current <exec-notation-textual >` :ref: `frame <syntax-frame >`.
1379
+
1380
+ 2. Assert: due to :ref: `validation <valid-storen >`, :math: `F.\AMODULE .\MIMEMS [0 ]` exists.
1381
+
1382
+ 3. Let :math: `a` be the :ref: `memory address <syntax-memaddr >` :math: `F.\AMODULE .\MIMEMS [0 ]`.
1383
+
1384
+ 4. Assert: due to :ref: `validation <valid-storen >`, :math: `S.\SMEMS [a]` exists.
1385
+
1386
+ 5. Let :math: `\X {mem}` be the :ref: `memory instance <syntax-meminst >` :math: `S.\SMEMS [a]`.
1387
+
1388
+ 6. Assert: due to :ref: `validation <valid-storen >`, a value of :ref: `value type <syntax-valtype >` :math: `\V128 ` is on the top of the stack.
1389
+
1390
+ 7. Pop the value :math: `\V128 .\CONST ~c` from the stack.
1391
+
1392
+ 8. Assert: due to :ref: `validation <valid-storen >`, a value of :ref: `value type <syntax-valtype >` |I32 | is on the top of the stack.
1393
+
1394
+ 9. Pop the value :math: `\I32 .\CONST ~i` from the stack.
1395
+
1396
+ 10. Let :math: `\X {ea}` be the integer :math: `i + \memarg .\OFFSET `.
1397
+
1398
+ 11. If :math: `\X {ea} + N/8 ` is larger than the length of :math: `\X {mem}.\MIDATA `, then:
1399
+
1400
+ a. Trap.
1401
+
1402
+ 12. Let :math: `L` be :math: `128 /N`.
1403
+
1404
+ 13. Let :math: `b^\ast ` be the byte sequence :math: `\bytes _{\iN }(\lanes _{\K {i}N\K {x}L}(c)[x])`.
1405
+
1406
+ 14. Replace the bytes :math: `\X {mem}.\MIDATA [\X {ea} \slice N/8 ]` with :math: `b^\ast `.
1407
+
1408
+ .. math ::
1409
+ ~\\[-1 ex]
1410
+ \begin {array}{l}
1411
+ \begin {array}{lcl@{\qquad }l}
1412
+ S; F; (\I32 .\CONST ~i)~(\V128 .\CONST ~c)~(\V128 .\STORE {N}\K {\_lane}~\memarg ~x) &\stepto & S'; F; \epsilon
1413
+ \end {array}
1414
+ \\ \qquad
1415
+ \begin {array}[t]{@{}r@{~}l@{}}
1416
+ (\iff & \X {ea} = i + \memarg .\OFFSET \\
1417
+ \wedge & \X {ea} + N \leq |S.\SMEMS [F.\AMODULE .\MIMEMS [0 ]].\MIDATA | \\
1418
+ \wedge & L = 128 /N \\
1419
+ \wedge & S' = S \with \SMEMS [F.\AMODULE .\MIMEMS [0 ]].\MIDATA [\X {ea} \slice N/8 ] = \bytes _{\iN }(\lanes _{\K {i}N\K {x}L}(c)[x])
1420
+ \end {array}
1421
+ \\[ 1 ex]
1422
+ \begin {array}{lcl@{\qquad }l}
1423
+ S; F; (\I32 .\CONST ~k)~(\V128 .\CONST ~c)~(\V128 .\STORE {N}\K {\_lane}~\memarg ~x) &\stepto & S; F; \TRAP
1424
+ \end {array}
1425
+ \\ \qquad
1426
+ (\otherwise ) \\
1427
+ \end {array}
1428
+
1429
+
1311
1430
.. _exec-memory.size :
1312
1431
1313
1432
:math: `\MEMORYSIZE `
0 commit comments