guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#53895] [PATCH 0/5] More CPU detection


From: Ludovic Courtès
Subject: [bug#53895] [PATCH 0/5] More CPU detection
Date: Wed, 09 Feb 2022 11:43:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Efraim Flashner <efraim@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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]