Skip to content

Conversation

@kounoike
Copy link
Contributor

std.simd.suggestVectorSizeForCpu didn't support Wasm SIMD
This PR adds Wasm SIMD support.

$ zig version
0.11.0-dev.1987+a2c6ecd6d
$ cat wasm-simd.zig 
const std = @import("std");

pub fn main() !void {
    const wasm_simd_model = std.Target.wasm.cpu.bleeding_edge;
    const wasm_simd_cpu = comptime std.Target.Cpu.Model.toCpu(&wasm_simd_model, std.Target.Cpu.Arch.wasm32);

    std.debug.print("vector size for u8(wasm) {?}\n", .{std.simd.suggestVectorSizeForCpu(u8, wasm_simd_cpu)});
}
$ zig run wasm-simd.zig 
vector size for u8(wasm) null
$ zig run --zig-lib-dir ~/ghq/github.com/ziglang/zig/lib wasm-simd.zig 
vector size for u8(wasm) 16

@kounoike kounoike force-pushed the wasm-simd-vector-size branch from 25660be to ecbdc5e Compare March 17, 2023 23:58
@jedisct1 jedisct1 merged commit 5df31f3 into ziglang:master Mar 20, 2023
truemedian pushed a commit to truemedian/zig that referenced this pull request Mar 30, 2023
@kounoike kounoike deleted the wasm-simd-vector-size branch May 7, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants