Skip to content

Commit

Permalink
[simd/v3i]: Implement v128 load_zero
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyu-zc committed Nov 17, 2023
1 parent 7474dea commit d0339e7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/engine/v3/V3Interpreter.v3
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ component V3Interpreter {
V128_LOAD_32_SPLAT => doLoadSplat(4, 2, DataReaders.read_range_u32);
V128_LOAD_16_SPLAT => doLoadSplat(2, 1, DataReaders.read_range_u32_u16);
V128_LOAD_8_SPLAT => doLoadSplat(1, 0, DataReaders.read_range_u32_u8);
V128_LOAD_32_ZERO => doLoadZero(4, DataReaders.read_range_u32);
V128_LOAD_64_ZERO => doLoadZero(8, DataReaders.read_range_u64);
V128_STORE => doStore(16, DataWriters.write_range_u128, Values.v_v128);
V128_CONST => {
var low = codeptr.read_u64();
Expand Down Expand Up @@ -1139,6 +1141,13 @@ component V3Interpreter {
}
push(Value.V128(low, high));
}
def doLoadZero<T>(size: byte, read: Range<byte> -> T) {
var t = doLoadReg(size);
if (t.reason != TrapReason.NONE) return trap(t.reason);
var val = u64.!(read(t.result));
var high = 0ul;
push(Value.V128(val, high));
}
def doExtractLane<T, S>(log2_size: u3, view: u64 -> T, extend: T -> S, stack_push: (S) -> void) {
var v = Values.v_v128(pop());
var idx = codeptr.read1();
Expand Down

0 comments on commit d0339e7

Please sign in to comment.