From 6021a4e5d30f23c04d077eec5acc2e1c11c8881e Mon Sep 17 00:00:00 2001 From: Marat Dukhan Date: Tue, 2 Jun 2020 15:06:16 -0700 Subject: [PATCH] v128.load32_zero and v128.load64_zero instructions --- proposals/simd/BinarySIMD.md | 2 ++ proposals/simd/ImplementationStatus.md | 2 ++ proposals/simd/NewOpcodes.md | 2 ++ proposals/simd/SIMD.md | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/proposals/simd/BinarySIMD.md b/proposals/simd/BinarySIMD.md index 4297afbd3..5991031b9 100644 --- a/proposals/simd/BinarySIMD.md +++ b/proposals/simd/BinarySIMD.md @@ -222,3 +222,5 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive). | `i32x4.trunc_sat_f32x4_u` | `0xf9`| - | | `f32x4.convert_i32x4_s` | `0xfa`| - | | `f32x4.convert_i32x4_u` | `0xfb`| - | +| `v128.load32_zero` | `0xfc`| - | +| `v128.load64_zero` | `0xfd`| - | diff --git a/proposals/simd/ImplementationStatus.md b/proposals/simd/ImplementationStatus.md index 68178f9a7..2879f6486 100644 --- a/proposals/simd/ImplementationStatus.md +++ b/proposals/simd/ImplementationStatus.md @@ -190,6 +190,8 @@ | `i32x4.trunc_sat_f32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | | `f32x4.convert_i32x4_s` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | | `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: | +| `v128.load32_zero` | | | | | | +| `v128.load64_zero` | | | | | | [1] Tip of tree LLVM as of May 20, 2020 diff --git a/proposals/simd/NewOpcodes.md b/proposals/simd/NewOpcodes.md index e9aa7efb5..6b2b77adf 100644 --- a/proposals/simd/NewOpcodes.md +++ b/proposals/simd/NewOpcodes.md @@ -12,6 +12,8 @@ | v128.load32_splat | 0x09 | | v128.load64_splat | 0x0a | | v128.store | 0x0b | +| v128.load32_zero | 0xfc | +| v128.load64_zero | 0xfd | | Basic operation | opcode | | ----------------| ------ | diff --git a/proposals/simd/SIMD.md b/proposals/simd/SIMD.md index 0b6b9cde6..4d217a447 100644 --- a/proposals/simd/SIMD.md +++ b/proposals/simd/SIMD.md @@ -766,6 +766,24 @@ def S.load(memarg): return S.from_bytes(memory[memarg.offset:memarg.offset + 16]) ``` +### Load and Zero-Pad + +* `v128.load32_zero(memarg) -> v128` +* `v128.load64_zero(memarg) -> v128` + +Load a single 32-bit or 64-bit element into the lowest bits of a `v128` vector, +and initialize all other bits of the `v128` vector to zero. + +```python +def S.load32_zero(memarg): + return S.from_bytes(memory[memarg.offset:memarg.offset + 4]) +``` + +```python +def S.load64_zero(memarg): + return S.from_bytes(memory[memarg.offset:memarg.offset + 8]) +``` + ### Load and Splat * `v128.load8_splat(memarg) -> v128`