93dc2d
commit 5732a881aad24fac876f5505a212395048a7a483
93dc2d
Author: Florian Weimer <fweimer@redhat.com>
93dc2d
Date:   Fri Jan 14 16:09:20 2022 +0100
93dc2d
93dc2d
    x86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782)
93dc2d
    
93dc2d
    HAVE_X86_LAHF_SAHF is implied by x86-64-v2, and HAVE_X86_MOVBE by
93dc2d
    x86-64-v3.
93dc2d
    
93dc2d
    The individual flag does not appear in -fverbose-asm flag output
93dc2d
    even if the ISA level implies it.
93dc2d
    
93dc2d
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
93dc2d
93dc2d
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
93dc2d
index 62676bb686850938..7bdbfdc6dc2ad38f 100644
93dc2d
--- a/sysdeps/x86/configure
93dc2d
+++ b/sysdeps/x86/configure
93dc2d
@@ -155,7 +155,7 @@ else
93dc2d
   (eval $ac_try) 2>&5
93dc2d
   ac_status=$?
93dc2d
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
93dc2d
-  test $ac_status = 0; }; } | grep -q "\-msahf"; then
93dc2d
+  test $ac_status = 0; }; } | grep -qE '(-msahf\b|-march=x86-64-v)'; then
93dc2d
       libc_cv_have_x86_lahf_sahf=yes
93dc2d
     fi
93dc2d
 fi
93dc2d
@@ -176,7 +176,7 @@ else
93dc2d
   (eval $ac_try) 2>&5
93dc2d
   ac_status=$?
93dc2d
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
93dc2d
-  test $ac_status = 0; }; } | grep -q "\-mmovbe"; then
93dc2d
+  test $ac_status = 0; }; } | grep -qE '(-mmovbe\b|-march=x86-64-v([3-9]|[1-9][0-9]))'; then
93dc2d
       libc_cv_have_x86_movbe=yes
93dc2d
     fi
93dc2d
 fi
93dc2d
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
93dc2d
index 04a12ab68048cd66..10d5c2e0e555fc79 100644
93dc2d
--- a/sysdeps/x86/configure.ac
93dc2d
+++ b/sysdeps/x86/configure.ac
93dc2d
@@ -110,7 +110,7 @@ if test $libc_cv_include_x86_isa_level = yes; then
93dc2d
   AC_CACHE_CHECK([for LAHF/SAHF instruction support],
93dc2d
 		 libc_cv_have_x86_lahf_sahf, [dnl
93dc2d
     libc_cv_have_x86_lahf_sahf=no
93dc2d
-    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-msahf"; then
93dc2d
+    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-msahf\b|-march=x86-64-v)'; then
93dc2d
       libc_cv_have_x86_lahf_sahf=yes
93dc2d
     fi])
93dc2d
   if test $libc_cv_have_x86_lahf_sahf = yes; then
93dc2d
@@ -119,7 +119,7 @@ if test $libc_cv_include_x86_isa_level = yes; then
93dc2d
   AC_CACHE_CHECK([for MOVBE instruction support],
93dc2d
 		 libc_cv_have_x86_movbe, [dnl
93dc2d
     libc_cv_have_x86_movbe=no
93dc2d
-    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-mmovbe"; then
93dc2d
+    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-mmovbe\b|-march=x86-64-v(@<:@3-9@:>@|@<:@1-9@:>@@<:@0-9@:>@))'; then
93dc2d
       libc_cv_have_x86_movbe=yes
93dc2d
     fi])
93dc2d
   if test $libc_cv_have_x86_movbe = yes; then