From acc1233c8b2d007d6f515bb80944a8d8cfe53a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 20 Oct 2026 02:29:55 +0200 Subject: [PATCH] update_cpu_features: refine the set of wasm models --- lib/std/Target/wasm.zig | 67 +++++++++++++++++++---------------- tools/update_cpu_features.zig | 42 ++++++++++++++++++++++ 2 files changed, 78 insertions(+), 31 deletions(-) diff --git a/lib/std/Target/wasm.zig b/lib/std/Target/wasm.zig index edbb7eaa9aa73a799f22c2809255be48c7bf937e..609a1ef93eaa9dd475fe391e1755c4241125acbc 100644 --- a/lib/std/Target/wasm.zig +++ b/lib/std/Target/wasm.zig @@ -159,37 +159,6 @@ pub const all_features = blk: { }; pub const cpu = struct { - pub const bleeding_edge: CpuModel = .{ - .name = "bleeding_edge", - .llvm_name = "bleeding-edge", - .features = featureSet(&[_]Feature{ - .atomics, - .bulk_memory, - .exception_handling, - .extended_const, - .fp16, - .gc, - .multimemory, - .mutable_globals, - .nontrapping_fptoint, - .relaxed_simd, - .sign_ext, - .simd128, - .tail_call, - }), - }; - pub const generic: CpuModel = .{ - .name = "generic", - .llvm_name = "generic", - .features = featureSet(&[_]Feature{ - .bulk_memory, - .multivalue, - .mutable_globals, - .nontrapping_fptoint, - .reference_types, - .sign_ext, - }), - }; pub const lime1: CpuModel = .{ .name = "lime1", .llvm_name = "lime1", @@ -208,4 +177,40 @@ pub const cpu = struct { .llvm_name = "mvp", .features = featureSet(&[_]Feature{}), }; + pub const wasm_v1_0: CpuModel = .{ + .name = "wasm_v1_0", + .llvm_name = null, + .features = featureSet(&[_]Feature{ + .mutable_globals, + }), + }; + pub const wasm_v2_0: CpuModel = .{ + .name = "wasm_v2_0", + .llvm_name = null, + .features = featureSet(&[_]Feature{ + .multivalue, + .mutable_globals, + .nontrapping_fptoint, + .reference_types, + .sign_ext, + .simd128, + }), + }; + pub const wasm_v3_0: CpuModel = .{ + .name = "wasm_v3_0", + .llvm_name = null, + .features = featureSet(&[_]Feature{ + .atomics, + .exception_handling, + .extended_const, + .fp16, + .gc, + .multimemory, + .mutable_globals, + .nontrapping_fptoint, + .relaxed_simd, + .sign_ext, + .tail_call, + }), + }; }; diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig index c568c6aa8fd833eeb3a84e0968ac8a70a76e5505..b074499360f817175502ef8d053e72288b8a4ec0 100644 --- a/tools/update_cpu_features.zig +++ b/tools/update_cpu_features.zig @@ -1771,6 +1771,48 @@ const targets = [_]ArchTarget{ .deps = &.{"bulk_memory_opt"}, }, }, + .extra_cpus = &.{ + .{ + .llvm_name = null, + .zig_name = "wasm_v1_0", + .features = &.{ + "mutable_globals", + }, + }, + .{ + .llvm_name = null, + .zig_name = "wasm_v2_0", + .features = &.{ + "multivalue", + "mutable_globals", + "nontrapping_fptoint", + "reference_types", + "sign_ext", + "simd128", + }, + }, + .{ + .llvm_name = null, + .zig_name = "wasm_v3_0", + .features = &.{ + "atomics", + "exception_handling", + "extended_const", + "fp16", + "gc", + "multimemory", + "mutable_globals", + "nontrapping_fptoint", + "relaxed_simd", + "sign_ext", + "tail_call", + }, + }, + }, + .omit_cpus = &.{ + "bleeding-edge", + "generic", + }, }, .{ .zig_name = "x86", -- 2.54.0