summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.c-torture/unsorted/bcopy.c
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/unsorted/bcopy.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/unsorted/bcopy.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c b/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c
new file mode 100644
index 000000000..aed994e57
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c
@@ -0,0 +1,68 @@
+void
+bcopy1 (s, d, c)
+ long long *s;
+ long long *d;
+ int c;
+{
+ int i;
+ c = c / 8;
+ for (i = 0; i < c; i++)
+ d[i] = s[i];
+}
+
+void
+bcopy2 (s, d, c)
+ long *s;
+ long *d;
+ int c;
+{
+ int i;
+ c = c / 4;
+ for (i = 0; i < c; i++)
+ d[i] = s[i];
+}
+
+
+void
+bcopy3 (s, d, c)
+ char *s;
+ char *d;
+ int c;
+{
+ long long z0, z1;
+ int r = d - s;
+
+ int i;
+
+ c /= 16;
+
+ z0 = *((long long *) s);
+ s += 8;
+ z1 = *((long long *) s);
+ s += 8;
+ for (i = 0; i < c; i++)
+ {
+ *(long long *)(s + r) = z0;
+ z0 = *((long long *) s);
+ s += 8;
+ *(long long *)(s + r) = z1;
+ z1 = *((long long *) s);
+ s += 8;
+ }
+}
+
+#if defined(STACK_SIZE) && STACK_SIZE < 16384
+#define BYTES STACK_SIZE
+#else
+#define BYTES 16384
+#endif
+
+main ()
+{
+ long long s[BYTES / 8];
+ long long d[BYTES / 8];
+ int i;
+
+ for (i = 1; i < 67108864 / BYTES; i++)
+ bcopy (s, d, BYTES);
+}