From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c (limited to 'gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c') diff --git a/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c b/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c new file mode 100644 index 000000000..40d2fa8d0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/unsorted/udivmod4.c @@ -0,0 +1,56 @@ +long long +xlrandom () +{ + long long x; + unsigned a; + int bits = 64; + unsigned b; + + do + { + a = random (); + b = (a & 15) + 1; + x <<= b; /* shift up 1-16 steps */ + a = (a >> 18) & 1; + if (a) + x |= (unsigned) (1 << b) - 1; + bits -= b; + } + while (bits >= 0); + return x; +} + + +unsigned long long __udivmoddi4(); + +main () +{ + int i; + unsigned long long n, d, q, r, rr; + + for (i = 0; ;i++) + { + n = xlrandom (); + d = xlrandom (); + if (d == 0) + continue; + + q = __udivmoddi4 (n, d, &r); + + if (i % 1000000 == 0) + printf ("Testing udivmoddi4: %d iterations made\n", i); + + rr = n - q * d; + if (rr != r || r >= d) + { + printf ("Testing udivmoddi4: failure after %d iterations\n", i); + printf ("n=%lX%08lX\n", (unsigned) (n >> 32), (unsigned) n); + printf ("d=%lX%08lX\n", (unsigned) (d >> 32), (unsigned) d); + printf ("q=%lX%08lX\n", (unsigned) (q >> 32), (unsigned) q); + printf ("r=%lX%08lX\n", (unsigned) (r >> 32), (unsigned) r); + printf ("rr=%lX%08lX\n", (unsigned) (rr >> 32), (unsigned) rr); + abort (); + } + } + +} -- cgit v1.2.3