| ... | @@ -1785,6 +1785,9 @@ pub const Cpu = struct { | ... | @@ -1785,6 +1785,9 @@ pub const Cpu = struct { |
| 1785 | }; | 1785 | }; |
| 1786 | } | 1786 | } |
| 1787 | | 1787 | |
| | 1788 | /// Returns the most bare-bones CPU model that is valid for `arch`. Note that this function |
| | 1789 | /// can return CPU models that are understood by LLVM, but *not* understood by Clang. If |
| | 1790 | /// Clang compatibility is important, consider using `baseline` instead. |
| 1788 | pub fn generic(arch: Arch) *const Model { | 1791 | pub fn generic(arch: Arch) *const Model { |
| 1789 | const S = struct { | 1792 | const S = struct { |
| 1790 | const generic_model = Model{ | 1793 | const generic_model = Model{ |
| ... | @@ -1835,6 +1838,14 @@ pub const Cpu = struct { | ... | @@ -1835,6 +1838,14 @@ pub const Cpu = struct { |
| 1835 | }; | 1838 | }; |
| 1836 | } | 1839 | } |
| 1837 | | 1840 | |
| | 1841 | /// Returns a conservative CPU model for `arch` that is expected to be compatible with the |
| | 1842 | /// vast majority of hardware available. This function is guaranteed to return CPU models |
| | 1843 | /// that are understood by both LLVM and Clang, unlike `generic`. |
| | 1844 | /// |
| | 1845 | /// For certain `os` values, this function will additionally bump the baseline higher than |
| | 1846 | /// the baseline would be for `arch` in isolation; for example, for `aarch64-macos`, the |
| | 1847 | /// baseline is considered to be `apple_m1`. To avoid this behavior entirely, pass |
| | 1848 | /// `Os.Tag.freestanding`. |
| 1838 | pub fn baseline(arch: Arch, os: Os) *const Model { | 1849 | pub fn baseline(arch: Arch, os: Os) *const Model { |
| 1839 | return switch (arch) { | 1850 | return switch (arch) { |
| 1840 | .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline, | 1851 | .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline, |