diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/torture/pr19683-1.c | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.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.dg/torture/pr19683-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr19683-1.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr19683-1.c b/gcc/testsuite/gcc.dg/torture/pr19683-1.c new file mode 100644 index 000000000..05bf17418 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr19683-1.c @@ -0,0 +1,42 @@ +/* From PR rtl-optimization/19683. On little-endian MIPS targets, + reload would incorrectly inherit the high part of the multiplication + result. */ +/* { dg-do run { target mips*-*-* } } */ + +extern void abort (void); +extern void exit (int); + +#define REPEAT10(X, Y) \ + X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \ + X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9) + +#define REPEAT30(X) REPEAT10 (X, 0); REPEAT10 (X, 1); REPEAT10 (X, 2) +#define IN(X) unsigned int x##X = ptr[0] +#define OUT(X) ptr[0] = x##X + +union u { unsigned long long ll; unsigned int i[2]; }; + +unsigned int __attribute__ ((nomips16)) +foo (volatile unsigned int *ptr) +{ + union u u; + int result; + + u.ll = (unsigned long long) ptr[0] * ptr[0]; + REPEAT30 (IN); + REPEAT30 (OUT); + asm ("#" : "=l" (result) : "l" (u.i[1])); + return result; +} + +int __attribute__ ((nomips16)) +main (void) +{ + unsigned int array[] = { 1000 * 1000 * 1000 }; + union u u; + + u.ll = (unsigned long long) array[0] * array[0]; + if (foo (array) != u.i[1]) + abort (); + exit (0); +} |