diff mbox series

[1/7] x86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782)

Message ID 01dee4fcc3539959c720b1cc09193f80a5c2ba62.1642162312.git.fweimer@redhat.com
State Committed
Commit 5732a881aad24fac876f5505a212395048a7a483
Headers show
Series Reliable CPU compatibility diagnostics in ld.so | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer Jan. 14, 2022, 12:40 p.m. UTC
HAVE_X86_LAHF_SAHF is implied by x86-64-v2, and HAVE_X86_MOVBE by
x86-64-v3.

The individual flag does not appear in -fverbose-asm flag output
even if the ISA level implies it.
---
 sysdeps/x86/configure    | 4 ++--
 sysdeps/x86/configure.ac | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

H.J. Lu Jan. 14, 2022, 2:21 p.m. UTC | #1
On Fri, Jan 14, 2022 at 4:40 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> HAVE_X86_LAHF_SAHF is implied by x86-64-v2, and HAVE_X86_MOVBE by
> x86-64-v3.
>
> The individual flag does not appear in -fverbose-asm flag output
> even if the ISA level implies it.
> ---
>  sysdeps/x86/configure    | 4 ++--
>  sysdeps/x86/configure.ac | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
> index 62676bb686..7bdbfdc6dc 100644
> --- a/sysdeps/x86/configure
> +++ b/sysdeps/x86/configure
> @@ -155,7 +155,7 @@ else
>    (eval $ac_try) 2>&5
>    ac_status=$?
>    $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> -  test $ac_status = 0; }; } | grep -q "\-msahf"; then
> +  test $ac_status = 0; }; } | grep -qE '(-msahf\b|-march=x86-64-v)'; then
>        libc_cv_have_x86_lahf_sahf=yes
>      fi
>  fi
> @@ -176,7 +176,7 @@ else
>    (eval $ac_try) 2>&5
>    ac_status=$?
>    $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> -  test $ac_status = 0; }; } | grep -q "\-mmovbe"; then
> +  test $ac_status = 0; }; } | grep -qE '(-mmovbe\b|-march=x86-64-v([3-9]|[1-9][0-9]))'; then
>        libc_cv_have_x86_movbe=yes
>      fi
>  fi
> diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
> index 04a12ab680..10d5c2e0e5 100644
> --- a/sysdeps/x86/configure.ac
> +++ b/sysdeps/x86/configure.ac
> @@ -110,7 +110,7 @@ if test $libc_cv_include_x86_isa_level = yes; then
>    AC_CACHE_CHECK([for LAHF/SAHF instruction support],
>                  libc_cv_have_x86_lahf_sahf, [dnl
>      libc_cv_have_x86_lahf_sahf=no
> -    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-msahf"; then
> +    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
>        libc_cv_have_x86_lahf_sahf=yes
>      fi])
>    if test $libc_cv_have_x86_lahf_sahf = yes; then
> @@ -119,7 +119,7 @@ if test $libc_cv_include_x86_isa_level = yes; then
>    AC_CACHE_CHECK([for MOVBE instruction support],
>                  libc_cv_have_x86_movbe, [dnl
>      libc_cv_have_x86_movbe=no
> -    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-mmovbe"; then
> +    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
>        libc_cv_have_x86_movbe=yes
>      fi])
>    if test $libc_cv_have_x86_movbe = yes; then
> --
> 2.34.1
>
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.
diff mbox series

Patch

diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
index 62676bb686..7bdbfdc6dc 100644
--- a/sysdeps/x86/configure
+++ b/sysdeps/x86/configure
@@ -155,7 +155,7 @@  else
   (eval $ac_try) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } | grep -q "\-msahf"; then
+  test $ac_status = 0; }; } | grep -qE '(-msahf\b|-march=x86-64-v)'; then
       libc_cv_have_x86_lahf_sahf=yes
     fi
 fi
@@ -176,7 +176,7 @@  else
   (eval $ac_try) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } | grep -q "\-mmovbe"; then
+  test $ac_status = 0; }; } | grep -qE '(-mmovbe\b|-march=x86-64-v([3-9]|[1-9][0-9]))'; then
       libc_cv_have_x86_movbe=yes
     fi
 fi
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
index 04a12ab680..10d5c2e0e5 100644
--- a/sysdeps/x86/configure.ac
+++ b/sysdeps/x86/configure.ac
@@ -110,7 +110,7 @@  if test $libc_cv_include_x86_isa_level = yes; then
   AC_CACHE_CHECK([for LAHF/SAHF instruction support],
 		 libc_cv_have_x86_lahf_sahf, [dnl
     libc_cv_have_x86_lahf_sahf=no
-    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-msahf"; then
+    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
       libc_cv_have_x86_lahf_sahf=yes
     fi])
   if test $libc_cv_have_x86_lahf_sahf = yes; then
@@ -119,7 +119,7 @@  if test $libc_cv_include_x86_isa_level = yes; then
   AC_CACHE_CHECK([for MOVBE instruction support],
 		 libc_cv_have_x86_movbe, [dnl
     libc_cv_have_x86_movbe=no
-    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -q "\-mmovbe"; then
+    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
       libc_cv_have_x86_movbe=yes
     fi])
   if test $libc_cv_have_x86_movbe = yes; then