Add unarrow instruction with x86 implementation

Adds a shared `unarrow` instruction in order to lower the Wasm SIMD specification's unsigned narrowing (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing). Additionally, this commit implements the instruction for x86 using PACKUSWB and PACKUSDW for the applicable encodings.
This commit is contained in:
Andrew Brown
2020-07-01 10:46:59 -07:00
parent 65e6de2344
commit 057c93b64e
6 changed files with 47 additions and 3 deletions

View File

@@ -118,8 +118,9 @@ block0(v0: i32x4 [%xmm7], v1: i32x4 [%xmm6]):
return
}
function %snarrow_i16x8(i16x8, i16x8) {
function %narrowing_i16x8(i16x8, i16x8) {
block0(v0: i16x8 [%xmm7], v1: i16x8 [%xmm8]):
[-, %xmm7] v2 = snarrow v0, v1 ; bin: 66 41 0f 63 f8
[-, %xmm7] v3 = unarrow v0, v1 ; bin: 66 41 0f 67 f8
return
}

View File

@@ -212,3 +212,10 @@ block0(v0: i32x4, v1: i32x4):
return v2
}
; run: %snarrow([0 1 -1 0x0001ffff], [4 5 -6 0xffffffff]) == [0 1 -1 0x7fff 4 5 -6 0xffff]
function %unarrow(i32x4, i32x4) -> i16x8 {
block0(v0: i32x4, v1: i32x4):
v2 = unarrow v0, v1
return v2
}
; run: %unarrow([0 1 -1 0x0001ffff], [4 5 -6 0xffffffff]) == [0 1 0 0xffff 4 5 0 0]