This new instructions matches the `bitselect` behavior described in the WASM SIMD spec (https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#bitwise-select)
46 lines
975 B
Plaintext
46 lines
975 B
Plaintext
test legalizer
|
|
set enable_simd
|
|
target x86_64 skylake
|
|
|
|
function %ishl_i32x4() -> i32x4 {
|
|
ebb0:
|
|
v0 = iconst.i32 1
|
|
v1 = vconst.i32x4 [1 2 4 8]
|
|
v2 = ishl v1, v0
|
|
; check: v3 = bitcast.i64x2 v0
|
|
; nextln: v2 = x86_psll v1, v3
|
|
return v2
|
|
}
|
|
|
|
function %ushr_i64x2() -> i64x2 {
|
|
ebb0:
|
|
v0 = iconst.i32 1
|
|
v1 = vconst.i64x2 [1 2]
|
|
v2 = ushr v1, v0
|
|
; check: v3 = bitcast.i64x2 v0
|
|
; nextln: v2 = x86_psrl v1, v3
|
|
return v2
|
|
}
|
|
|
|
function %sshr_i16x8() -> i16x8 {
|
|
ebb0:
|
|
v0 = iconst.i32 1
|
|
v1 = vconst.i16x8 [1 2 4 8 16 32 64 128]
|
|
v2 = sshr v1, v0
|
|
; check: v3 = bitcast.i64x2 v0
|
|
; nextln: v2 = x86_psra v1, v3
|
|
return v2
|
|
}
|
|
|
|
function %bitselect_i16x8() -> i16x8 {
|
|
ebb0:
|
|
v0 = vconst.i16x8 [0 0 0 0 0 0 0 0]
|
|
v1 = vconst.i16x8 [0 0 0 0 0 0 0 0]
|
|
v2 = vconst.i16x8 [0 0 0 0 0 0 0 0]
|
|
v3 = bitselect v0, v1, v2
|
|
; check: v4 = band v1, v0
|
|
; nextln: v5 = band_not v2, v0
|
|
; nextln: v3 = bor v4, v5
|
|
return v3
|
|
}
|