unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Prem Mallappa via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org, codonell@redhat.com, schwab@suse.com,
	FWeimer@redhat.com
Cc: Prem Mallappa <Premachandra.Mallappa@amd.com>
Subject: [PATCH 2/3] x86: Add AMD Zen and AVX2/AVX platform support
Date: Tue, 17 Mar 2020 10:16:45 +0530	[thread overview]
Message-ID: <20200317044646.29707-3-PMallappa@amd.com> (raw)
In-Reply-To: <20200317044646.29707-1-PMallappa@amd.com>

From: Prem Mallappa <Premachandra.Mallappa@amd.com>

Priority as below
- AVX512
- Haswell/Zen as they are superset of AVX2/AVX
- AVX2
- AVX

Signed-off-by: Prem Mallappa <Premachandra.Mallappa@amd.com>
---
 sysdeps/x86/cpu-features.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index a36f385976..2097107968 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -328,20 +328,34 @@ set_platform (struct cpu_features *cpu_features)
 		GLRO(dl_hwcap) |= HWCAP_X86_AVX512_1;
 	    }
 	}
+    }
 
-      if (platform == NULL
-	  && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)
-	  && CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable)
-	  && CPU_FEATURES_CPU_P (cpu_features, BMI1)
-	  && CPU_FEATURES_CPU_P (cpu_features, BMI2)
-	  && CPU_FEATURES_CPU_P (cpu_features, LZCNT)
-	  && CPU_FEATURES_CPU_P (cpu_features, MOVBE)
-	  && CPU_FEATURES_CPU_P (cpu_features, POPCNT))
+  if (platform == NULL
+      && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)
+      && CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable)
+      && CPU_FEATURES_CPU_P (cpu_features, BMI1)
+      && CPU_FEATURES_CPU_P (cpu_features, BMI2)
+      && CPU_FEATURES_CPU_P (cpu_features, LZCNT)
+      && CPU_FEATURES_CPU_P (cpu_features, MOVBE)
+      && CPU_FEATURES_CPU_P (cpu_features, POPCNT))
+    {
+      if (cpu_features->basic.kind == arch_kind_intel)
 	platform = "haswell";
+      else if (cpu_features->basic.kind == arch_kind_amd)
+	platform = "zen";
     }
 
+  if (platform == NULL
+      && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable))
+    platform = "generic-avx2";
+
+  if (platform == NULL
+      && CPU_FEATURES_ARCH_P (cpu_features, AVX_Usable))
+    platform = "generic-avx";
+
   if (platform != NULL)
     GLRO(dl_platform) = platform;
+
 #else
   GLRO(dl_hwcap) = 0;
   if (CPU_FEATURES_CPU_P (cpu_features, SSE2))
-- 
2.20.1


  parent reply	other threads:[~2020-03-17  4:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  4:46 [PATCH 0/3] RFC: Platform Support for AMD Zen and AVX2/AVX Prem Mallappa via Libc-alpha
2020-03-17  4:46 ` [PATCH 1/3] x86: Refactor platform support in cpu_features Prem Mallappa via Libc-alpha
2020-03-17  4:46 ` Prem Mallappa via Libc-alpha [this message]
2020-03-17  4:46 ` [PATCH 3/3] x86: test to load from PLATFORM path Prem Mallappa via Libc-alpha
2020-03-17  9:02 ` [PATCH 0/3] RFC: Platform Support for AMD Zen and AVX2/AVX Florian Weimer
2020-03-17 13:17   ` Carlos O'Donell via Libc-alpha
2020-03-17 19:27     ` Adhemerval Zanella via Libc-alpha
2020-03-17 21:37       ` Carlos O'Donell via Libc-alpha
2020-03-27 14:26         ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200317044646.29707-3-PMallappa@amd.com \
    --to=libc-alpha@sourceware.org \
    --cc=FWeimer@redhat.com \
    --cc=Premachandra.Mallappa@amd.com \
    --cc=codonell@redhat.com \
    --cc=prem.mallappa@gmail.com \
    --cc=schwab@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).