aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/builtins
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/builtins')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c87
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c36
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c36
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c86
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c90
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c34
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c169
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c41
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c79
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c31
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c45
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c76
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c47
25 files changed, 13 insertions, 888 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c
index 1584515af78..6ca246d3922 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/abs-1.c
@@ -9,7 +9,6 @@ int abs_called = 0;
extern int abs (int);
extern long labs (long);
extern void abort (void);
-extern void exit (int);
void
main_test (void)
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
index cfd79baef47..6f3c3170cc1 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
@@ -9,3 +9,15 @@ main ()
inside_main = 0;
return 0;
}
+
+/* When optimizing, all the constant cases should have been
+ constant folded, so no calls to link_error should remain.
+ In any case, link_error should not be called. */
+
+#ifndef __OPTIMIZE__
+void
+link_error (void)
+{
+ abort ();
+}
+#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
index 737a48f63dc..fa43c934312 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
@@ -20,7 +20,7 @@ strstr(const char *s1, const char *s2)
break;
p++, q++;
}
- if (*q == 0)
+ if (*p == *q && *p == 0)
return (char *)s1;
}
return 0;
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c
deleted file mode 100644
index c9d8b8da7b9..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1-lib.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "lib/strrchr.c"
-#include "lib/strlen.c"
-#include "lib/strcmp.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c
deleted file mode 100644
index 8a60e7e80ae..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-1.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation.
-
- Ensure all expected transformations of builtin strlen, strcmp,
- strrchr and rindex occur and perform correctly.
-
- Written by Jakub Jelinek, 11/7/2000. */
-
-extern void abort (void);
-extern __SIZE_TYPE__ strlen (const char *);
-extern int strcmp (const char *, const char *);
-extern char *strrchr (const char *, int);
-extern char *rindex (const char *, int);
-
-int x = 6;
-char *bar = "hi world";
-
-void
-main_test (void)
-{
- const char *const foo = "hello world";
-
- if (strlen (foo) != 11)
- abort ();
- if (strlen (foo + 4) != 7)
- abort ();
- if (strlen (foo + (x++ & 7)) != 5)
- abort ();
- if (x != 7)
- abort ();
- if (strcmp (foo, "hello") <= 0)
- abort ();
- if (strcmp (foo + 2, "llo") <= 0)
- abort ();
- if (strcmp (foo, foo) != 0)
- abort ();
- if (strcmp (foo, "hello world ") >= 0)
- abort ();
- if (strcmp (foo + 10, "dx") >= 0)
- abort ();
- if (strcmp (10 + foo, "dx") >= 0)
- abort ();
- if (strcmp (bar, "") <= 0)
- abort ();
- if (strcmp ("", bar) >= 0)
- abort ();
- if (strcmp (bar+8, "") != 0)
- abort ();
- if (strcmp ("", bar+8) != 0)
- abort ();
- if (strcmp (bar+(--x), "") <= 0 || x != 6)
- abort ();
- if (strcmp ("", bar+(++x)) >= 0 || x != 7)
- abort ();
- if (strrchr (foo, 'x'))
- abort ();
- if (strrchr (foo, 'o') != foo + 7)
- abort ();
- if (strrchr (foo, 'e') != foo + 1)
- abort ();
- if (strrchr (foo + 3, 'e'))
- abort ();
- if (strrchr (foo, '\0') != foo + 11)
- abort ();
- if (strrchr (bar, '\0') != bar + 8)
- abort ();
- if (strrchr (bar + 4, '\0') != bar + 8)
- abort ();
- if (strrchr (bar + (x++ & 3), '\0') != bar + 8)
- abort ();
- if (x != 8)
- abort ();
- /* Test only one instance of rindex since the code path is the same
- as that of strrchr. */
- if (rindex ("hello", 'z') != 0)
- abort ();
-
- /* Test at least one instance of the __builtin_ style. We do this
- to ensure that it works and that the prototype is correct. */
- if (__builtin_rindex (foo, 'o') != foo + 7)
- abort ();
- if (__builtin_strrchr (foo, 'o') != foo + 7)
- abort ();
- if (__builtin_strlen (foo) != 11)
- abort ();
- if (__builtin_strcmp (foo, "hello") <= 0)
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c
deleted file mode 100644
index 9049fb9e1ff..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lib/strchr.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c
deleted file mode 100644
index 08e87c63d30..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-2.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation.
-
- Ensure all expected transformations of builtin strchr and index
- occur and perform correctly.
-
- Written by Jakub Jelinek, 11/7/2000. */
-
-extern void abort (void);
-extern char *strchr (const char *, int);
-extern char *index (const char *, int);
-
-void
-main_test (void)
-{
- const char *const foo = "hello world";
-
- if (strchr (foo, 'x'))
- abort ();
- if (strchr (foo, 'o') != foo + 4)
- abort ();
- if (strchr (foo + 5, 'o') != foo + 7)
- abort ();
- if (strchr (foo, '\0') != foo + 11)
- abort ();
- /* Test only one instance of index since the code path is the same
- as that of strchr. */
- if (index ("hello", 'z') != 0)
- abort ();
-
- /* Test at least one instance of the __builtin_ style. We do this
- to ensure that it works and that the prototype is correct. */
- if (__builtin_strchr (foo, 'o') != foo + 4)
- abort ();
- if (__builtin_index (foo, 'o') != foo + 4)
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c
deleted file mode 100644
index d5326ffeb2b..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3-lib.c
+++ /dev/null
@@ -1,17 +0,0 @@
-extern int inside_main;
-
-void *
-memset (void *dst, int c, __SIZE_TYPE__ n)
-{
- /* Single-byte memsets should be done inline when optimisation
- is enabled. */
-#ifdef __OPTIMIZE__
- if (inside_main && n < 2)
- abort ();
-#endif
-
- while (n-- != 0)
- n[(char *) dst] = c;
-
- return dst;
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c
deleted file mode 100644
index cf7c1e303e8..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-3.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation.
-
- Ensure that builtin memset operations for constant length and
- non-constant assigned value don't cause compiler problems.
-
- Written by Roger Sayle, 21 April 2002. */
-
-extern void abort (void);
-typedef __SIZE_TYPE__ size_t;
-extern void *memset (void *, int, size_t);
-
-char buffer[32];
-int argc = 1;
-
-void
-main_test (void)
-{
- memset (buffer, argc, 0);
- memset (buffer, argc, 1);
- memset (buffer, argc, 2);
- memset (buffer, argc, 3);
- memset (buffer, argc, 4);
- memset (buffer, argc, 5);
- memset (buffer, argc, 6);
- memset (buffer, argc, 7);
- memset (buffer, argc, 8);
- memset (buffer, argc, 9);
- memset (buffer, argc, 10);
- memset (buffer, argc, 11);
- memset (buffer, argc, 12);
- memset (buffer, argc, 13);
- memset (buffer, argc, 14);
- memset (buffer, argc, 15);
- memset (buffer, argc, 16);
- memset (buffer, argc, 17);
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c
deleted file mode 100644
index 3b69c3baea8..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4-lib.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "lib/stpcpy.c"
-#include "lib/mempcpy.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c
deleted file mode 100644
index 51819b1cfa9..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-4.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation.
-
- Ensure builtin mempcpy and stpcpy perform correctly.
-
- Written by Kaveh Ghazi, 4/11/2003. */
-
-extern void abort (void);
-extern char *strcpy (char *, const char *);
-extern char *stpcpy (char *, const char *);
-typedef __SIZE_TYPE__ size_t;
-extern size_t strlen(const char *);
-extern void *memcpy (void *, const void *, size_t);
-extern void *mempcpy (void *, const void *, size_t);
-extern int memcmp (const void *, const void *, size_t);
-extern int inside_main;
-
-const char s1[] = "123";
-char p[32] = "";
-char *s2 = "defg";
-char *s3 = "FGH";
-size_t l1 = 1;
-
-void
-main_test (void)
-{
- int i;
-
-#if !defined __i386__ && !defined __x86_64__
- /* The functions below might not be optimized into direct stores on all
- arches. It depends on how many instructions would be generated and
- what limits the architecture chooses in STORE_BY_PIECES_P. */
- inside_main = 0;
-#endif
-
- if (stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6))
- abort ();
- if (stpcpy (p + 16, "vwxyz" + 1) != p + 16 + 4 || memcmp (p + 16, "wxyz", 5))
- abort ();
- if (stpcpy (p + 1, "") != p + 1 + 0 || memcmp (p, "a\0cde", 6))
- abort ();
- if (stpcpy (p + 3, "fghij") != p + 3 + 5 || memcmp (p, "a\0cfghij", 9))
- abort ();
- if (mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6))
- abort ();
- if (mempcpy (p + 16, "VWX" + 1, 2) != p + 16 + 2 || memcmp (p + 16, "WXyz", 5))
- abort ();
- if (mempcpy (p + 1, "", 1) != p + 1 + 1 || memcmp (p, "A\0CDE", 6))
- abort ();
- if (mempcpy (p + 3, "FGHI", 4) != p + 3 + 4 || memcmp (p, "A\0CFGHIj", 9))
- abort ();
-
- i = 8;
- memcpy (p + 20, "qrstu", 6);
- if (stpcpy ((i++, p + 20 + 1), "23") != (p + 20 + 1 + 2) || i != 9 || memcmp (p + 20, "q23\0u", 6))
- abort ();
-
- memcpy (p + 25, "QRSTU", 6);
- if (mempcpy (p + 25 + 1, s1, 3) != (p + 25 + 1 + 3) || memcmp (p + 25, "Q123U", 6))
- abort ();
-
- if (stpcpy (stpcpy (p, "ABCD"), "EFG") != p + 7 || memcmp (p, "ABCDEFG", 8))
- abort();
- if (mempcpy (mempcpy (p, "abcdEFG", 4), "efg", 4) != p + 8 || memcmp (p, "abcdefg", 8))
- abort();
-
- /* Test at least one instance of the __builtin_ style. We do this
- to ensure that it works and that the prototype is correct. */
- if (__builtin_stpcpy (p, "abcde") != p + 5 || memcmp (p, "abcde", 6))
- abort ();
- if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6))
- abort ();
-
- /* If the result of stpcpy/mempcpy is ignored, gcc should use
- strcpy/memcpy. This should be optimized always, so set inside_main
- again. */
- inside_main = 1;
- stpcpy (p + 3, s2);
- if (memcmp (p, "ABCdefg", 8))
- abort ();
- mempcpy (p + 5, s3, 1);
- if (memcmp (p, "ABCdeFg", 8))
- abort ();
- mempcpy (p + 6, s3 + 1, l1);
- if (memcmp (p, "ABCdeFG", 8))
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c
deleted file mode 100644
index 5be3df52fe5..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lib/memmove.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c
deleted file mode 100644
index 4a18fc6400f..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-5.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation.
-
- Ensure builtin memmove and bcopy perform correctly.
-
- Written by Jakub Jelinek, 4/26/2003. */
-
-extern void abort (void);
-typedef __SIZE_TYPE__ size_t;
-extern void *memmove (void *, const void *, size_t);
-extern void bcopy (const void *, void *, size_t);
-extern int memcmp (const void *, const void *, size_t);
-
-const char s1[] = "123";
-char p[32] = "";
-
-static const struct foo
-{
- char *s;
- double d;
- long l;
-} foo[] =
-{
- { "hello world1", 3.14159, 101L },
- { "hello world2", 3.14159, 102L },
- { "hello world3", 3.14159, 103L },
- { "hello world4", 3.14159, 104L },
- { "hello world5", 3.14159, 105L },
- { "hello world6", 3.14159, 106L }
-};
-
-static const struct bar
-{
- char *s;
- const struct foo f[3];
-} bar[] =
-{
- {
- "hello world10",
- {
- { "hello1", 3.14159, 201L },
- { "hello2", 3.14159, 202L },
- { "hello3", 3.14159, 203L },
- }
- },
- {
- "hello world11",
- {
- { "hello4", 3.14159, 204L },
- { "hello5", 3.14159, 205L },
- { "hello6", 3.14159, 206L },
- }
- }
-};
-
-static const int baz[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
-
-void
-main_test (void)
-{
- const char *s;
- struct foo f1[sizeof foo/sizeof*foo];
- struct bar b1[sizeof bar/sizeof*bar];
- int bz[sizeof baz/sizeof*baz];
-
- if (memmove (f1, foo, sizeof (foo)) != f1 || memcmp (f1, foo, sizeof(foo)))
- abort();
- if (memmove (b1, bar, sizeof (bar)) != b1 || memcmp (b1, bar, sizeof(bar)))
- abort();
- bcopy (baz, bz, sizeof (baz));
- if (memcmp (bz, baz, sizeof(baz)))
- abort();
-
- if (memmove (p, "abcde", 6) != p || memcmp (p, "abcde", 6))
- abort ();
- s = s1;
- if (memmove (p + 2, ++s, 0) != p + 2 || memcmp (p, "abcde", 6) || s != s1 + 1)
- abort ();
- if (__builtin_memmove (p + 3, "", 1) != p + 3 || memcmp (p, "abc\0e", 6))
- abort ();
- bcopy ("fghijk", p + 2, 4);
- if (memcmp (p, "abfghi", 7))
- abort ();
- s = s1 + 1;
- bcopy (s++, p + 1, 0);
- if (memcmp (p, "abfghi", 7) || s != s1 + 2)
- abort ();
- __builtin_bcopy ("ABCDE", p + 4, 1);
- if (memcmp (p, "abfgAi", 7))
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c
deleted file mode 100644
index 029a92e77d5..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lib/memcmp.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c
deleted file mode 100644
index 869dba17baa..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-6.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation.
-
- Ensure that builtin memcmp operations when all three arguments
- are constant is optimized and performs correctly. Taken from
- PR optimize/3508.
-
- Written by Roger Sayle, 12/26/2001. */
-
-extern void abort (void);
-extern void link_error (void);
-
-typedef __SIZE_TYPE__ size_t;
-extern int memcmp (const void *, const void *, size_t);
-
-void
-main_test (void)
-{
- if (memcmp ("abcd", "efgh", 4) >= 0)
- link_error ();
- if (memcmp ("abcd", "abcd", 4) != 0)
- link_error ();
- if (memcmp ("efgh", "abcd", 4) <= 0)
- link_error ();
-}
-
-#ifndef __OPTIMIZE__
-/* When not optimizing, the above tests may generate references to
- the function link_error, but should never actually call it. */
-void
-link_error ()
-{
- abort ();
-}
-#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c
deleted file mode 100644
index 3b69c3baea8..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7-lib.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "lib/stpcpy.c"
-#include "lib/mempcpy.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c
deleted file mode 100644
index 5eb1ac4af78..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-7.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation.
-
- Ensure that builtin mempcpy and stpcpy perform correctly.
-
- Written by Jakub Jelinek, 21/05/2003. */
-
-extern void abort (void);
-typedef __SIZE_TYPE__ size_t;
-extern void *mempcpy (void *, const void *, size_t);
-extern int memcmp (const void *, const void *, size_t);
-extern char *stpcpy (char *, const char *);
-extern int inside_main;
-
-long buf1[64];
-char *buf2 = (char *) (buf1 + 32);
-long buf5[20];
-char buf7[20];
-
-int
-__attribute__((noinline))
-test (long *buf3, char *buf4, char *buf6, int n)
-{
- int i = 0;
-
- /* These should probably be handled by store_by_pieces on most arches. */
- if (mempcpy (buf1, "ABCDEFGHI", 9) != (char *) buf1 + 9
- || memcmp (buf1, "ABCDEFGHI\0", 11))
- abort ();
-
- if (mempcpy (buf1, "abcdefghijklmnopq", 17) != (char *) buf1 + 17
- || memcmp (buf1, "abcdefghijklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf3, "ABCDEF", 6) != (char *) buf1 + 6
- || memcmp (buf1, "ABCDEFghijklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf3, "a", 1) != (char *) buf1 + 1
- || memcmp (buf1, "aBCDEFghijklmnopq\0", 19))
- abort ();
-
- if (mempcpy ((char *) buf3 + 2, "bcd" + ++i, 2) != (char *) buf1 + 4
- || memcmp (buf1, "aBcdEFghijklmnopq\0", 19)
- || i != 1)
- abort ();
-
- /* These should probably be handled by move_by_pieces on most arches. */
- if (mempcpy ((char *) buf3 + 4, buf5, 6) != (char *) buf1 + 10
- || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, 1)
- != (char *) buf1 + 11
- || memcmp (buf1, "aBcdRSTUVWSlmnopq\0", 19)
- || i != 2)
- abort ();
-
- if (mempcpy ((char *) buf3 + 14, buf6, 2) != (char *) buf1 + 16
- || memcmp (buf1, "aBcdRSTUVWSlmnrsq\0", 19))
- abort ();
-
- if (mempcpy (buf3, buf5, 8) != (char *) buf1 + 8
- || memcmp (buf1, "RSTUVWXYVWSlmnrsq\0", 19))
- abort ();
-
- if (mempcpy (buf3, buf5, 17) != (char *) buf1 + 17
- || memcmp (buf1, "RSTUVWXYZ01234567\0", 19))
- abort ();
-
- __builtin_memcpy (buf3, "aBcdEFghijklmnopq\0", 19);
-
- /* These should be handled either by movstrendM or mempcpy
- call. */
- if (mempcpy ((char *) buf3 + 4, buf5, n + 6) != (char *) buf1 + 10
- || memcmp (buf1, "aBcdRSTUVWklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy ((char *) buf1 + ++i + 8, (char *) buf5 + 1, n + 1)
- != (char *) buf1 + 12
- || memcmp (buf1, "aBcdRSTUVWkSmnopq\0", 19)
- || i != 3)
- abort ();
-
- if (mempcpy ((char *) buf3 + 14, buf6, n + 2) != (char *) buf1 + 16
- || memcmp (buf1, "aBcdRSTUVWkSmnrsq\0", 19))
- abort ();
-
- i = 1;
-
- /* These might be handled by store_by_pieces. */
- if (mempcpy (buf2, "ABCDEFGHI", 9) != buf2 + 9
- || memcmp (buf2, "ABCDEFGHI\0", 11))
- abort ();
-
- if (mempcpy (buf2, "abcdefghijklmnopq", 17) != buf2 + 17
- || memcmp (buf2, "abcdefghijklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf4, "ABCDEF", 6) != buf2 + 6
- || memcmp (buf2, "ABCDEFghijklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf4, "a", 1) != buf2 + 1
- || memcmp (buf2, "aBCDEFghijklmnopq\0", 19))
- abort ();
-
- if (mempcpy (buf4 + 2, "bcd" + i++, 2) != buf2 + 4
- || memcmp (buf2, "aBcdEFghijklmnopq\0", 19)
- || i != 2)
- abort ();
-
- /* These might be handled by move_by_pieces. */
- if (mempcpy (buf4 + 4, buf7, 6) != buf2 + 10
- || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, 1)
- != buf2 + 11
- || memcmp (buf2, "aBcdRSTUVWSlmnopq\0", 19)
- || i != 3)
- abort ();
-
- if (mempcpy (buf4 + 14, buf6, 2) != buf2 + 16
- || memcmp (buf2, "aBcdRSTUVWSlmnrsq\0", 19))
- abort ();
-
- __builtin_memcpy (buf4, "aBcdEFghijklmnopq\0", 19);
-
- /* These should be handled either by movstrendM or mempcpy
- call. */
- if (mempcpy (buf4 + 4, buf7, n + 6) != buf2 + 10
- || memcmp (buf2, "aBcdRSTUVWklmnopq\0", 19))
- abort ();
-
- if (__builtin_mempcpy (buf2 + i++ + 8, buf7 + 1, n + 1)
- != buf2 + 12
- || memcmp (buf2, "aBcdRSTUVWkSmnopq\0", 19)
- || i != 4)
- abort ();
-
- if (mempcpy (buf4 + 14, buf6, n + 2) != buf2 + 16
- || memcmp (buf2, "aBcdRSTUVWkSmnrsq\0", 19))
- abort ();
-
- /* Now stpcpy tests. */
- if (stpcpy ((char *) buf3, "abcdefghijklmnop") != (char *) buf1 + 16
- || memcmp (buf1, "abcdefghijklmnop", 17))
- abort ();
-
- if (__builtin_stpcpy ((char *) buf3, "ABCDEFG") != (char *) buf1 + 7
- || memcmp (buf1, "ABCDEFG\0ijklmnop", 17))
- abort ();
-
- if (stpcpy ((char *) buf3 + i++, "x") != (char *) buf1 + 5
- || memcmp (buf1, "ABCDx\0G\0ijklmnop", 17))
- abort ();
-
- return 0;
-}
-
-void
-main_test (void)
-{
- /* All these tests are allowed to call mempcpy/stpcpy. */
- inside_main = 0;
- __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20);
- __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20);
- test (buf1, buf2, "rstuvwxyz", 0);
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c
deleted file mode 100644
index 9753c2498f1..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lib/strlen.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c
deleted file mode 100644
index 220b6ed8e2e..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-8.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation.
-
- Test strlen optimizations on conditional expressions.
-
- Written by Jakub Jelinek, June 23, 2003. */
-
-typedef __SIZE_TYPE__ size_t;
-extern char *strcpy (char *, const char *);
-extern int memcmp (const void *, const void *, size_t);
-extern void abort (void);
-extern void exit (int);
-extern int inside_main;
-
-size_t g, h, i, j, k, l;
-
-size_t
-foo (void)
-{
- if (l)
- abort ();
- return ++l;
-}
-
-void
-main_test (void)
-{
- if (strlen (i ? "foo" + 1 : j ? "bar" + 1 : "baz" + 1) != 2)
- abort ();
- if (strlen (g++ ? "foo" : "bar") != 3 || g != 1)
- abort ();
- if (strlen (h++ ? "xfoo" + 1 : "bar") != 3 || h != 1)
- abort ();
- if (strlen ((i++, "baz")) != 3 || i != 1)
- abort ();
- /* The following calls might not optimize strlen call away. */
- inside_main = 0;
- if (strlen (j ? "foo" + k++ : "bar" + k++) != 3 || k != 1)
- abort ();
- if (strlen (foo () ? "foo" : "bar") != 3 || l != 1)
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c
deleted file mode 100644
index 0a0bbb8865a..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lib/strcat.c"
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c
deleted file mode 100644
index ba70c397724..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-9.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation.
-
- Ensure all expected transformations of builtin strcat occur and
- perform correctly.
-
- Written by Kaveh R. Ghazi, 11/27/2000. */
-
-extern int inside_main;
-extern void abort (void);
-typedef __SIZE_TYPE__ size_t;
-extern char *strcat (char *, const char *);
-extern char *strcpy (char *, const char *);
-extern int strcmp (const char *, const char *);
-extern void *memset (void *, int, size_t);
-extern int memcmp (const void *, const void *, size_t);
-#define RESET_DST_WITH(FILLER) \
- do { memset (dst, 'X', sizeof (dst)); strcpy (dst, (FILLER)); } while (0)
-
-void main_test (void)
-{
- const char *const s1 = "hello world";
- const char *const s2 = "";
- char dst[64], *d2;
-
- RESET_DST_WITH (s1);
- if (strcat (dst, "") != dst || strcmp (dst, s1))
- abort();
- RESET_DST_WITH (s1);
- if (strcat (dst, s2) != dst || strcmp (dst, s1))
- abort();
- RESET_DST_WITH (s1); d2 = dst;
- if (strcat (++d2, s2) != dst+1 || d2 != dst+1 || strcmp (dst, s1))
- abort();
- RESET_DST_WITH (s1); d2 = dst;
- if (strcat (++d2+5, s2) != dst+6 || d2 != dst+1 || strcmp (dst, s1))
- abort();
- RESET_DST_WITH (s1); d2 = dst;
- if (strcat (++d2+5, s1+11) != dst+6 || d2 != dst+1 || strcmp (dst, s1))
- abort();
-
-#ifndef __OPTIMIZE_SIZE__
-# if !defined __i386__ && !defined __x86_64__
- /* The functions below might not be optimized into direct stores on all
- arches. It depends on how many instructions would be generated and
- what limits the architecture chooses in STORE_BY_PIECES_P. */
- inside_main = 0;
-# endif
-
- RESET_DST_WITH (s1);
- if (strcat (dst, " 1111") != dst
- || memcmp (dst, "hello world 1111\0XXX", 20))
- abort();
-
- RESET_DST_WITH (s1);
- if (strcat (dst+5, " 2222") != dst+5
- || memcmp (dst, "hello world 2222\0XXX", 20))
- abort();
-
- RESET_DST_WITH (s1); d2 = dst;
- if (strcat (++d2+5, " 3333") != dst+6 || d2 != dst+1
- || memcmp (dst, "hello world 3333\0XXX", 20))
- abort();
-
- RESET_DST_WITH (s1);
- strcat (strcat (strcat (strcat (strcat (strcat (dst, ": this "), ""),
- "is "), "a "), "test"), ".");
- if (memcmp (dst, "hello world: this is a test.\0X", 30))
- abort();
-
- /* Set inside_main again. */
- inside_main = 1;
-#endif
-
- /* Test at least one instance of the __builtin_ style. We do this
- to ensure that it works and that the prototype is correct. */
- RESET_DST_WITH (s1);
- if (__builtin_strcat (dst, "") != dst || strcmp (dst, s1))
- abort();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c
deleted file mode 100644
index a0318212e67..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1-lib.c
+++ /dev/null
@@ -1,31 +0,0 @@
-extern int inside_main;
-extern const char *p;
-
-char *
-my_strstr (const char *s1, const char *s2)
-{
- __SIZE_TYPE__ len = strlen (s2);
-
-#ifdef __OPTIMIZE__
- /* If optimizing, we should be called only in the strstr (foo + 2, p)
- case. All other cases should be optimized. */
- if (inside_main)
- if (s2 != p || strcmp (s1, "hello world" + 2) != 0)
- abort ();
-#endif
- if (len == 0)
- return (char *) s1;
- for (s1 = strchr (s1, *s2); s1; s1 = strchr (s1 + 1, *s2))
- if (strncmp (s1, s2, len) == 0)
- return (char *) s1;
- return (char *) 0;
-}
-
-char *
-strstr (const char *s1, const char *s2)
-{
- if (inside_main)
- abort ();
-
- return my_strstr (s1, s2);
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c
deleted file mode 100644
index 3c3e45dfa5d..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-1.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation.
-
- Ensure all expected transformations of builtin strstr occur and
- perform correctly in presence of redirect. */
-
-#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
-#define ASMNAME2(prefix, cname) STRING (prefix) cname
-#define STRING(x) #x
-
-typedef __SIZE_TYPE__ size_t;
-extern void abort (void);
-extern char *strstr (const char *, const char *)
- __asm (ASMNAME ("my_strstr"));
-
-const char *p = "rld", *q = "hello world";
-
-void
-main_test (void)
-{
- const char *const foo = "hello world";
-
- if (strstr (foo, "") != foo)
- abort ();
- if (strstr (foo + 4, "") != foo + 4)
- abort ();
- if (strstr (foo, "h") != foo)
- abort ();
- if (strstr (foo, "w") != foo + 6)
- abort ();
- if (strstr (foo + 6, "o") != foo + 7)
- abort ();
- if (strstr (foo + 1, "world") != foo + 6)
- abort ();
- if (strstr (foo + 2, p) != foo + 8)
- abort ();
- if (strstr (q, "") != q)
- abort ();
- if (strstr (q + 1, "o") != q + 4)
- abort ();
-
- /* Test at least one instance of the __builtin_ style. We do this
- to ensure that it works and that the prototype is correct. */
- if (__builtin_strstr (foo + 1, "world") != foo + 6)
- abort ();
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c
deleted file mode 100644
index 16369a21794..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2-lib.c
+++ /dev/null
@@ -1,76 +0,0 @@
-extern int inside_main;
-typedef __SIZE_TYPE__ size_t;
-
-#define TEST_ABORT if (inside_main) abort()
-
-void *
-my_memcpy (void *d, const void *s, size_t n)
-{
- char *dst = (char *) d;
- const char *src = (const char *) s;
- while (n--)
- *dst++ = *src++;
- return (char *) d;
-}
-
-void
-my_bcopy (const void *s, void *d, size_t n)
-{
- char *dst = (char *) d;
- const char *src = (const char *) s;
- if (src >= dst)
- while (n--)
- *dst++ = *src++;
- else
- {
- dst += n;
- src += n;
- while (n--)
- *--dst = *--src;
- }
-}
-
-void *
-my_memset (void *d, int c, size_t n)
-{
- char *dst = (char *) d;
- while (n--)
- *dst++ = c;
- return (char *) d;
-}
-
-void
-my_bzero (void *d, size_t n)
-{
- char *dst = (char *) d;
- while (n--)
- *dst++ = '\0';
-}
-
-void *
-memcpy (void *d, const void *s, size_t n)
-{
- TEST_ABORT;
- return my_memcpy (d, s, n);
-}
-
-void
-bcopy (const void *s, void *d, size_t n)
-{
- TEST_ABORT;
- my_bcopy (s, d, n);
-}
-
-void *
-memset (void *d, int c, size_t n)
-{
- TEST_ABORT;
- return my_memset (d, c, n);
-}
-
-void
-bzero (void *d, size_t n)
-{
- TEST_ABORT;
- my_bzero (d, n);
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c b/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c
deleted file mode 100644
index e793778053a..00000000000
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/string-asm-2.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation.
-
- Test memcpy and memset in presence of redirect. */
-
-#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
-#define ASMNAME2(prefix, cname) STRING (prefix) cname
-#define STRING(x) #x
-
-typedef __SIZE_TYPE__ size_t;
-extern void abort (void);
-extern void *memcpy (void *, const void *, size_t)
- __asm (ASMNAME ("my_memcpy"));
-extern void bcopy (const void *, void *, size_t)
- __asm (ASMNAME ("my_bcopy"));
-extern void *memset (void *, int, size_t)
- __asm (ASMNAME ("my_memset"));
-extern void bzero (void *, size_t)
- __asm (ASMNAME ("my_bzero"));
-extern int memcmp (const void *, const void *, size_t);
-
-struct A { char c[32]; } a = { "foobar" };
-char x[64] = "foobar", y[64];
-int i = 39, j = 6, k = 4;
-
-void
-main_test (void)
-{
- struct A b = a;
- struct A c = { { 'x' } };
-
- if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31))
- abort ();
- if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64))
- abort ();
- if (memcpy (y + 6, x, j) != y + 6
- || memcmp (x, y, 6) || memcmp (x, y + 6, 58))
- abort ();
- if (__builtin_memset (y + 2, 'X', k) != y + 2
- || memcmp (y, "foXXXXfoobar", 13))
- abort ();
- bcopy (y + 1, y + 2, 6);
- if (memcmp (y, "fooXXXXfobar", 13))
- abort ();
- __builtin_bzero (y + 4, 2);
- if (memcmp (y, "fooX\0\0Xfobar", 13))
- abort ();
-}