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

#372 Integer Sign/Zero Extension for {8,16}->{32,64} #395

Closed
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
6 changes: 6 additions & 0 deletions proposals/simd/BinarySIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,9 @@ For example, `ImmLaneIdx16` is a byte with values in the range 0-15 (inclusive).
| `f32x4.convert_i32x4_u` | `0xfb`| - |
| `v128.load32_zero` | `0xfc`| - |
| `v128.load64_zero` | `0xfd`| - |
| `i32x4.widen_i8x16_u` | | - |
| `i32x4.widen_i8x16_s` | | - |
| `i64x2.widen_i8x16_u` | | - |
| `i64x2.widen_i8x16_s` | | - |
| `i64x2.widen_i16x8_u` | | - |
| `i64x2.widen_i16x8_s` | | - |
6 changes: 6 additions & 0 deletions proposals/simd/ImplementationStatus.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@
| `f32x4.convert_i32x4_u` | `-msimd128` | :heavy_check_mark: | | | :heavy_check_mark: |
| `v128.load32_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
| `v128.load64_zero` | | :heavy_check_mark: | | | :heavy_check_mark: |
| `i32x4.widen_i8x16_u` | | - | | | |
| `i32x4.widen_i8x16_s` | | - | | | |
| `i64x2.widen_i8x16_u` | | - | | | |
| `i64x2.widen_i8x16_s` | | - | | | |
| `i64x2.widen_i16x8_u` | | - | | | |
| `i64x2.widen_i16x8_s` | | - | | | |

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

Expand Down
22 changes: 22 additions & 0 deletions proposals/simd/SIMD.md
Original file line number Diff line number Diff line change
Expand Up @@ -1046,3 +1046,25 @@ def S.widen_low_T_u(a):
def S.widen_high_T_u(a):
return S.widen_high_T(Zext, a)
```
### Integer to integer Widening (Constant Immediate)
* `i32x4.widen_i8x16_u(v128: a, ImmLaneIdx4: c) -> v128`
* `i32x4.widen_i8x16_s(v128: a, ImmLaneIdx4: c) -> v128`
* `i64x2.widen_i8x16_u(v128: a, ImmLaneIdx8: c) -> v128`
* `i64x2.widen_i8x16_s(v128: a, ImmLaneIdx8: c) -> v128`
* `i64x2.widen_i16x8_u(v128: a, ImmLaneIdx4: c) -> v128`
* `i64x2.widen_i16x8_s(v128: a, ImmLaneIdx4: c) -> v128`

Using the constant immediate, widens selected integers with zero or sign extension.
```python
def S.widen_T_u(a,c):
result = S.New()
for i in range(S.Lanes):
result[i] = Zext(a[S.Lanes + i + c])
return result

def S.widen_T_s(a,c):
result = S.New()
for i in range(S.Lanes):
result[i] = Sext(a[S.Lanes + i + c])
return result
```