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 {
2424 amx_tile,
2525 amx_transpose,
2626 avx,
27 avx10_1_256,
28 avx10_1_512,
29 avx10_2_256,
30 avx10_2_512,
27 avx10_1,
28 avx10_2,
3129 avx2,
3230 avx512bf16,
3331 avx512bitalg,
......@@ -340,9 +338,9 @@ pub const all_features = blk: {
340338 .sse4_2,
341339 }),
342340 };
343 result[@intFromEnum(Feature.avx10_1_256)] = .{
344 .llvm_name = "avx10.1-256",
345 .description = "Support AVX10.1 up to 256-bit instruction",
341 result[@intFromEnum(Feature.avx10_1)] = .{
342 .llvm_name = "avx10.1-512",
343 .description = "Support AVX10.1 up to 512-bit instruction",
346344 .dependencies = featureSet(&[_]Feature{
347345 .avx512bf16,
348346 .avx512bitalg,
......@@ -357,27 +355,11 @@ pub const all_features = blk: {
357355 .avx512vpopcntdq,
358356 }),
359357 };
360 result[@intFromEnum(Feature.avx10_1_512)] = .{
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)] = .{
358 result[@intFromEnum(Feature.avx10_2)] = .{
376359 .llvm_name = "avx10.2-512",
377360 .description = "Support AVX10.2 up to 512-bit instruction",
378361 .dependencies = featureSet(&[_]Feature{
379 .avx10_1_512,
380 .avx10_2_256,
362 .avx10_1,
381363 }),
382364 };
383365 result[@intFromEnum(Feature.avx2)] = .{
......@@ -434,6 +416,7 @@ pub const all_features = blk: {
434416 .description = "Enable AVX-512 instructions",
435417 .dependencies = featureSet(&[_]Feature{
436418 .avx2,
419 .evex512,
437420 .f16c,
438421 .fma,
439422 }),
......@@ -2192,7 +2175,6 @@ pub const cpu = struct {
21922175 .cmov,
21932176 .cx16,
21942177 .ermsb,
2195 .evex512,
21962178 .fast_15bytenop,
21972179 .fast_gather,
21982180 .fast_scalar_fsqrt,
......@@ -2252,7 +2234,6 @@ pub const cpu = struct {
22522234 .cmov,
22532235 .cx16,
22542236 .ermsb,
2255 .evex512,
22562237 .false_deps_popcnt,
22572238 .fast_15bytenop,
22582239 .fast_gather,
......@@ -2392,7 +2373,6 @@ pub const cpu = struct {
23922373 .cmov,
23932374 .cx16,
23942375 .ermsb,
2395 .evex512,
23962376 .false_deps_popcnt,
23972377 .fast_15bytenop,
23982378 .fast_gather,
......@@ -2485,7 +2465,7 @@ pub const cpu = struct {
24852465 .amx_movrs,
24862466 .amx_tf32,
24872467 .amx_transpose,
2488 .avx10_2_512,
2468 .avx10_2,
24892469 .avxifma,
24902470 .avxneconvert,
24912471 .avxvnni,
......@@ -2601,7 +2581,6 @@ pub const cpu = struct {
26012581 .cx16,
26022582 .enqcmd,
26032583 .ermsb,
2604 .evex512,
26052584 .false_deps_getmant,
26062585 .false_deps_mulc,
26072586 .false_deps_mullq,
......@@ -2914,7 +2893,6 @@ pub const cpu = struct {
29142893 .cx16,
29152894 .enqcmd,
29162895 .ermsb,
2917 .evex512,
29182896 .false_deps_getmant,
29192897 .false_deps_mulc,
29202898 .false_deps_mullq,
......@@ -3004,7 +2982,6 @@ pub const cpu = struct {
30042982 .cx16,
30052983 .enqcmd,
30062984 .ermsb,
3007 .evex512,
30082985 .false_deps_getmant,
30092986 .false_deps_mulc,
30102987 .false_deps_mullq,
......@@ -3167,7 +3144,6 @@ pub const cpu = struct {
31673144 .cmov,
31683145 .cx16,
31693146 .ermsb,
3170 .evex512,
31713147 .fast_15bytenop,
31723148 .fast_gather,
31733149 .fast_scalar_fsqrt,
......@@ -3231,7 +3207,6 @@ pub const cpu = struct {
32313207 .cmov,
32323208 .cx16,
32333209 .ermsb,
3234 .evex512,
32353210 .fast_15bytenop,
32363211 .fast_gather,
32373212 .fast_scalar_fsqrt,
......@@ -3394,7 +3369,6 @@ pub const cpu = struct {
33943369 .bmi2,
33953370 .cmov,
33963371 .cx16,
3397 .evex512,
33983372 .fast_gather,
33993373 .fast_imm16,
34003374 .fast_movbe,
......@@ -3436,7 +3410,6 @@ pub const cpu = struct {
34363410 .bmi2,
34373411 .cmov,
34383412 .cx16,
3439 .evex512,
34403413 .fast_gather,
34413414 .fast_imm16,
34423415 .fast_movbe,
......@@ -4003,7 +3976,6 @@ pub const cpu = struct {
40033976 .cmov,
40043977 .cx16,
40053978 .ermsb,
4006 .evex512,
40073979 .fast_15bytenop,
40083980 .fast_gather,
40093981 .fast_scalar_fsqrt,
......@@ -4104,7 +4076,6 @@ pub const cpu = struct {
41044076 .cx16,
41054077 .enqcmd,
41064078 .ermsb,
4107 .evex512,
41084079 .false_deps_getmant,
41094080 .false_deps_mulc,
41104081 .false_deps_mullq,
......@@ -4277,7 +4248,6 @@ pub const cpu = struct {
42774248 .cmov,
42784249 .cx16,
42794250 .ermsb,
4280 .evex512,
42814251 .false_deps_popcnt,
42824252 .fast_15bytenop,
42834253 .fast_gather,
......@@ -4390,7 +4360,6 @@ pub const cpu = struct {
43904360 .cmov,
43914361 .cx16,
43924362 .ermsb,
4393 .evex512,
43944363 .false_deps_popcnt,
43954364 .fast_15bytenop,
43964365 .fast_gather,
......@@ -4485,7 +4454,6 @@ pub const cpu = struct {
44854454 .cmov,
44864455 .cx16,
44874456 .ermsb,
4488 .evex512,
44894457 .fast_15bytenop,
44904458 .fast_gather,
44914459 .fast_scalar_fsqrt,
......@@ -4706,7 +4674,6 @@ pub const cpu = struct {
47064674 .bmi2,
47074675 .cmov,
47084676 .cx16,
4709 .evex512,
47104677 .false_deps_popcnt,
47114678 .fast_15bytenop,
47124679 .fast_gather,
......@@ -4943,7 +4910,6 @@ pub const cpu = struct {
49434910 .clzero,
49444911 .cmov,
49454912 .cx16,
4946 .evex512,
49474913 .fast_15bytenop,
49484914 .fast_bextr,
49494915 .fast_dpwssd,
......@@ -5017,7 +4983,6 @@ pub const cpu = struct {
50174983 .clzero,
50184984 .cmov,
50194985 .cx16,
5020 .evex512,
50214986 .fast_15bytenop,
50224987 .fast_bextr,
50234988 .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 {
558558 setFeature(cpu, .avxvnniint16, bit(leaf.edx, 10) and has_avx_save);
559559 setFeature(cpu, .prefetchi, bit(leaf.edx, 14));
560560 setFeature(cpu, .usermsr, bit(leaf.edx, 15));
561 setFeature(cpu, .avx10_1_256, bit(leaf.edx, 19));
562561 // APX
563562 setFeature(cpu, .egpr, bit(leaf.edx, 21));
564563 setFeature(cpu, .push2pop2, bit(leaf.edx, 21));
......@@ -585,7 +584,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
585584 .avxvnniint16,
586585 .prefetchi,
587586 .usermsr,
588 .avx10_1_256,
589587 .egpr,
590588 .push2pop2,
591589 .ppx,
......@@ -668,7 +666,6 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
668666 .avxvnniint16,
669667 .prefetchi,
670668 .usermsr,
671 .avx10_1_256,
672669 .egpr,
673670 .push2pop2,
674671 .ppx,
......@@ -724,10 +721,10 @@ fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void {
724721 if (max_level >= 0x24) {
725722 leaf = cpuid(0x24, 0);
726723
727 setFeature(cpu, .avx10_1_512, bit(leaf.ebx, 18));
724 setFeature(cpu, .avx10_1, bit(leaf.ebx, 18));
728725 } else {
729726 for ([_]Target.x86.Feature{
730 .avx10_1_512,
727 .avx10_1,
731728 }) |feat| {
732729 setFeature(cpu, feat, false);
733730 }
tools/update_cpu_features.zig+21
......@@ -1229,6 +1229,27 @@ const targets = [_]ArchTarget{
12291229 .llvm_name = "64bit-mode",
12301230 .omit = true,
12311231 },
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 },
12321253 .{
12331254 .llvm_name = "alderlake",
12341255 .extra_deps = &.{ "smap", "smep" },