authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-28 01:00:12+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-30 06:36:41+02:00
log978555eea47a4d401e21735a01c806bbcf8a5199
treec17f8dc85a9d18cb41d73361ff49996cf063f0e7
parent2c0cc81e745ddcea072bce6895a3ba31523d73f8
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target.x86: purge avx10.n-256, rename avx10.n_512 to avx10.n, require evex512 for avx512f

Intel has abandoned AVX10.N/128,256; AVX10.N is now always 512-bit.

3 files changed, 32 insertions(+), 49 deletions(-)

lib/std/Target/x86.zig+9-44
...@@ -24,10 +24,8 @@ pub const Feature = enum {...@@ -24,10 +24,8 @@ pub const Feature = enum {
24 amx_tile,24 amx_tile,
25 amx_transpose,25 amx_transpose,
26 avx,26 avx,
27 avx10_1_256,27 avx10_1,
28 avx10_1_512,28 avx10_2,
29 avx10_2_256,
30 avx10_2_512,
31 avx2,29 avx2,
32 avx512bf16,30 avx512bf16,
33 avx512bitalg,31 avx512bitalg,
...@@ -340,9 +338,9 @@ pub const all_features = blk: {...@@ -340,9 +338,9 @@ pub const all_features = blk: {
340 .sse4_2,338 .sse4_2,
341 }),339 }),
342 };340 };
343 result[@intFromEnum(Feature.avx10_1_256)] = .{341 result[@intFromEnum(Feature.avx10_1)] = .{
344 .llvm_name = "avx10.1-256",342 .llvm_name = "avx10.1-512",
345 .description = "Support AVX10.1 up to 256-bit instruction",343 .description = "Support AVX10.1 up to 512-bit instruction",
346 .dependencies = featureSet(&[_]Feature{344 .dependencies = featureSet(&[_]Feature{
347 .avx512bf16,345 .avx512bf16,
348 .avx512bitalg,346 .avx512bitalg,
...@@ -357,27 +355,11 @@ pub const all_features = blk: {...@@ -357,27 +355,11 @@ pub const all_features = blk: {
357 .avx512vpopcntdq,355 .avx512vpopcntdq,
358 }),356 }),
359 };357 };
360 result[@intFromEnum(Feature.avx10_1_512)] = .{358 result[@intFromEnum(Feature.avx10_2)] = .{
361 .llvm_name = "avx10.1-512",
362 .description = "Support AVX10.1 up to 512-bit instruction",
363 .dependencies = featureSet(&[_]Feature{
364 .avx10_1_256,
365 .evex512,
366 }),
367 };
368 result[@intFromEnum(Feature.avx10_2_256)] = .{
369 .llvm_name = "avx10.2-256",
370 .description = "Support AVX10.2 up to 256-bit instruction",
371 .dependencies = featureSet(&[_]Feature{
372 .avx10_1_256,
373 }),
374 };
375 result[@intFromEnum(Feature.avx10_2_512)] = .{
376 .llvm_name = "avx10.2-512",359 .llvm_name = "avx10.2-512",
377 .description = "Support AVX10.2 up to 512-bit instruction",360 .description = "Support AVX10.2 up to 512-bit instruction",
378 .dependencies = featureSet(&[_]Feature{361 .dependencies = featureSet(&[_]Feature{
379 .avx10_1_512,362 .avx10_1,
380 .avx10_2_256,
381 }),363 }),
382 };364 };
383 result[@intFromEnum(Feature.avx2)] = .{365 result[@intFromEnum(Feature.avx2)] = .{
...@@ -434,6 +416,7 @@ pub const all_features = blk: {...@@ -434,6 +416,7 @@ pub const all_features = blk: {
434 .description = "Enable AVX-512 instructions",416 .description = "Enable AVX-512 instructions",
435 .dependencies = featureSet(&[_]Feature{417 .dependencies = featureSet(&[_]Feature{
436 .avx2,418 .avx2,
419 .evex512,
437 .f16c,420 .f16c,
438 .fma,421 .fma,
439 }),422 }),
...@@ -2192,7 +2175,6 @@ pub const cpu = struct {...@@ -2192,7 +2175,6 @@ pub const cpu = struct {
2192 .cmov,2175 .cmov,
2193 .cx16,2176 .cx16,
2194 .ermsb,2177 .ermsb,
2195 .evex512,
2196 .fast_15bytenop,2178 .fast_15bytenop,
2197 .fast_gather,2179 .fast_gather,
2198 .fast_scalar_fsqrt,2180 .fast_scalar_fsqrt,
...@@ -2252,7 +2234,6 @@ pub const cpu = struct {...@@ -2252,7 +2234,6 @@ pub const cpu = struct {
2252 .cmov,2234 .cmov,
2253 .cx16,2235 .cx16,
2254 .ermsb,2236 .ermsb,
2255 .evex512,
2256 .false_deps_popcnt,2237 .false_deps_popcnt,
2257 .fast_15bytenop,2238 .fast_15bytenop,
2258 .fast_gather,2239 .fast_gather,
...@@ -2392,7 +2373,6 @@ pub const cpu = struct {...@@ -2392,7 +2373,6 @@ pub const cpu = struct {
2392 .cmov,2373 .cmov,
2393 .cx16,2374 .cx16,
2394 .ermsb,2375 .ermsb,
2395 .evex512,
2396 .false_deps_popcnt,2376 .false_deps_popcnt,
2397 .fast_15bytenop,2377 .fast_15bytenop,
2398 .fast_gather,2378 .fast_gather,
...@@ -2485,7 +2465,7 @@ pub const cpu = struct {...@@ -2485,7 +2465,7 @@ pub const cpu = struct {
2485 .amx_movrs,2465 .amx_movrs,
2486 .amx_tf32,2466 .amx_tf32,
2487 .amx_transpose,2467 .amx_transpose,
2488 .avx10_2_512,2468 .avx10_2,
2489 .avxifma,2469 .avxifma,
2490 .avxneconvert,2470 .avxneconvert,
2491 .avxvnni,2471 .avxvnni,
...@@ -2601,7 +2581,6 @@ pub const cpu = struct {...@@ -2601,7 +2581,6 @@ pub const cpu = struct {
2601 .cx16,2581 .cx16,
2602 .enqcmd,2582 .enqcmd,
2603 .ermsb,2583 .ermsb,
2604 .evex512,
2605 .false_deps_getmant,2584 .false_deps_getmant,
2606 .false_deps_mulc,2585 .false_deps_mulc,
2607 .false_deps_mullq,2586 .false_deps_mullq,
...@@ -2914,7 +2893,6 @@ pub const cpu = struct {...@@ -2914,7 +2893,6 @@ pub const cpu = struct {
2914 .cx16,2893 .cx16,
2915 .enqcmd,2894 .enqcmd,
2916 .ermsb,2895 .ermsb,
2917 .evex512,
2918 .false_deps_getmant,2896 .false_deps_getmant,
2919 .false_deps_mulc,2897 .false_deps_mulc,
2920 .false_deps_mullq,2898 .false_deps_mullq,
...@@ -3004,7 +2982,6 @@ pub const cpu = struct {...@@ -3004,7 +2982,6 @@ pub const cpu = struct {
3004 .cx16,2982 .cx16,
3005 .enqcmd,2983 .enqcmd,
3006 .ermsb,2984 .ermsb,
3007 .evex512,
3008 .false_deps_getmant,2985 .false_deps_getmant,
3009 .false_deps_mulc,2986 .false_deps_mulc,
3010 .false_deps_mullq,2987 .false_deps_mullq,
...@@ -3167,7 +3144,6 @@ pub const cpu = struct {...@@ -3167,7 +3144,6 @@ pub const cpu = struct {
3167 .cmov,3144 .cmov,
3168 .cx16,3145 .cx16,
3169 .ermsb,3146 .ermsb,
3170 .evex512,
3171 .fast_15bytenop,3147 .fast_15bytenop,
3172 .fast_gather,3148 .fast_gather,
3173 .fast_scalar_fsqrt,3149 .fast_scalar_fsqrt,
...@@ -3231,7 +3207,6 @@ pub const cpu = struct {...@@ -3231,7 +3207,6 @@ pub const cpu = struct {
3231 .cmov,3207 .cmov,
3232 .cx16,3208 .cx16,
3233 .ermsb,3209 .ermsb,
3234 .evex512,
3235 .fast_15bytenop,3210 .fast_15bytenop,
3236 .fast_gather,3211 .fast_gather,
3237 .fast_scalar_fsqrt,3212 .fast_scalar_fsqrt,
...@@ -3394,7 +3369,6 @@ pub const cpu = struct {...@@ -3394,7 +3369,6 @@ pub const cpu = struct {
3394 .bmi2,3369 .bmi2,
3395 .cmov,3370 .cmov,
3396 .cx16,3371 .cx16,
3397 .evex512,
3398 .fast_gather,3372 .fast_gather,
3399 .fast_imm16,3373 .fast_imm16,
3400 .fast_movbe,3374 .fast_movbe,
...@@ -3436,7 +3410,6 @@ pub const cpu = struct {...@@ -3436,7 +3410,6 @@ pub const cpu = struct {
3436 .bmi2,3410 .bmi2,
3437 .cmov,3411 .cmov,
3438 .cx16,3412 .cx16,
3439 .evex512,
3440 .fast_gather,3413 .fast_gather,
3441 .fast_imm16,3414 .fast_imm16,
3442 .fast_movbe,3415 .fast_movbe,
...@@ -4003,7 +3976,6 @@ pub const cpu = struct {...@@ -4003,7 +3976,6 @@ pub const cpu = struct {
4003 .cmov,3976 .cmov,
4004 .cx16,3977 .cx16,
4005 .ermsb,3978 .ermsb,
4006 .evex512,
4007 .fast_15bytenop,3979 .fast_15bytenop,
4008 .fast_gather,3980 .fast_gather,
4009 .fast_scalar_fsqrt,3981 .fast_scalar_fsqrt,
...@@ -4104,7 +4076,6 @@ pub const cpu = struct {...@@ -4104,7 +4076,6 @@ pub const cpu = struct {
4104 .cx16,4076 .cx16,
4105 .enqcmd,4077 .enqcmd,
4106 .ermsb,4078 .ermsb,
4107 .evex512,
4108 .false_deps_getmant,4079 .false_deps_getmant,
4109 .false_deps_mulc,4080 .false_deps_mulc,
4110 .false_deps_mullq,4081 .false_deps_mullq,
...@@ -4277,7 +4248,6 @@ pub const cpu = struct {...@@ -4277,7 +4248,6 @@ pub const cpu = struct {
4277 .cmov,4248 .cmov,
4278 .cx16,4249 .cx16,
4279 .ermsb,4250 .ermsb,
4280 .evex512,
4281 .false_deps_popcnt,4251 .false_deps_popcnt,
4282 .fast_15bytenop,4252 .fast_15bytenop,
4283 .fast_gather,4253 .fast_gather,
...@@ -4390,7 +4360,6 @@ pub const cpu = struct {...@@ -4390,7 +4360,6 @@ pub const cpu = struct {
4390 .cmov,4360 .cmov,
4391 .cx16,4361 .cx16,
4392 .ermsb,4362 .ermsb,
4393 .evex512,
4394 .false_deps_popcnt,4363 .false_deps_popcnt,
4395 .fast_15bytenop,4364 .fast_15bytenop,
4396 .fast_gather,4365 .fast_gather,
...@@ -4485,7 +4454,6 @@ pub const cpu = struct {...@@ -4485,7 +4454,6 @@ pub const cpu = struct {
4485 .cmov,4454 .cmov,
4486 .cx16,4455 .cx16,
4487 .ermsb,4456 .ermsb,
4488 .evex512,
4489 .fast_15bytenop,4457 .fast_15bytenop,
4490 .fast_gather,4458 .fast_gather,
4491 .fast_scalar_fsqrt,4459 .fast_scalar_fsqrt,
...@@ -4706,7 +4674,6 @@ pub const cpu = struct {...@@ -4706,7 +4674,6 @@ pub const cpu = struct {
4706 .bmi2,4674 .bmi2,
4707 .cmov,4675 .cmov,
4708 .cx16,4676 .cx16,
4709 .evex512,
4710 .false_deps_popcnt,4677 .false_deps_popcnt,
4711 .fast_15bytenop,4678 .fast_15bytenop,
4712 .fast_gather,4679 .fast_gather,
...@@ -4943,7 +4910,6 @@ pub const cpu = struct {...@@ -4943,7 +4910,6 @@ pub const cpu = struct {
4943 .clzero,4910 .clzero,
4944 .cmov,4911 .cmov,
4945 .cx16,4912 .cx16,
4946 .evex512,
4947 .fast_15bytenop,4913 .fast_15bytenop,
4948 .fast_bextr,4914 .fast_bextr,
4949 .fast_dpwssd,4915 .fast_dpwssd,
...@@ -5017,7 +4983,6 @@ pub const cpu = struct {...@@ -5017,7 +4983,6 @@ pub const cpu = struct {
5017 .clzero,4983 .clzero,
5018 .cmov,4984 .cmov,
5019 .cx16,4985 .cx16,
5020 .evex512,
5021 .fast_15bytenop,4986 .fast_15bytenop,
5022 .fast_bextr,4987 .fast_bextr,
5023 .fast_dpwssd,4988 .fast_dpwssd,
lib/std/zig/system/x86.zig+2-5
...@@ -558,7 +558,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {...@@ -558,7 +558,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
558 setFeature(cpu, .avxvnniint16, bit(leaf.edx, 10) and has_avx_save);558 setFeature(cpu, .avxvnniint16, bit(leaf.edx, 10) and has_avx_save);
559 setFeature(cpu, .prefetchi, bit(leaf.edx, 14));559 setFeature(cpu, .prefetchi, bit(leaf.edx, 14));
560 setFeature(cpu, .usermsr, bit(leaf.edx, 15));560 setFeature(cpu, .usermsr, bit(leaf.edx, 15));
561 setFeature(cpu, .avx10_1_256, bit(leaf.edx, 19));
562 // APX561 // APX
563 setFeature(cpu, .egpr, bit(leaf.edx, 21));562 setFeature(cpu, .egpr, bit(leaf.edx, 21));
564 setFeature(cpu, .push2pop2, bit(leaf.edx, 21));563 setFeature(cpu, .push2pop2, bit(leaf.edx, 21));
...@@ -585,7 +584,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {...@@ -585,7 +584,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
585 .avxvnniint16,584 .avxvnniint16,
586 .prefetchi,585 .prefetchi,
587 .usermsr,586 .usermsr,
588 .avx10_1_256,
589 .egpr,587 .egpr,
590 .push2pop2,588 .push2pop2,
591 .ppx,589 .ppx,
...@@ -668,7 +666,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {...@@ -668,7 +666,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
668 .avxvnniint16,666 .avxvnniint16,
669 .prefetchi,667 .prefetchi,
670 .usermsr,668 .usermsr,
671 .avx10_1_256,
672 .egpr,669 .egpr,
673 .push2pop2,670 .push2pop2,
674 .ppx,671 .ppx,
...@@ -724,10 +721,10 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {...@@ -724,10 +721,10 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
724 if (max_level >= 0x24) {721 if (max_level >= 0x24) {
725 leaf = cpuid(0x24, 0);722 leaf = cpuid(0x24, 0);
726723
727 setFeature(cpu, .avx10_1_512, bit(leaf.ebx, 18));724 setFeature(cpu, .avx10_1, bit(leaf.ebx, 18));
728 } else {725 } else {
729 for ([_]Target.x86.Feature{726 for ([_]Target.x86.Feature{
730 .avx10_1_512,727 .avx10_1,
731 }) |feat| {728 }) |feat| {
732 setFeature(cpu, feat, false);729 setFeature(cpu, feat, false);
733 }730 }
tools/update_cpu_features.zig+21
...@@ -1229,6 +1229,27 @@ const targets = [_]ArchTarget{...@@ -1229,6 +1229,27 @@ const targets = [_]ArchTarget{
1229 .llvm_name = "64bit-mode",1229 .llvm_name = "64bit-mode",
1230 .omit = true,1230 .omit = true,
1231 },1231 },
1232 // Remove these when LLVM removes AVX10.N-256 support.
1233 .{
1234 .llvm_name = "avx10.1-256",
1235 .flatten = true,
1236 },
1237 .{
1238 .llvm_name = "avx10.2-256",
1239 .flatten = true,
1240 },
1241 .{
1242 .llvm_name = "avx10.1-512",
1243 .zig_name = "avx10_1",
1244 },
1245 .{
1246 .llvm_name = "avx10.2-512",
1247 .zig_name = "avx10_2",
1248 },
1249 .{
1250 .llvm_name = "avx512f",
1251 .extra_deps = &.{"evex512"},
1252 },
1232 .{1253 .{
1233 .llvm_name = "alderlake",1254 .llvm_name = "alderlake",
1234 .extra_deps = &.{ "smap", "smep" },1255 .extra_deps = &.{ "smap", "smep" },