SIMD: implements v128 load, store and lane manipulations. (#588)

This implements various SIMD instructions related to
load, store, and lane manipulations for all engines.

Notablely, now our engines pass the following specification tests:

* simd_address.wast
* simd_const.wast
* simd_align.wast
* simd_laod16_lane.wast
* simd_laod32_lane.wast
* simd_laod64_lane.wast
* simd_laod8_lane.wast
* simd_lane.wast
* simd_load_extend.wast
* simd_load_splat.wast
* simd_load_zero.wast
* simd_store.wast
* simd_store16_lane.wast
* simd_store32_lane.wast
* simd_store64_lane.wast
* simd_store8_lane.wast

part of #484


Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Co-authored-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2022-06-01 09:30:05 +09:00
committed by GitHub
parent 0b9d9cbfda
commit 0c303258c7
38 changed files with 7775 additions and 709 deletions

View File

@@ -931,7 +931,7 @@ func TestCompile_Locals(t *testing.T) {
}},
},
expected: []Operation{
&OperationConstV128{Lo: 0, Hi: 0},
&OperationV128Const{Lo: 0, Hi: 0},
&OperationPick{Depth: 1, IsTargetVector: true}, // [p[0].low, p[0].high] -> [p[0].low, p[0].high, p[0].low, p[0].high]
&OperationDrop{Depth: &InclusiveRange{Start: 0, End: 3}},
&OperationBr{Target: &BranchTarget{}}, // return!
@@ -952,7 +952,7 @@ func TestCompile_Locals(t *testing.T) {
},
expected: []Operation{
// [p[0].lo, p[1].hi] -> [p[0].lo, p[1].hi, 0x01, 0x02]
&OperationConstV128{Lo: 0x01, Hi: 0x02},
&OperationV128Const{Lo: 0x01, Hi: 0x02},
// [p[0].lo, p[1].hi, 0x01, 0x02] -> [0x01, 0x02, p[0].lo, p[1].hi]
&OperationSwap{Depth: 3, IsTargetVector: true},
// [0x01, 0x02, p[0].lo, p[1].hi] -> [0x02, 0x01]
@@ -997,9 +997,9 @@ func TestCompile_Locals(t *testing.T) {
}},
},
expected: []Operation{
&OperationConstV128{Lo: 0, Hi: 0},
&OperationV128Const{Lo: 0, Hi: 0},
// [p[0].lo, p[1].hi] -> [p[0].lo, p[1].hi, 0x01, 0x02]
&OperationConstV128{Lo: 0x01, Hi: 0x02},
&OperationV128Const{Lo: 0x01, Hi: 0x02},
// [p[0].lo, p[1].hi, 0x01, 0x02] -> [0x01, 0x02, p[0].lo, p[1].hi]
&OperationSwap{Depth: 3, IsTargetVector: true},
// [p[0].lo, 0x02, 0x01, p[1].hi] -> [0x02, 0x01]
@@ -1023,7 +1023,7 @@ func TestCompile_Locals(t *testing.T) {
},
expected: []Operation{
// [p[0].lo, p[1].hi] -> [p[0].lo, p[1].hi, 0x01, 0x02]
&OperationConstV128{Lo: 0x01, Hi: 0x02},
&OperationV128Const{Lo: 0x01, Hi: 0x02},
// [p[0].lo, p[1].hi, 0x01, 0x02] -> [p[0].lo, p[1].hi, 0x01, 0x02, 0x01, 0x02]
&OperationPick{Depth: 1, IsTargetVector: true},
// [p[0].lo, p[1].hi, 0x01, 0x02, 0x01, 0x02] -> [0x01, 0x02, 0x01, 0x02, p[0].lo, p[1].hi]
@@ -1071,9 +1071,9 @@ func TestCompile_Locals(t *testing.T) {
}},
},
expected: []Operation{
&OperationConstV128{Lo: 0, Hi: 0},
&OperationV128Const{Lo: 0, Hi: 0},
// [p[0].lo, p[1].hi] -> [p[0].lo, p[1].hi, 0x01, 0x02]
&OperationConstV128{Lo: 0x01, Hi: 0x02},
&OperationV128Const{Lo: 0x01, Hi: 0x02},
// [p[0].lo, p[1].hi, 0x01, 0x02] -> [p[0].lo, p[1].hi, 0x01, 0x02, 0x01, 0x02]
&OperationPick{Depth: 1, IsTargetVector: true},
// [p[0].lo, p[1].hi, 0x01, 0x02, 0x01, 0x2] -> [0x01, 0x02, 0x01, 0x02, p[0].lo, p[1].hi]