[gcc r11-7718] testsuite: Fix up strlenopt-73.c on powerpc [PR99626]

Jakub Jelinek jakub@gcc.gnu.org
Thu Mar 18 15:14:28 GMT 2021


https://gcc.gnu.org/g:fff9faa79043aa53d361e7f6e31b2680007a97e2

commit r11-7718-gfff9faa79043aa53d361e7f6e31b2680007a97e2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 18 16:11:46 2021 +0100

    testsuite: Fix up strlenopt-73.c on powerpc [PR99626]
    
    As mentioned in the testcase as well as in the PR, this testcase relies on
    MOVE_MAX being sufficiently large that the memcpy call is folded early into
    load + store.  Some popular targets define MOVE_MAX to 8 or even 16 (e.g.
    x86_64 or some options on s390x), but many other targets define it to just 4
    (e.g. powerpc 32-bit), or even 2.
    
    The testcase has already one test routine guarded on one particular target
    with MOVE_MAX 16 (but does it incorrectly, __i386__ is only defined on
    32-bit x86 and __SIZEOF_INT128__ is only defined on 64-bit targets), this
    patch fixes that, and guards another test that relies on memcpy (, , 8)
    being folded that way (which therefore needs MOVE_MAX >= 8) on a couple of
    common targets that are known to have such MOVE_MAX.
    
    2021-03-18  Jakub Jelinek  <jakub@redhat.com>
    
            PR testsuite/99626
            * gcc.dg/strlenopt-73.c: Ifdef out test_copy_cond_unequal_length_i64
            on targets other than x86, aarch64, s390 and 64-bit powerpc.  Use
            test_copy_cond_unequal_length_i128 for __x86_64__ with int128 support
            rather than __i386__.

Diff:
---
 gcc/testsuite/gcc.dg/strlenopt-73.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/strlenopt-73.c b/gcc/testsuite/gcc.dg/strlenopt-73.c
index 65239490628..170b66a21b0 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-73.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-73.c
@@ -69,6 +69,13 @@ void test_copy_cond_equal_length (void)
   T ( 0 ==, 33,  1, (i0 ? a32 : b32) + 32);
 }
 
+#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) \
+    || defined(__s390__) || defined(__powerpc64__)
+
+/* The following tests assume GCC transforms the memcpy calls into
+   long long assignments which it does only on targets that define
+   the MOVE_MAX macro to 8 or higher.  Enable on a set of targets
+   known to do that.  */
 
 const char a4[16] = "0123";
 const char b4[16] = "3210";
@@ -84,12 +91,14 @@ void test_copy_cond_unequal_length_i64 (void)
   T (0 <, 16, 8, i0 ? a4 + 2 : b4 + 3);
 }
 
+#endif
+
 
-#if __i386__ && __SIZEOF_INT128__ == 16
+#if defined(__x86_64__) && __SIZEOF_INT128__ == 16
 
 /* The following tests assume GCC transforms the memcpy calls into
    int128_t assignments which it does only on targets that define
-   the MOVE_MAX macro to 16.  That's only s390 and i386 with
+   the MOVE_MAX macro to 16.  That's only s390 and x86_64 with
    int128_t support.  */
 
 const char a8[32] = "01234567";


More information about the Gcc-cvs mailing list