authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-19 00:11:37+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-19 23:42:39+01:00
logb074fb7ddaefaa6ed9c5235d22b2f7378e3b80e8
tree397f2a25c0c9db9cf4e37893dd0d182e43b408b6
parent0ead0beb8398176b47add9461d317c4777f2a2e9

std.zig.system.x86: Update Intel/AMD model detection.


1 files changed, 74 insertions(+), 5 deletions(-)

lib/std/zig/system/x86.zig+74-5
......@@ -149,10 +149,14 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
149149 cpu.model = &Target.x86.cpu.broadwell;
150150 return;
151151 },
152 0x4e, 0x5e, 0x8e, 0x9e => {
152 0x4e, 0x5e, 0x8e, 0x9e, 0xa5, 0xa6 => {
153153 cpu.model = &Target.x86.cpu.skylake;
154154 return;
155155 },
156 0xa7 => {
157 cpu.model = &Target.x86.cpu.rocketlake;
158 return;
159 },
156160 0x55 => {
157161 if (Target.x86.featureSetHas(cpu.features, .avx512bf16)) {
158162 cpu.model = &Target.x86.cpu.cooperlake;
......@@ -177,6 +181,58 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
177181 cpu.model = &Target.x86.cpu.icelake_server;
178182 return;
179183 },
184 0x8c, 0x8d => {
185 cpu.model = &Target.x86.cpu.tigerlake;
186 return;
187 },
188 0x97, 0x9a => {
189 cpu.model = &Target.x86.cpu.alderlake;
190 return;
191 },
192 0xbe => {
193 cpu.model = &Target.x86.cpu.gracemont;
194 return;
195 },
196 0xb7, 0xba, 0xbf => {
197 cpu.model = &Target.x86.cpu.raptorlake;
198 return;
199 },
200 0xaa, 0xac => {
201 cpu.model = &Target.x86.cpu.meteorlake;
202 return;
203 },
204 0xc5, 0xb5 => {
205 cpu.model = &Target.x86.cpu.arrowlake;
206 return;
207 },
208 0xc6 => {
209 cpu.model = &Target.x86.cpu.arrowlake_s;
210 return;
211 },
212 0xbd => {
213 cpu.model = &Target.x86.cpu.lunarlake;
214 return;
215 },
216 0xcc => {
217 cpu.model = &Target.x86.cpu.pantherlake;
218 return;
219 },
220 0xad => {
221 cpu.model = &Target.x86.cpu.graniterapids;
222 return;
223 },
224 0xae => {
225 cpu.model = &Target.x86.cpu.graniterapids_d;
226 return;
227 },
228 0xcf => {
229 cpu.model = &Target.x86.cpu.emeraldrapids;
230 return;
231 },
232 0x8f => {
233 cpu.model = &Target.x86.cpu.sapphirerapids;
234 return;
235 },
180236 0x1c, 0x26, 0x27, 0x35, 0x36 => {
181237 cpu.model = &Target.x86.cpu.bonnell;
182238 return;
......@@ -193,10 +249,22 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
193249 cpu.model = &Target.x86.cpu.goldmont_plus;
194250 return;
195251 },
196 0x86 => {
252 0x86, 0x8a, 0x96, 0x9c => {
197253 cpu.model = &Target.x86.cpu.tremont;
198254 return;
199255 },
256 0xaf => {
257 cpu.model = &Target.x86.cpu.sierraforest;
258 return;
259 },
260 0xb6 => {
261 cpu.model = &Target.x86.cpu.grandridge;
262 return;
263 },
264 0xdd => {
265 cpu.model = &Target.x86.cpu.clearwaterforest;
266 return;
267 },
200268 0x57 => {
201269 cpu.model = &Target.x86.cpu.knl;
202270 return;
......@@ -242,7 +310,7 @@ fn detectAMDProcessor(features: Target.Cpu.Feature.Set, family: u32, model: u32)
242310 &Target.x86.cpu.k8_sse3
243311 else
244312 &Target.x86.cpu.k8,
245 16 => &Target.x86.cpu.amdfam10,
313 16, 18 => &Target.x86.cpu.amdfam10,
246314 20 => &Target.x86.cpu.btver1,
247315 21 => switch (model) {
248316 0x60...0x7f => &Target.x86.cpu.bdver4,
......@@ -252,13 +320,14 @@ fn detectAMDProcessor(features: Target.Cpu.Feature.Set, family: u32, model: u32)
252320 },
253321 22 => &Target.x86.cpu.btver2,
254322 23 => switch (model) {
255 0x30...0x3f, 0x71 => &Target.x86.cpu.znver2,
323 0x30...0x3f, 0x47, 0x60...0x6f, 0x70...0x7f, 0x84...0x87, 0x90...0x9f, 0xa0...0xaf => &Target.x86.cpu.znver2,
256324 else => &Target.x86.cpu.znver1,
257325 },
258326 25 => switch (model) {
259 0x10...0x1f, 0x60...0x6f, 0x70...0x77, 0x78...0x7f, 0xa0...0xaf => &Target.x86.cpu.znver4,
327 0x10...0x1f, 0x60...0x6f, 0x70...0x7f, 0xa0...0xaf => &Target.x86.cpu.znver4,
260328 else => &Target.x86.cpu.znver3,
261329 },
330 26 => &Target.x86.cpu.znver5,
262331 else => null,
263332 };
264333}