| ... | @@ -637,21 +637,15 @@ pub const Builder = struct { | ... | @@ -637,21 +637,15 @@ pub const Builder = struct { |
| 637 | "target", | 637 | "target", |
| 638 | "The CPU architecture, OS, and ABI to build for", | 638 | "The CPU architecture, OS, and ABI to build for", |
| 639 | ); | 639 | ); |
| 640 | const mcpu = self.option([]const u8, "cpu", "Target CPU"); | 640 | const mcpu = self.option([]const u8, "cpu", "Target CPU features to add or subtract"); |
| 641 | | 641 | |
| 642 | const triple = maybe_triple orelse return args.default_target; | 642 | const triple = maybe_triple orelse return args.default_target; |
| 643 | const cpu_features = self.option( | | |
| 644 | []const u8, | | |
| 645 | "mcpu", | | |
| 646 | "The list of CPU features to add or subtract", | | |
| 647 | ); | | |
| 648 | | 643 | |
| 649 | var diags: CrossTarget.ParseOptions.Diagnostics = .{}; | 644 | var diags: CrossTarget.ParseOptions.Diagnostics = .{}; |
| 650 | const selected_target = CrossTarget.parse(.{ | 645 | const selected_target = CrossTarget.parse(.{ |
| 651 | .arch_os_abi = triple, | 646 | .arch_os_abi = triple, |
| 652 | .cpu_features = mcpu, | 647 | .cpu_features = mcpu, |
| 653 | .diagnostics = &diags, | 648 | .diagnostics = &diags, |
| 654 | .cpu_features = cpu_features, | | |
| 655 | }) catch |err| switch (err) { | 649 | }) catch |err| switch (err) { |
| 656 | error.UnknownCpuModel => { | 650 | error.UnknownCpuModel => { |
| 657 | warn("Unknown CPU: '{s}'\nAvailable CPUs for architecture '{s}':\n", .{ | 651 | warn("Unknown CPU: '{s}'\nAvailable CPUs for architecture '{s}':\n", .{ |
| ... | @@ -716,7 +710,7 @@ pub const Builder = struct { | ... | @@ -716,7 +710,7 @@ pub const Builder = struct { |
| 716 | if (mem.eql(u8, t_triple, selected_canonicalized_triple)) { | 710 | if (mem.eql(u8, t_triple, selected_canonicalized_triple)) { |
| 717 | mismatch_triple = false; | 711 | mismatch_triple = false; |
| 718 | whitelist_item = t; | 712 | whitelist_item = t; |
| 719 | if (t.getCpuFeatures().subSet(selected_target.getCpuFeatures())) { | 713 | if (t.getCpuFeatures().isSuperSetOf(selected_target.getCpuFeatures())) { |
| 720 | mismatch_cpu_features = false; | 714 | mismatch_cpu_features = false; |
| 721 | break :whitelist_check; | 715 | break :whitelist_check; |
| 722 | } else { | 716 | } else { |
| ... | @@ -733,7 +727,8 @@ pub const Builder = struct { | ... | @@ -733,7 +727,8 @@ pub const Builder = struct { |
| 733 | warn(" {s}\n", .{t_triple}); | 727 | warn(" {s}\n", .{t_triple}); |
| 734 | } | 728 | } |
| 735 | warn("\n", .{}); | 729 | warn("\n", .{}); |
| 736 | } else { // mismatch_cpu_features | 730 | } else { |
| | 731 | assert(mismatch_cpu_features); |
| 737 | const whitelist_cpu = whitelist_item.getCpu(); | 732 | const whitelist_cpu = whitelist_item.getCpu(); |
| 738 | const selected_cpu = selected_target.getCpu(); | 733 | const selected_cpu = selected_target.getCpu(); |
| 739 | warn("Chosen CPU model '{s}' does not match one of the supported targets:\n", .{ | 734 | warn("Chosen CPU model '{s}' does not match one of the supported targets:\n", .{ |