GNU bug report logs - #53895
[PATCH 0/5] More CPU detection

Previous Next

Package: guix-patches;

Reported by: Efraim Flashner <efraim <at> flashner.co.il>

Date: Wed, 9 Feb 2022 10:19:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 53895 <at> debbugs.gnu.org
Subject: [bug#53895] [PATCH 0/5] More CPU detection
Date: Wed, 09 Feb 2022 11:43:21 +0100
Efraim Flashner <efraim <at> flashner.co.il> skribis:

> * guix/cpu.scm <cpu>: Add vendor field.
> (current-cpu): Also fill in the 'vendor' field.
> (cpu->gcc-architecture): Add detection logic for AMD CPUs.

[...]

> +         (and (equal? "AuthenticAMD" (cpu-vendor cpu))

Isn’t that equivalent to (= (cpu-family cpu) some-value)?

> +              (letrec-syntax ((if-flags (syntax-rules (=>)
> +                                          ((_)
> +                                           #f)
> +                                          ((_ (flags ... => name) rest ...)
> +                                           (if (every (lambda (flag)
> +                                                        (set-contains? (cpu-flags cpu)
> +                                                                       flag))
> +                                                      '(flags ...))
> +                                             name
> +                                             (if-flags rest ...))))))
> +
> +                (when (= 22 (cpu-family cpu))
> +                  (if-flags ("movbe" => "btver2")))
> +                (when (= 6 (cpu-family cpu))
> +                  (if-flags ("3dnowp" => "athalon")))

This has no effect (because ‘if-flags’ returns a value that is ignored
since it’s not returned.)

What we could do is extend ‘if-flags’ so that it can optionally check
for a family number:

  (if-flags ((family 22) "movbe" => "btver2")
             …)

> +                (if-flags ("vaes" => "znver3")
> +                          ("clwb" => "znver2")
> +                          ("clzero" => "znver1")

However, the code in driver-i386.c seems to look at model IDs (the big
“switch (processor)” thing) and not feature flags.  Or am I overlooking
something?

Thanks,
Ludo’.




This bug report was last modified 3 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.