Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

move{32,64}_zero_{r,v} instructions #374

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,7 @@ 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.move32_zero_r` | `0xfe`| - |
| `v128.move32_zero_v` | `0xff`| - |
| `v128.move64_zero_r` | `0x100`| - |
| `v128.move64_zero_v` | `0x101`| - |
4 changes: 4 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@
| `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.move32_zero_r` | | | | |
| `v128.move32_zero_v` | | | | |
| `v128.move64_zero_r` | | | | |
| `v128.move64_zero_v` | | | | |

[1] Tip of tree LLVM as of May 20, 2020

Expand Down
30 changes: 30 additions & 0 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,33 @@ def S.widen_low_T_u(a):
def S.widen_high_T_u(a):
return S.widen_high_T(Zext, a)
```


### Move and Zero-Pad

* `v128.move32_zero_r(x: i32) -> v128`
* `v128.move32_zero_v(a: v128) -> v128`
* `v128.move64_zero_r(x: i64) -> v128`
* `v128.move64_zero_v(a: v128) -> v128`

Move a single 32-bit or 64-bit element into the lowest bits of `v128` vector,
and initialize all other bits of the `v128` vector to zero.
```python
def S.moveT_zero_r(x):
result = S.New()
for i in range(S.Lanes):
if i == 0:
result[i] = x
else:
result[i] = 0
return result

def S.moveT_zero_v(a):
result = S.New()
for i in range(S.Lanes):
if i == 0:
result[i] = a[i]
else:
result[i] = 0
return result
```