Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 May 2024 08:13:34 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b6011652be32 - stable/13 - Merge commit 87f3407856e6 from llvm-project (by Phoebe Wang):
Message-ID:  <202405200813.44K8DYEd004595@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=b6011652be3240e9d702f28e572ea7993226aa23

commit b6011652be3240e9d702f28e572ea7993226aa23
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-05-16 18:21:45 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-05-20 08:13:00 +0000

    Merge commit 87f3407856e6 from llvm-project (by Phoebe Wang):
    
      [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)
    
    This prevents problems with ports that fail to build with
    CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
    like:
    
      /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
        197 |         const vec_t ones = VSET1_8(1);
            |                            ^
      /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
        116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
            |                                 ^
      /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
      /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
        116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
            |                                 ^
    
    Ports known to be affected are: archivers/libdeflate, devel/highway,
    www/node20, and lang/rust.
    
    (For rust itself there is also a similar issue reported at
    https://github.com/rust-lang/rust/pull/121088).
    
    PR:             276104
    Reported by:    netchild
    MFC after:      3 days
    
    (cherry picked from commit fcfb2d6393712dee3f1f8f0c3840d14817dea416)
---
 contrib/llvm-project/llvm/lib/TargetParser/Host.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp b/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
index 1adef15771fa..848b531dd8dd 100644
--- a/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
+++ b/contrib/llvm-project/llvm/lib/TargetParser/Host.cpp
@@ -1774,7 +1774,8 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
   Features["rtm"]        = HasLeaf7 && ((EBX >> 11) & 1);
   // AVX512 is only supported if the OS supports the context save for it.
   Features["avx512f"]    = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save;
-  Features["evex512"]    = Features["avx512f"];
+  if (Features["avx512f"])
+    Features["evex512"]  = true;
   Features["avx512dq"]   = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save;
   Features["rdseed"]     = HasLeaf7 && ((EBX >> 18) & 1);
   Features["adx"]        = HasLeaf7 && ((EBX >> 19) & 1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405200813.44K8DYEd004595>