]> sourceware.org Git - glibc.git/commitdiff
s390: Use dl-symbol-redir-ifunc.h on cpu-tunables
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Nov 2023 20:25:43 +0000 (17:25 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 21 Nov 2023 19:15:42 +0000 (16:15 -0300)
Using the memcmp symbol directly allows the compile to inline the
memcmp calls (especially because _dl_tunable_set_hwcaps uses constants
values), generating better code.

Checked with tst-tunables on s390x-linux-gnu (qemu system).
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
sysdeps/s390/cpu-features.c
sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h

index 39f8c23a60ef38c9db72c66933b9591210ee8fc3..55449ba07f57a19856e6d18cfe02bb855eed9354 100644 (file)
@@ -21,7 +21,7 @@
 #include <elf/dl-tunables.h>
 #include <ifunc-memcmp.h>
 #include <string.h>
-extern __typeof (memcmp) MEMCMP_DEFAULT;
+#include <dl-symbol-redir-ifunc.h>
 
 #define S390_COPY_CPU_FEATURES(SRC_PTR, DEST_PTR)      \
   (DEST_PTR)->hwcap = (SRC_PTR)->hwcap;                        \
@@ -89,9 +89,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
       if ((*feature == 'z' || *feature == 'a'))
        {
          if ((feature_len == 5 && *feature == 'z'
-              && MEMCMP_DEFAULT (feature, "zEC12", 5) == 0)
+              && memcmp (feature, "zEC12", 5) == 0)
              || (feature_len == 6 && *feature == 'a'
-                 && MEMCMP_DEFAULT (feature, "arch10", 6) == 0))
+                 && memcmp (feature, "arch10", 6) == 0))
            {
              reset_features = true;
              disable = true;
@@ -100,9 +100,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
              stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3;
            }
          else if ((feature_len == 3 && *feature == 'z'
-                   && MEMCMP_DEFAULT (feature, "z13", 3) == 0)
+                   && memcmp (feature, "z13", 3) == 0)
                   || (feature_len == 6 && *feature == 'a'
-                      && MEMCMP_DEFAULT (feature, "arch11", 6) == 0))
+                      && memcmp (feature, "arch11", 6) == 0))
            {
              reset_features = true;
              disable = true;
@@ -110,9 +110,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
              stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3;
            }
          else if ((feature_len == 3 && *feature == 'z'
-                   && MEMCMP_DEFAULT (feature, "z14", 3) == 0)
+                   && memcmp (feature, "z14", 3) == 0)
                   || (feature_len == 6 && *feature == 'a'
-                      && MEMCMP_DEFAULT (feature, "arch12", 6) == 0))
+                      && memcmp (feature, "arch12", 6) == 0))
            {
              reset_features = true;
              disable = true;
@@ -120,11 +120,11 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
              stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3;
            }
          else if ((feature_len == 3 && *feature == 'z'
-                   && (MEMCMP_DEFAULT (feature, "z15", 3) == 0
-                       || MEMCMP_DEFAULT (feature, "z16", 3) == 0))
+                   && (memcmp (feature, "z15", 3) == 0
+                       || memcmp (feature, "z16", 3) == 0))
                   || (feature_len == 6
-                      && (MEMCMP_DEFAULT (feature, "arch13", 6) == 0
-                          || MEMCMP_DEFAULT (feature, "arch14", 6) == 0)))
+                      && (memcmp (feature, "arch13", 6) == 0
+                          || memcmp (feature, "arch14", 6) == 0)))
            {
              /* For z15 or newer we don't have to disable something,
                 but we have to reset to the original values.  */
@@ -134,14 +134,14 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
       else if (*feature == 'H')
        {
          if (feature_len == 15
-             && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS", 15) == 0)
+             && memcmp (feature, "HWCAP_S390_VXRS", 15) == 0)
            {
              hwcap_mask = HWCAP_S390_VXRS;
              if (disable)
                hwcap_mask |= HWCAP_S390_VXRS_EXT | HWCAP_S390_VXRS_EXT2;
            }
          else if (feature_len == 19
-                  && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS_EXT", 19) == 0)
+                  && memcmp (feature, "HWCAP_S390_VXRS_EXT", 19) == 0)
            {
              hwcap_mask = HWCAP_S390_VXRS_EXT;
              if (disable)
@@ -150,7 +150,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
                hwcap_mask |= HWCAP_S390_VXRS;
            }
          else if (feature_len == 20
-                  && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS_EXT2", 20) == 0)
+                  && memcmp (feature, "HWCAP_S390_VXRS_EXT2", 20) == 0)
            {
              hwcap_mask = HWCAP_S390_VXRS_EXT2;
              if (!disable)
@@ -160,7 +160,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
       else if (*feature == 'S')
        {
          if (feature_len == 10
-             && MEMCMP_DEFAULT (feature, "STFLE_MIE3", 10) == 0)
+             && memcmp (feature, "STFLE_MIE3", 10) == 0)
            {
              stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3;
            }
index aa084fdcdeace9647a189d5f8ddee717dbdef42c..0f58897c48162e8d16f35fa5c6324330ae886516 100644 (file)
 #define _DL_IFUNC_GENERIC_H
 
 #include <ifunc-memset.h>
+#include <ifunc-memcmp.h>
 
 #define IFUNC_SYMBOL_STR1(s)   #s
 #define IFUNC_SYMBOL_STR(s)    IFUNC_SYMBOL_STR1(s)
 
 asm ("memset = " IFUNC_SYMBOL_STR(MEMSET_DEFAULT));
+asm ("memcmp = " IFUNC_SYMBOL_STR(MEMCMP_DEFAULT));
 
 #endif
This page took 0.044227 seconds and 5 git commands to generate.