summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/gcc.scm45
-rw-r--r--guix/cpu.scm60
2 files changed, 78 insertions, 27 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 4984e188ea..47fb443155 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -556,17 +556,17 @@ Go.  It also includes runtime support libraries for these languages.")
        ,@(package-inputs gcc-4.7)))))
 
 (define %gcc-7.5-aarch64-micro-architectures
-  ;; Suitable '-march' values for GCC 7.5.
+  ;; Suitable '-march' values for GCC 7.5 (info "(gcc) AArch64 Options").
   ;; TODO: Allow dynamically adding feature flags.
   '("armv8-a" "armv8.1-a" "armv8.2-a" "armv8.3-a"))
 
 (define %gcc-7.5-armhf-micro-architectures
-  ;; Suitable '-march' values for GCC 7.5.
+  ;; Suitable '-march' values for GCC 7.5 (info "(gcc) ARM Options").
   ;; TODO: Allow dynamically adding feature flags.
   '("armv7" "armv7-a" "armv7-m" "armv7-r" "armv7e-m" "armv7ve"
     "armv8-a" "armv8-a+crc" "armv8.1-a" "armv8.1-a+crc"
     "armv8-m.base" "armv8-m.main" "armv8-m.main+dsp"
-    "iwmmxt" "iwmmxt2"))
+    "iwmmxt" "iwmmxt2" "armv8.2-a"))
 
 (define %gcc-7.5-x86_64-micro-architectures
   ;; Suitable '-march' values for GCC 7.5 (info "(gcc) x86 Options").
@@ -589,7 +589,7 @@ Go.  It also includes runtime support libraries for these languages.")
   ;; Suitable '-march' values for GCC 10.
   ;; TODO: Allow dynamically adding feature flags.
   (append %gcc-7.5-armhf-micro-architectures
-          '("armv8.2-a" "armv8.3-a" "armv8.4-a" "armv8.5-a" "armv8.6-a"
+          '("armv8.3-a" "armv8.4-a" "armv8.5-a" "armv8.6-a"
             "armv8-r" "armv8.1-m.main")))
 
 (define %gcc-10-x86_64-micro-architectures
@@ -603,7 +603,8 @@ Go.  It also includes runtime support libraries for these languages.")
 
 (define %gcc-11-aarch64-micro-architectures
   ;; Suitable '-march' values for GCC 11.
-  %gcc-10-aarch64-micro-architectures)            ;unchanged
+  (append %gcc-10-aarch64-micro-architectures
+          '("armv8-r")))
 
 (define %gcc-11-armhf-micro-architectures
   %gcc-10-armhf-micro-architectures)
@@ -615,6 +616,31 @@ Go.  It also includes runtime support libraries for these languages.")
 
             "btver1" "btver2")))                  ;AMD
 
+;; Suitable '-march' values for GCC 12.
+(define %gcc-12-aarch64-micro-architectures
+  (append %gcc-11-aarch64-micro-architectures
+          '("armv8.7-a" "armv8.8-a" "armv9-a")))
+
+(define %gcc-12-armhf-micro-architectures
+  (append %gcc-11-armhf-micro-architectures
+          '("armv9-a")))
+
+(define %gcc-12-x86_64-micro-architectures
+  (append %gcc-11-x86_64-micro-architectures
+          '("znver4")))                           ;AMD
+
+;; Suitable '-march' values for GCC 13.
+(define %gcc-13-aarch64-micro-architectures
+  (append %gcc-12-aarch64-micro-architectures
+          '("armv9.1-a" "armv9.2-a" "armv9.3-a")))
+
+(define %gcc-13-armhf-micro-architectures
+  %gcc-12-armhf-micro-architectures)
+
+(define %gcc-13-x86_64-micro-architectures
+  (append %gcc-12-x86_64-micro-architectures
+          '("graniterapids")))                    ;Intel
+
 (define-public gcc-7
   (package
     (inherit gcc-6)
@@ -735,7 +761,6 @@ It also includes runtime support libraries for these languages.")
 (define-public gcc-12
   (package
     (inherit gcc-11)
-    ;; Note: 'compiler-cpu-architectures' is unchanged compared to GCC 11.
     (version "12.3.0")
     (source (origin
               (method url-fetch)
@@ -747,7 +772,13 @@ It also includes runtime support libraries for these languages.")
               (patches (search-patches "gcc-12-strmov-store-file-names.patch"
                                        "gcc-5.0-libvtv-runpath.patch"))
               (modules '((guix build utils)))
-              (snippet gcc-canadian-cross-objdump-snippet)))))
+              (snippet gcc-canadian-cross-objdump-snippet)))
+   (properties
+    `((compiler-cpu-architectures
+       ("aarch64" ,@%gcc-12-aarch64-micro-architectures)
+       ("armhf" ,@%gcc-12-armhf-micro-architectures)
+       ("x86_64" ,@%gcc-12-x86_64-micro-architectures))
+      ,@(package-properties gcc-11)))))
 
 
 ;; Note: When changing the default gcc version, update
diff --git a/guix/cpu.scm b/guix/cpu.scm
index 83e7dc615c..45e1abeed7 100644
--- a/guix/cpu.scm
+++ b/guix/cpu.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022, 2023 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -113,7 +113,7 @@
 corresponds to CPU, a record as returned by 'current-cpu'."
   (match (cpu-architecture cpu)
     ("x86_64"
-     ;; Transcribed from GCC's 'host_detect_local_cpu' in driver-i386.c.
+     ;; Transcribed from GCC's 'host_detect_local_cpu' in driver-i386.cc.
      (or (and (equal? "GenuineIntel" (cpu-vendor cpu))
               (= 6 (cpu-family cpu))              ;the "Pentium Pro" family
               (letrec-syntax ((if-flags (syntax-rules (=>)
@@ -127,8 +127,11 @@ corresponds to CPU, a record as returned by 'current-cpu'."
                                              name
                                              (if-flags rest ...))))))
 
-                (if-flags ("avx" "avx512vp2intersect" "tsxldtrk" => "sapphirerapids")
+                (if-flags ("avx" "raoint" => "grandridge")
+                          ("avx" "amx_fp16" => "graniterapids")
+                          ("avx" "avxvnniint8" => "sierraforest")
                           ("avx" "avx512vp2intersect" => "tigerlake")
+                          ("avx" "tsxldtrk" => "sapphirerapids")
                           ("avx" "avx512bf16" => "cooperlake")
                           ("avx" "wbnoinvd" => "icelake-server")
                           ("avx" "avx512bitalg" => "icelake-client")
@@ -148,7 +151,8 @@ corresponds to CPU, a record as returned by 'current-cpu'."
                           ("sse4_2" => "nehalem")
                           ("ssse3" "movbe" => "bonnell")
                           ("ssse3" => "core2")
-                          ("longmode" => "x86-64"))))
+                          ("longmode" => "x86-64")
+                          ("lm" => "x86-64"))))
 
          (and (equal? "AuthenticAMD" (cpu-vendor cpu))
               (letrec-syntax ((if-flags (syntax-rules (=>)
@@ -165,8 +169,13 @@ corresponds to CPU, a record as returned by 'current-cpu'."
                 (or (and (= 22 (cpu-family cpu))
                          (if-flags ("movbe" => "btver2")))
                     (and (= 6 (cpu-family cpu))
-                         (if-flags ("3dnowp" => "athalon")))
-                    (if-flags ("vaes" => "znver3")
+                         (if-flags ("3dnowp" => "athalon")
+                                   ("longmode" "sse3" => "k8-sse3")
+                                   ("lm" "sse3" => "k8-sse3")
+                                   ("longmode" => "k8")
+                                   ("lm" => "k8")))
+                    (if-flags ("avx512f" => "znver4")
+                              ("vaes" => "znver3")
                               ("clwb" => "znver2")
                               ("clzero" => "znver1")
                               ("avx2" => "bdver4")
@@ -177,8 +186,10 @@ corresponds to CPU, a record as returned by 'current-cpu'."
                               ("sse4a" => "amdfam10")
                               ("sse2" "sse3" => "k8-sse3")
                               ("longmode" "sse3" => "k8-sse3")
+                              ("lm" "sse3" => "k8-sse3")
                               ("sse2" => "k8")
                               ("longmode" => "k8")
+                              ("lm" => "k8")
                               ("mmx" "3dnow" => "k6-3")
                               ("mmx" => "k6")
                               (_ => "pentium")))))
@@ -195,18 +206,24 @@ corresponds to CPU, a record as returned by 'current-cpu'."
                                                  '(flags ...))
                                           name
                                           (if-flags rest ...))))))
-           (if-flags ("avx512" => "knl")
-                     ("adx" => "broadwell")
-                     ("avx2" => "haswell")
-                     ;; TODO: tigerlake, cooperlake, etc.
-                     ("avx" => "sandybridge")
-                     ("sse4_2" "gfni" => "tremont")
-                     ("sse4_2" "sgx" => "goldmont-plus")
-                     ("sse4_2" "xsave" => "goldmont")
-                     ("sse4_2" "movbe" => "silvermont")
-                     ("sse4_2" => "nehalem")
-                     ("ssse3" "movbe" => "bonnell")
-                     ("ssse3" => "core2")))
+           (if (and (= 7 (cpu-family cpu))
+                    (= #x3b (cpu-model cpu)))
+             "lujiazui"
+             (if-flags ("avx512" => "knl")
+                       ("adx" => "broadwell")
+                       ("avx2" => "haswell")
+                       ;; TODO: tigerlake, cooperlake, etc.
+                       ("avx" => "sandybridge")
+                       ("sse4_2" "gfni" => "tremont")
+                       ("sse4_2" "sgx" => "goldmont-plus")
+                       ("sse4_2" "xsave" => "goldmont")
+                       ("sse4_2" "movbe" => "silvermont")
+                       ("sse4_2" => "nehalem")
+                       ("ssse3" "movbe" => "bonnell")
+                       ("ssse3" "sse3" "longmode" => "nocona")
+                       ("ssse3" "sse3" "lm" => "nocona")
+                       ("ssse3" "sse3" => "prescott")
+                       ("ssse3" => "core2"))))
 
          ;; TODO: Recognize CENTAUR/CYRIX/NSC?
 
@@ -219,13 +236,14 @@ corresponds to CPU, a record as returned by 'current-cpu'."
         (match (cpu-model cpu)
           ((or #xd02 #xd04 #xd03 #xd07 #xd08 #xd09)
            "armv8-a")
-          ((or #xd05 #xd0a #xd0b #xd0e #xd0d #xd41 #xd42 #xd4b #xd46 #xd43 #xd44 #xd41 #xd0c #xd4a)
+          ((or #xd05 #xd0a #xd0b #xd0e #xd0d #xd41 #xd42 #xd4b #xd06 #xd43 #xd44
+               #xd4c #xd0c #xd4a)
            "armv8.2-a")
           (#xd40
            "armv8.4-a")
           (#xd15
            "armv8-r")
-          ((or #xd46 #xd47 #xd48 #xd49 #xd4f)
+          ((or #xd46 #xd47 #xd4d #xd48 #xd4e #xd49 #xd4f)
            "armv9-a")))
        ("0x42"
         "armv8.1-a")
@@ -259,6 +277,8 @@ corresponds to CPU, a record as returned by 'current-cpu'."
         "armv8-a")
        ("0xC0"
         "armv8.6-a")
+       ("0xC00"
+        "armv8-a")
        (_
         "armv8-a"))
      "armv8-a")