Replace x86_packss with snarrow

Since the Wasm specification contains narrowing instructions (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing) that lower to PACKSS*, the x86-specific instruction is not necessary in the CLIF IR.
This commit is contained in:
Andrew Brown
2020-07-01 10:30:43 -07:00
parent 152d7fcee7
commit 65e6de2344
8 changed files with 46 additions and 50 deletions

View File

@@ -34,7 +34,7 @@ block0:
; nextln: v9 = raw_bitcast.i16x8 v8
; nextln: v10 = x86_psra v9, v4
; nextln: v2 = x86_packss v7, v10
; nextln: v2 = snarrow v7, v10
return v2
}

View File

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

View File

@@ -206,15 +206,9 @@ block0:
}
; run
function %pack() -> b1 {
block0:
v0 = vconst.i32x4 [0 1 -1 0x0001ffff]
v1 = vconst.i32x4 [4 5 -6 0xffffffff]
v2 = x86_packss v0, v1
v3 = vconst.i16x8 [0 1 -1 0x7fff 4 5 -6 0xffff]
v4 = icmp eq v2, v3
v5 = vall_true v4
return v5
function %snarrow(i32x4, i32x4) -> i16x8 {
block0(v0: i32x4, v1: i32x4):
v2 = snarrow v0, v1
return v2
}
; run
; run: %snarrow([0 1 -1 0x0001ffff], [4 5 -6 0xffffffff]) == [0 1 -1 0x7fff 4 5 -6 0xffff]