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/compile/950612-1.c | 134 +++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/950612-1.c (limited to 'gcc/testsuite/gcc.c-torture/compile/950612-1.c') diff --git a/gcc/testsuite/gcc.c-torture/compile/950612-1.c b/gcc/testsuite/gcc.c-torture/compile/950612-1.c new file mode 100644 index 000000000..cb3cb0a59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/950612-1.c @@ -0,0 +1,134 @@ +typedef enum +{ + LODI, + STO, + ADDI, + ADD, + SUBI, + SUB, + MULI, + MUL, + DIVI, + DIV, + INC, + DEC +} INSN; + +f (pc) + short *pc; +{ + long long stack[16], *sp = &stack[16], acc = 0; + + for (;;) + { + switch ((INSN)*pc++) + { + case LODI: + *--sp = acc; + acc = ((long long)*pc++) << 32; + break; + case STO: + return (acc >> 32) + (((((unsigned long long) acc) & 0xffffffff) & (1 << 31)) != 0); + break; + case ADDI: + acc += ((long long)*pc++) << 32; + break; + case ADD: + acc = *sp++ + acc; + break; + case SUBI: + acc -= ((long long)*pc++) << 32; + break; + case SUB: + acc = *sp++ - acc; + break; + case MULI: + acc *= *pc++; + break; + case MUL: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + acc = ((((((unsigned long long) acc) & 0xffffffff) * (((unsigned long long) aux) & 0xffffffff)) >> 32) + + ((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) & 0xffffffff) + (((unsigned long long) acc) & 0xffffffff) + (((unsigned long long) aux) >> 32)) + + (((((unsigned long long) acc) >> 32) * (((unsigned long long) aux) >> 32)) << 32)); + if (minus) + acc = -acc; + } + break; + case DIVI: + { + short aux; + + aux = *pc++; + acc = (acc + aux / 2) / aux; + } + break; + case DIV: + { + long long aux; + unsigned char minus; + + minus = 0; + aux = *sp++; + if (aux < 0) + { + minus = ~minus; + aux = -aux; + } + if (acc < 0) + { + minus = ~minus; + acc = -acc; + } + + if (((unsigned long long)acc) == 0) + acc = (unsigned long long)-1 / 2; + else if ((((unsigned long long) ((unsigned long long)acc)) & 0xffffffff) == 0) + acc = ((unsigned long long)aux) / (((unsigned long long) ((unsigned long long)acc)) >> 32); + else if ((((unsigned long long) ((unsigned long long)acc)) >> 32) == 0) + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + ((((unsigned long long)aux) % ((unsigned long long)acc)) << 32) / ((unsigned long long)acc); + else + { + unsigned char shift; + unsigned long hi; + + shift = 32; + hi = (((unsigned long long) ((unsigned long long)acc)) >> 32); + do { + if (hi & ((unsigned long)1 << (shift - 1))) + break; + } while (--shift != 0); + printf("shift = %d\n", shift); + acc = ((((unsigned long long)aux) / ((unsigned long long)acc)) << 32) + + (((((unsigned long long)aux) % ((unsigned long long)acc)) << (32 - shift)) + ((((unsigned long long)acc) >> shift) / 2)) / (((unsigned long long)acc) >> shift); + } + + if (minus) + acc = -acc; + } + break; + case INC: + acc += 1; + break; + case DEC: + acc -= 1; + break; + } + printf("%08lx.%08lx\n", (long)(((unsigned long long) acc) >> 32) , (long)(((unsigned long long) acc) & 0xffffffff)); + } +} -- cgit v1.2.3