]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
S390: Also check vector support in memmove ifunc-selector [BZ #27511]
authorStefan Liebler <stli@linux.ibm.com>
Tue, 23 Mar 2021 16:29:26 +0000 (17:29 +0100)
committerStefan Liebler <stli@linux.ibm.com>
Fri, 26 Mar 2021 10:02:33 +0000 (11:02 +0100)
The arch13 memmove variant is currently selected by the ifunc selector
if the Miscellaneous-Instruction-Extensions Facility 3 facility bit
is present, but the function is also using vector instructions.
If the vector support is not present, one is receiving an operation
exception.

Therefore this patch also checks for vector support in the ifunc
selector and in ifunc-impl-list.c.

Just to be sure, the configure check is now also testing an arch13
vector instruction and an arch13 Miscellaneous-Instruction-Extensions
Facility 3 instruction.

(cherry picked from commit 7759be2593b689cb1eafc0f52ee7f59c639e5d2f)

sysdeps/s390/configure
sysdeps/s390/configure.ac
sysdeps/s390/memmove.c
sysdeps/s390/multiarch/ifunc-impl-list.c

index fa46e9e351e37e551e95884932b26f12a4587e4b..e7f576338d89012dda99be8401d01c14554bc57b 100644 (file)
@@ -123,7 +123,9 @@ void testinsn (char *buf)
     __asm__ (".machine \"arch13\" \n\t"
             ".machinemode \"zarch_nohighgprs\" \n\t"
             "lghi %%r0,16 \n\t"
-            "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0");
+            "mvcrl 0(%0),32(%0) \n\t"
+            "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
+            : : "a" (buf) : "memory", "r0");
 }
 EOF
 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
@@ -271,7 +273,9 @@ else
 void testinsn (char *buf)
 {
     __asm__ ("lghi %%r0,16 \n\t"
-            "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0");
+            "mvcrl 0(%0),32(%0) \n\t"
+            "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
+            : : "a" (buf) : "memory", "r0");
 }
 EOF
 if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
index 3ed5a8ef87f9694b62d37c4746a60f5810d09dcf..5c3479e8cf1fd4f17538665d615df166917cf696 100644 (file)
@@ -88,7 +88,9 @@ void testinsn (char *buf)
     __asm__ (".machine \"arch13\" \n\t"
             ".machinemode \"zarch_nohighgprs\" \n\t"
             "lghi %%r0,16 \n\t"
-            "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0");
+            "mvcrl 0(%0),32(%0) \n\t"
+            "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
+            : : "a" (buf) : "memory", "r0");
 }
 EOF
 dnl test, if assembler supports S390 arch13 instructions
@@ -195,7 +197,9 @@ cat > conftest.c <<\EOF
 void testinsn (char *buf)
 {
     __asm__ ("lghi %%r0,16 \n\t"
-            "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0");
+            "mvcrl 0(%0),32(%0) \n\t"
+            "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
+            : : "a" (buf) : "memory", "r0");
 }
 EOF
 dnl test, if assembler supports S390 arch13 zarch instructions as default
index fb6b69ae2f8f9bb4c756b13813901e2f16bbca23..dc27b1db4c223eea62b60ad1d3f71aa90391d909 100644 (file)
@@ -43,7 +43,7 @@ extern __typeof (__redirect_memmove) MEMMOVE_ARCH13 attribute_hidden;
 s390_libc_ifunc_expr (__redirect_memmove, memmove,
                      ({
                        s390_libc_ifunc_expr_stfle_init ();
-                       (HAVE_MEMMOVE_ARCH13
+                       (HAVE_MEMMOVE_ARCH13 && (hwcap & HWCAP_S390_VXRS_EXT2)
                         && S390_IS_ARCH13_MIE3 (stfle_bits))
                          ? MEMMOVE_ARCH13
                          : (HAVE_MEMMOVE_Z13 && (hwcap & HWCAP_S390_VX))
index 1948436417db1ad2a1d7cebd6dfcb50ef33643a7..6d05652c8a2bcbbca1b5576c4417c9a511c79e9c 100644 (file)
@@ -171,7 +171,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
     IFUNC_IMPL (i, name, memmove,
 # if HAVE_MEMMOVE_ARCH13
                IFUNC_IMPL_ADD (array, i, memmove,
-                               S390_IS_ARCH13_MIE3 (stfle_bits),
+                               ((dl_hwcap & HWCAP_S390_VXRS_EXT2)
+                                && S390_IS_ARCH13_MIE3 (stfle_bits)),
                                MEMMOVE_ARCH13)
 # endif
 # if HAVE_MEMMOVE_Z13