summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c18
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr81555.c24
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr81556.c23
4 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c
index 00005298d10..25d4a40a67e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c
@@ -37,6 +37,24 @@ my_bcopy (const void *s, void *d, size_t n)
}
}
+__attribute__ ((used))
+void
+my_memmove (void *d, const void *s, 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;
+ }
+}
+
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
actually refers to this function. See PR47181. */
__attribute__ ((used))
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c
index ed2b06cf06f..44e336cce7c 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c
@@ -12,6 +12,8 @@ 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 *memmove (void *, const void *, size_t)
+ __asm (ASMNAME ("my_memmove"));
extern void *memset (void *, int, size_t)
__asm (ASMNAME ("my_memset"));
extern void bzero (void *, size_t)
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81555.c b/gcc/testsuite/gcc.c-torture/execute/pr81555.c
new file mode 100644
index 00000000000..d546368a39b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr81555.c
@@ -0,0 +1,24 @@
+/* PR tree-optimization/81555 */
+
+unsigned int a = 1, d = 0xfaeU, e = 0xe376U;
+_Bool b = 0, f = 1;
+unsigned char g = 1;
+
+void
+foo (void)
+{
+ _Bool c = a != b;
+ if (c)
+ f = 0;
+ if (e & c & (unsigned char)d & c)
+ g = 0;
+}
+
+int
+main ()
+{
+ foo ();
+ if (f || g != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81556.c b/gcc/testsuite/gcc.c-torture/execute/pr81556.c
new file mode 100644
index 00000000000..cfbc75f861a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr81556.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/81556 */
+
+unsigned long long int b = 0xb82ff73c5c020599ULL;
+unsigned long long int c = 0xd4e8188733a29d8eULL;
+unsigned long long int d = 2, f = 1, g = 0, h = 0;
+unsigned long long int e = 0xf27771784749f32bULL;
+
+__attribute__((noinline, noclone)) void
+foo (void)
+{
+ _Bool a = d > 1;
+ g = f % ((d > 1) << 9);
+ h = a & (e & (a & b & c));
+}
+
+int
+main ()
+{
+ foo ();
+ if (g != 1 || h != 0)
+ __builtin_abort ();
+ return 0;
+}