From b0ce4f0996e24ad62501be325da7e402bcb3498e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 20 Oct 2026 05:16:33 +0200 Subject: [PATCH] update_cpu_features: omit more optional arm features Both on models and architecture levels this time. As part of this, I removed neon from the baseline model because that isn't actually part of the ARMv7 baseline on any platform I'm aware of, and it made our baseline binaries not work on some real boards, e.g. Tegra 2. We keep vfp3d16 since virtually every ARMv7 board has VFP. To not regress PlayStation Vita performance, I also added a kermit model with neon enabled. This was necessary since vortex_a9 lost all NEON/VFP features by default. --- lib/std/Target.zig | 4 +- lib/std/Target/arm.zig | 57 ++++++++------ tools/update_cpu_features.zig | 135 +++++++++++++++++++++++++++++++++- 3 files changed, 171 insertions(+), 25 deletions(-) diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 8aab05f1d700ea86641c17863f8acb6b3e2b921e..5d0f4f4097f36d1cc240029e43d0bf33dfb51abb 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -2090,12 +2090,12 @@ pub const Cpu = struct { .amdgcn => &amdgcn.cpu.gfx906, .arm => switch (os.tag) { .@"3ds" => &arm.cpu.mpcore, - .vita => &arm.cpu.cortex_a9, + .vita => &arm.cpu.kermit, .gba => &arm.cpu.arm7tdmi, else => &arm.cpu.baseline, }, .thumb => switch (os.tag) { - .vita => &arm.cpu.cortex_a9, + .vita => &arm.cpu.kermit, .gba => &arm.cpu.arm7tdmi, else => &arm.cpu.baseline, }, diff --git a/lib/std/Target/arm.zig b/lib/std/Target/arm.zig index ee77e4d1196d2d2f1562d72e201a3c7f929c1655..9d7810b7dbbcd9527868ecacb82a7f89040ef260 100644 --- a/lib/std/Target/arm.zig +++ b/lib/std/Target/arm.zig @@ -1200,7 +1200,6 @@ pub const all_features = blk: { .db, .dsp, .has_v7, - .neon, .perfmon, }), }; @@ -1250,7 +1249,6 @@ pub const all_features = blk: { .dsp, .has_v7, .mp, - .neon, .perfmon, .trustzone, .virtualization, @@ -1262,12 +1260,12 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, .has_v8_1a, .mp, + .neon, .trustzone, .virtualization, }), @@ -1276,7 +1274,6 @@ pub const all_features = blk: { .llvm_name = "armv8.1-m.main", .description = "ARMv81mMainline architecture", .dependencies = featureSet(&[_]Feature{ - .@"8msecext", .acquire_release, .db, .has_v8_1m_main, @@ -1294,12 +1291,12 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, .has_v8_2a, .mp, + .neon, .ras, .trustzone, .virtualization, @@ -1311,12 +1308,12 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, .has_v8_3a, .mp, + .neon, .ras, .trustzone, .virtualization, @@ -1328,7 +1325,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1345,7 +1341,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1362,7 +1357,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1379,7 +1373,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1396,7 +1389,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1413,7 +1405,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1430,12 +1421,12 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, .has_v8, .mp, + .neon, .trustzone, .virtualization, }), @@ -1444,7 +1435,6 @@ pub const all_features = blk: { .llvm_name = "armv8-m.base", .description = "ARMv8mBaseline architecture", .dependencies = featureSet(&[_]Feature{ - .@"8msecext", .acquire_release, .db, .has_v7clrex, @@ -1460,7 +1450,6 @@ pub const all_features = blk: { .llvm_name = "armv8-m.main", .description = "ARMv8mMainline architecture", .dependencies = featureSet(&[_]Feature{ - .@"8msecext", .acquire_release, .db, .has_v8m_main, @@ -1523,7 +1512,6 @@ pub const all_features = blk: { .dependencies = featureSet(&[_]Feature{ .aclass, .crc, - .crypto, .db, .dsp, .fp_armv8, @@ -1949,6 +1937,7 @@ pub const cpu = struct { .llvm_name = "generic", .features = featureSet(&[_]Feature{ .v7a, + .vfp3d16, }), }; pub const cortex_a12: CpuModel = .{ @@ -1960,7 +1949,6 @@ pub const cpu = struct { .ret_addr_stack, .trustzone, .v7a, - .vfp4, .virtualization, .vmlx_forwarding, }), @@ -1976,7 +1964,6 @@ pub const cpu = struct { .splat_vfp_neon, .trustzone, .v7a, - .vfp4, .virtualization, .vldn_align, }), @@ -1990,7 +1977,6 @@ pub const cpu = struct { .ret_addr_stack, .trustzone, .v7a, - .vfp4, .virtualization, .vmlx_forwarding, }), @@ -2020,7 +2006,6 @@ pub const cpu = struct { .slowfpvmlx, .trustzone, .v7a, - .vfp4, .vmlx_forwarding, }), }; @@ -2072,7 +2057,6 @@ pub const cpu = struct { .slowfpvmlx, .trustzone, .v7a, - .vfp4, .virtualization, .vmlx_forwarding, .vmlx_hazards, @@ -2186,7 +2170,6 @@ pub const cpu = struct { .features = featureSet(&[_]Feature{ .avoid_partial_cpsr, .expand_fp_mlx, - .fp16, .mp, .muxed_units, .neon_fpmovs, @@ -2322,6 +2305,7 @@ pub const cpu = struct { .name = "cortex_m85", .llvm_name = "cortex-m85", .features = featureSet(&[_]Feature{ + .@"8msecext", .branch_align_64, .dsp, .m85, @@ -2434,6 +2418,7 @@ pub const cpu = struct { .features = featureSet(&[_]Feature{ .avoid_movs_shop, .avoid_partial_cpsr, + .crypto, .disable_postra_scheduler, .neonfp, .ret_addr_stack, @@ -2455,6 +2440,7 @@ pub const cpu = struct { .name = "exynos_m1", .llvm_name = null, .features = featureSet(&[_]Feature{ + .crypto, .expand_fp_mlx, .fuse_aes, .fuse_literals, @@ -2475,6 +2461,7 @@ pub const cpu = struct { .name = "exynos_m2", .llvm_name = null, .features = featureSet(&[_]Feature{ + .crypto, .expand_fp_mlx, .fuse_aes, .fuse_literals, @@ -2495,6 +2482,7 @@ pub const cpu = struct { .name = "exynos_m3", .llvm_name = "exynos-m3", .features = featureSet(&[_]Feature{ + .crypto, .expand_fp_mlx, .fuse_aes, .fuse_literals, @@ -2515,6 +2503,7 @@ pub const cpu = struct { .name = "exynos_m4", .llvm_name = "exynos-m4", .features = featureSet(&[_]Feature{ + .crypto, .dotprod, .expand_fp_mlx, .fullfp16, @@ -2537,6 +2526,7 @@ pub const cpu = struct { .name = "exynos_m5", .llvm_name = "exynos-m5", .features = featureSet(&[_]Feature{ + .crypto, .dotprod, .expand_fp_mlx, .fullfp16, @@ -2567,6 +2557,26 @@ pub const cpu = struct { .v5te, }), }; + pub const kermit: CpuModel = .{ + .name = "kermit", + .llvm_name = "cortex-a9", + .features = featureSet(&[_]Feature{ + .avoid_partial_cpsr, + .expand_fp_mlx, + .fp16, + .mp, + .muxed_units, + .neon, + .neon_fpmovs, + .prefer_vmovsr, + .ret_addr_stack, + .trustzone, + .v7a, + .vldn_align, + .vmlx_forwarding, + .vmlx_hazards, + }), + }; pub const krait: CpuModel = .{ .name = "krait", .llvm_name = "krait", @@ -2575,6 +2585,7 @@ pub const cpu = struct { .hwdiv, .hwdiv_arm, .muxed_units, + .neon, .ret_addr_stack, .v7a, .vfp4, @@ -2586,6 +2597,7 @@ pub const cpu = struct { .name = "kryo", .llvm_name = "kryo", .features = featureSet(&[_]Feature{ + .crypto, .v8a, }), }; @@ -2715,6 +2727,7 @@ pub const cpu = struct { .hwdiv, .hwdiv_arm, .mp, + .neon, .neonfp, .prefer_ishst, .prof_unpr, diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig index 809093429022505516939221b82ee0a7cb7e9abf..5c9df210ea899609d956acc8ac0ae93c3076ff3a 100644 --- a/tools/update_cpu_features.zig +++ b/tools/update_cpu_features.zig @@ -843,6 +843,7 @@ const targets = [_]ArchTarget{ .{ .llvm_name = "armv7-a", .zig_name = "v7a", + .omit_deps = &.{"neon"}, }, .{ .llvm_name = "armv7-m", @@ -867,58 +868,72 @@ const targets = [_]ArchTarget{ .{ .llvm_name = "armv7ve", .zig_name = "v7ve", + .omit_deps = &.{"neon"}, }, .{ .llvm_name = "armv8.1-a", .zig_name = "v8_1a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.1-m.main", .zig_name = "v8_1m_main", + .omit_deps = &.{"8msecext"}, }, .{ .llvm_name = "armv8.2-a", .zig_name = "v8_2a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.3-a", .zig_name = "v8_3a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.4-a", .zig_name = "v8_4a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.5-a", .zig_name = "v8_5a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.6-a", .zig_name = "v8_6a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.7-a", .zig_name = "v8_7a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.8-a", .zig_name = "v8_8a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8.9-a", .zig_name = "v8_9a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8-a", .zig_name = "v8a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv8-m.base", .zig_name = "v8m", + .omit_deps = &.{"8msecext"}, }, .{ .llvm_name = "armv8-m.main", .zig_name = "v8m_main", + .omit_deps = &.{"8msecext"}, }, .{ .llvm_name = "armv8-r", @@ -935,6 +950,7 @@ const targets = [_]ArchTarget{ .{ .llvm_name = "armv9.3-a", .zig_name = "v9_3a", + .omit_deps = &.{"crypto"}, }, .{ .llvm_name = "armv9.4-a", @@ -1101,6 +1117,78 @@ const targets = [_]ArchTarget{ }, }, .model_overrides = &.{ + .{ + .llvm_name = "cortex-a5", + .omit_deps = &.{"vfp4"}, + }, + .{ + .llvm_name = "cortex-a7", + .omit_deps = &.{"vfp4"}, + }, + .{ + .llvm_name = "cortex-a9", + .omit_deps = &.{"fp16"}, + }, + .{ + .llvm_name = "cortex-a12", + .omit_deps = &.{"vfp4"}, + }, + .{ + .llvm_name = "cortex-a15", + .omit_deps = &.{"vfp4"}, + }, + .{ + .llvm_name = "cortex-a17", + .omit_deps = &.{"vfp4"}, + }, + .{ + .llvm_name = "cortex-a32", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a35", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a53", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a57", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a72", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a73", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a76", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a76ae", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a77", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a78", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a78ae", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-a78c", + .omit_deps = &.{"crypto"}, + }, .{ .llvm_name = "cortex-m4", .omit_deps = &.{"vfp4d16sp"}, @@ -1127,6 +1215,7 @@ const targets = [_]ArchTarget{ }, .{ .llvm_name = "cortex-m85", + .extra_deps = &.{"8msecext"}, .omit_deps = &.{ "fp_armv8d16", "mve_fp", "pacbti" }, }, .{ @@ -1149,6 +1238,26 @@ const targets = [_]ArchTarget{ .llvm_name = "cortex-r52plus", .omit_deps = &.{ "fp_armv8", "neon" }, }, + .{ + .llvm_name = "cortex-x1", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "cortex-x1c", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "krait", + .extra_deps = &.{"neon"}, + }, + .{ + .llvm_name = "neoverse-n1", + .omit_deps = &.{"crypto"}, + }, + .{ + .llvm_name = "neoverse-v1", + .omit_deps = &.{"crypto"}, + }, .{ .llvm_name = "star-mc1", .omit_deps = &.{ "dsp", "fp_armv8d16sp" }, @@ -1157,12 +1266,16 @@ const targets = [_]ArchTarget{ .llvm_name = "star-mc3", .omit_deps = &.{ "fp_armv8d16", "mve_fp", "pacbti" }, }, + .{ + .llvm_name = "swift", + .extra_deps = &.{"neon"}, + }, }, .extra_models = &.{ .{ .llvm_name = "generic", .zig_name = "baseline", - .features = &.{"v7a"}, + .features = &.{ "v7a", "vfp3d16" }, }, .{ .llvm_name = null, @@ -1174,6 +1287,26 @@ const targets = [_]ArchTarget{ .zig_name = "exynos_m2", .features = &.{ "v8a", "exynos" }, }, + .{ + .llvm_name = "cortex-a9", + .zig_name = "kermit", + .features = &.{ + "avoid_partial_cpsr", + "expand_fp_mlx", + "fp16", + "mp", + "muxed_units", + "neon", + "neon_fpmovs", + "prefer_vmovsr", + "ret_addr_stack", + "trustzone", + "v7a", + "vldn_align", + "vmlx_forwarding", + "vmlx_hazards", + }, + }, }, }, .{ -- 2.54.0