From: Matthias Braun Date: Sat, 1 Nov 2008 18:18:19 +0000 (+0000) Subject: move tests around X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f18339cb5df059f9b7cb4b67f43e16fcb8a48a8a;p=libfirm move tests around [r23360] --- diff --git a/ir/be/test/Args.c b/ir/be/test/Args.c deleted file mode 100644 index ad1e63995..000000000 --- a/ir/be/test/Args.c +++ /dev/null @@ -1,28 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Args.c - -#include - -static int id_0(int i, int j) { - //int k; - //k = 0; - return(i); -} - -int id_1(int i, int j) { - //int k; - //k = 0; - return(j); -} - -int main (int argc, char *argv[]) { - //int k, i; - printf("Args.c\n"); - printf("Result: %d (should be 2)\n", id_0(0,2) + id_1(0,2)); - - return 0; -} diff --git a/ir/be/test/Arrays.c b/ir/be/test/Arrays.c deleted file mode 100644 index 0e931a8b7..000000000 --- a/ir/be/test/Arrays.c +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include - -struct Arr2Object { - int a[10]; - int inrom[10]; - int b[10]; -} arr_init = { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 }, - { 1000, 1001 , 1002, 1003, 1004 , 1005, 1006, 1007, 1008, 1009} -}; - -struct ArrObject { - int num; -}; - -void ctorArrObject(struct ArrObject *pThis, int i) { - pThis->num = i; -} - -void f(struct ArrObject *pThis) { - printf("num is %d\n", pThis->num); -} - -static void pass_array_test(struct ArrObject *a, int a_len) -{ - int i; - - for(i = 0; i < a_len; i++) { - f(&a[i]); - } -} - -#define length(a) (sizeof(a)/sizeof((a)[0])) - -int main(int argc, char *argv[]) { - int i, j, bi; - struct ArrObject ao[10]; - struct Arr2Object a2o[2]; - struct Arr2Object a2; - - for(i = 0; i < length(ao); i++) - ctorArrObject(&ao[i], i); - - for(i = 0; i < 10; i++) { - f(&ao[i]); - } - - pass_array_test(ao, length(ao)); - - for(i = 0; i < length(a2o); i++) - memcpy(&a2o[i], &arr_init, sizeof(arr_init)); - - for(i = 0; i < length(a2o[0].a); i++) { - memcpy(&a2, &a2o[0], sizeof(a2)); - j = a2.a[i]; - printf("%d\n", j); - } - - a2o[0].a[5] = 4711; - - printf("length(a2o[0].a) = %d\n", length(a2o[0].a)); - for(i = 0; i < length(a2o[0].a); i++) { - printf("%d\n", a2o[0].a[i]); - } - - printf("length(a2o[1].a) = %d\n", length(a2o[1].a)); - for(i = 0; i < length(a2o[1].a); i++) { - printf("%d\n", a2o[1].a[i]); - } - - printf("length(a2o[0].b) = %d\n", length(a2o[0].b)); - for(i = 0; i < length(a2o[0].b); i++) { - memcpy(&a2, &a2o[0], sizeof(a2)); - bi = a2.b[i]; - printf("%d\n", bi); - } - - printf("inrom 0 .. 9:\n"); - for(i = 0; i < 10; i++) { - printf("%d\n", arr_init.inrom[i]); - } - return 0; -} diff --git a/ir/be/test/BinaryOpTest.c b/ir/be/test/BinaryOpTest.c deleted file mode 100644 index f5d0985ee..000000000 --- a/ir/be/test/BinaryOpTest.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * File name: test/BinaryOpTest.c - * Purpose: test binary operators - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: X.Y.2003 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - */ - -#include - -typedef int boolean; -#define true 1 -#define false 0 - -static int id(int i) { - return(i); -} - -static boolean bid(boolean i) { - return(i); -} - -static void nop(int i) { - printf(" %d\n", i); -} - -static void test_and_and(int i, int j) { - if((i + 5 == 1) && (j + 4 == 3)) - nop(1); - else - nop(2); -} - -static void test_or_or(int i, int j) { - if((i + 5 == 1) || (i + 4 == 3)) - nop(1); - else - nop(2); -} - -int main(int argc, char *argv[]) { - int i, j; - int res; - boolean b; - - printf("BinaryOpTest.c\n"); - - b = bid(true); - if(!b) - i = id(1); - else - i = id(3); - j = id(2); - - nop(i << j); - nop(i >> j); - nop(i & j); - nop(i | j); - nop(i ^ j); - nop(~i); - - nop(i % j); - nop(i / j); - - test_and_and(i,j); - test_or_or(i,j); - - return 0; -} diff --git a/ir/be/test/BreakTest.c b/ir/be/test/BreakTest.c deleted file mode 100644 index fc95a8db6..000000000 --- a/ir/be/test/BreakTest.c +++ /dev/null @@ -1,65 +0,0 @@ -#include - - -static void test_for_break(int *array, int size, int end) { - int i; - - printf("for:"); - for(i = 0 ; i < size; i++) { - if(end == i) - break; - printf("%d", array[i]); - } -} - -static void test_while_break(int *array, int size, int end) { - int i; - - i = 0; - printf("while:"); - while(i < size) { - if(end == i) - break; - printf("%d", array[i]); - ++i; - } -} - -static void test_do_break(int *array, int size, int end) { - int i; - - i = 0; - printf("do:"); - do { - if(end == i) - break; - printf("%d", array[i]); - ++i; - } while(i < size); -} - -int main(int argc, char *argv[]) { - int i, j; - int array[20]; - - i = 0; - while(i < 20) { - array[i] = i; - i++; - } - - printf("must print for:0123456789\n"); - printf("must print while:01234567891011\n"); - printf("must print do:012345678910\n\n"); - - test_for_break(array, 20, 10); - printf("\n"); - - test_while_break(array, 20, 12); - printf("\n"); - - test_do_break(array, 20, 11); - printf("\n"); - - return 0; -} diff --git a/ir/be/test/Bucmp.c b/ir/be/test/Bucmp.c deleted file mode 100644 index 74337b275..000000000 --- a/ir/be/test/Bucmp.c +++ /dev/null @@ -1,11 +0,0 @@ -char glob = -1; - -int main(void) { - char x = 126; - while (x > 0) { - x++; - printf("%d\n", x); - if (x == -125) break; - } - return 0; -} diff --git a/ir/be/test/ByteTest.c b/ir/be/test/ByteTest.c deleted file mode 100644 index 3d21173dc..000000000 --- a/ir/be/test/ByteTest.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int atoi(const char *s); - -int main(int argc, char *argv[]) -{ - unsigned char a, b, c; - - printf("ByteTest.c\n"); - - a = atoi("200"); - b = atoi("56"); - - c = a+b; - printf(" 200 + 56 = %d (expected 0)\n", c); - - return 0; -} diff --git a/ir/be/test/CallingTest.c b/ir/be/test/CallingTest.c deleted file mode 100644 index af51422d2..000000000 --- a/ir/be/test/CallingTest.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -int int_func(void) -{ - return 42; -} - -float float_func(void) -{ - return 13.5f; -} - -double double_func(void) -{ - return 13.5; -} - -int main(int argc, char *argv[]) -{ - printf("calltest.c\n"); - - printf(" Calling int function: %d\n", int_func()); - printf(" Calling float function: %f\n", float_func()); - printf(" Calling double function: %f\n", double_func()); - - return 0; -} diff --git a/ir/be/test/CondExpr.c b/ir/be/test/CondExpr.c deleted file mode 100644 index 5a24133cc..000000000 --- a/ir/be/test/CondExpr.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * File name: test/CondExpr.c - * Purpose: test conditional expressions - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: XX.02.2003 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - */ - -#include - -static int id(int i) { - return(i); -} - -static void nop(int i) { - printf(" i = %d\n", i); -} - -int main (int argc, char *argv[]) { - int i, j, res; - - printf("CondExpr.c:\n"); - i = id(1); - j = id(2); - - i = (i == j)? id(10) : id(0); - nop(i); - - return 0; -} diff --git a/ir/be/test/ContinueTest.c b/ir/be/test/ContinueTest.c deleted file mode 100644 index c77f19448..000000000 --- a/ir/be/test/ContinueTest.c +++ /dev/null @@ -1,62 +0,0 @@ -#include - -#define SIZE 100 - -static void test_do_continue(int *a, int size) { - int i = -1; - - printf(" test_do_continue:\n"); - do { - ++i; - if(10 == i) - continue; // dont print - printf("%d\n", a[i]); - } - while(i < size); -} - -static void test_for_continue(int *a, int size) { - int i; - - printf(" test_for_continue:\n"); - for(i = 0; i <= size; i++) { - if(11 == i) - continue; - printf("%d\n", a[i]); - } -} - -static void test_while_continue(int *a, int size) { - int i; - - i = -1; - - printf(" test_while_continue:\n"); - while(i < size) { - i++; - if(12 == i) - continue; - printf("%d\n", a[i]); - } -} - -int main(int argc, char *argv[]) { - int i, j; - int array[SIZE]; - - printf("ContinueTest.c:\n"); - i = 0; - while(i < SIZE) { - array[i] = i; - i++; - } - - test_do_continue(array, 20); - printf("\n"); - test_for_continue(array, 20); - printf("\n"); - test_while_continue(array, 20); - printf("\n"); - - return 0; -} diff --git a/ir/be/test/DeclTest.c b/ir/be/test/DeclTest.c deleted file mode 100644 index f40e1f076..000000000 --- a/ir/be/test/DeclTest.c +++ /dev/null @@ -1,20 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Declatations - - -#include - - -int i, j, x; - -int main (int argc, char *argv[]) { - int k, l; - int i; - - printf("DeclTest.c\n"); - return 0; -} diff --git a/ir/be/test/DivBug.c b/ir/be/test/DivBug.c deleted file mode 100644 index 72290804d..000000000 --- a/ir/be/test/DivBug.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int x[(1024 / sizeof (int))]; - -int main(int argc, char *argv[]) { - int y[(1024 / sizeof (int))]; - - memset(y, 20, sizeof(y)); - memset(x, 22, (1024 / sizeof (int))); - - printf("DivBug. ok!\n"); - printf("Result: %d (should be 336860180)", y[(1024 / sizeof (int))-1]+x[(1024 / sizeof (int))-1]); - - return 0; -} diff --git a/ir/be/test/Do.c b/ir/be/test/Do.c deleted file mode 100644 index 9a6135f93..000000000 --- a/ir/be/test/Do.c +++ /dev/null @@ -1,96 +0,0 @@ - -/* $Id$ */ -/* Program builds a simple tree and walks the tree. - Tree nodes are separated: one part contains the tree information, - the other contains the data of the node. */ - -#include -#include - -#define NULL ((void *)0) - -typedef struct Node Node; - -typedef struct Data { - const char *name; - const char *addr; - int account1; - int account2; - int account3; - Node *found; -} Data; - -struct Node { - Data mydata; - int mykey; - Node *son1; - Node *son2; - Node *son3; - Node *son4; -}; - -static int Node_count; - -static Node *new_node(int depth) { - Node *res; - - res = (void *)malloc(sizeof(*res)); - res->mykey = Node_count++; /* @@@ Want Random number */ - - if (depth > 1) { - res->son1 = new_node(depth-1); - res->son2 = new_node(depth-1); - res->son3 = new_node(depth-1); - res->son4 = new_node(depth-1); - } else { - res->son1 = NULL; - res->son2 = NULL; - res->son3 = NULL; - res->son4 = NULL; - } - return res; -} - -static int find_max(Node *n) { - if (n->son1 == NULL) { - return n->mykey; - } else { - int max = find_max(n->son1); - int max2 = find_max(n->son2); - if (max2 > max) max = max2; - /*max2 = find_max(n->son3); - if (max2 > max) max = max2; - max2 = find_max(n->son4); - if (max2 > max) max = max2;*/ - return max; - } -} - - - -static Node *root; /* root of the tree to search */ - -static void alloc (int depth) { - root = new_node(depth); -} -static void search (void) { - printf(" Max = %d\n", find_max(root)); -} - -int main(int argc, char *argv[]) { - int depth; - - printf("Do.c:\n"); - if (argc <= 1) { - printf("Usage: Do n\nGive search tree depth!\n"); - printf("10 is a good value, 12 too much.\n"); - printf("Continuing with default value 9.\n"); - depth = 9; - } else { - depth = atoi(argv[1]); - } - alloc(depth); - search(); - - return 0; -} diff --git a/ir/be/test/Doit.c b/ir/be/test/Doit.c deleted file mode 100644 index fdbc860ae..000000000 --- a/ir/be/test/Doit.c +++ /dev/null @@ -1,25 +0,0 @@ -// -// $Id$ -// - -#include - -int f; - -int poops(int i) { - f++; - return(i); -} - -int main (int argc, char *argv[]) { - int i; - - printf("Doit.c\n"); - - i = 0; - do { - // i = i + 1; - } while(i++ < 10); - - return 0; -} diff --git a/ir/be/test/Empty.c b/ir/be/test/Empty.c deleted file mode 100644 index 3b82b7093..000000000 --- a/ir/be/test/Empty.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Empty.c - * Purpose: smallest possible C program - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: XX.08.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ - - -int main () { - return 0; -} diff --git a/ir/be/test/EmptyFor.c b/ir/be/test/EmptyFor.c deleted file mode 100644 index 0edfc9b26..000000000 --- a/ir/be/test/EmptyFor.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - - -void endless(void) -{ - for (;;) { - } -} - -int main(int argc, char *argv[]) -{ - printf("EmptyFor.c:\n"); - - return 0; -} diff --git a/ir/be/test/Field.c b/ir/be/test/Field.c deleted file mode 100644 index 7c2e66743..000000000 --- a/ir/be/test/Field.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * $Id$ - */ - -#include - -struct s { - int a; -}; - -int m(struct s *pThis) { - return(pThis->a); -} - -int main(void) { - - printf("Field.c\n"); - - return 0; -} diff --git a/ir/be/test/Float.c b/ir/be/test/Float.c deleted file mode 100644 index ab6e2b1b7..000000000 --- a/ir/be/test/Float.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Project: GCC-fim - * File name: test/Empty.c - * Purpose: float test - * Author: Boris Boesler - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.08.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ - -#include -#include - -static void compute (double d1) { - double d2, d3; - d2 = 123456789.0; - d3 = d1 + d2; - printf(" expecting 123456789012345678.0: %19.1f\n", d3); -} - -#define _p(x) #x -#define p(x) _p(x) - -int main (int argc, char *argv[]) { - float fminplus = +FLT_MIN; - float fminminus = -FLT_MIN; - float fmaxplus = FLT_MAX; - float fmaxminus = -FLT_MAX; - double dminplus = +DBL_MIN; - double dminminus = -DBL_MIN; - double dmaxplus = +DBL_MAX; - double dmaxminus = -DBL_MAX; - - printf("\nExtreme representable float values:\n"); - printf(" +" p(FLT_MIN) " = %+1.8E\n", fminplus); - printf(" -" p(FLT_MIN) " = %+1.8E\n", fminminus); - printf(" +" p(FLT_MAX) " = %+1.8E\n", fmaxplus); - printf(" -" p(FLT_MAX) " = %+1.8E\n", fmaxminus); - - printf("\nExtreme representable double values:\n"); - printf(" +" p(DBL_MIN) " = %+1.17E\n", dminplus); - printf(" -" p(DBL_MIN) " = %+1.17E\n", dminminus); - printf(" +" p(DBL_MAX) " = %+1.17E\n", dmaxplus); - printf(" -" p(DBL_MAX) " = %+1.17E\n", dmaxminus); - - compute(1234567890000000000.0); - - return 0; -} diff --git a/ir/be/test/ForTest.c b/ir/be/test/ForTest.c deleted file mode 100644 index 945ab9faf..000000000 --- a/ir/be/test/ForTest.c +++ /dev/null @@ -1,39 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : For loop - -#include - -typedef int boolean; - -#define true 1 -#define false 0 - -static int simpleloop (int a, int b) { - int i, j; - boolean loopfinal = true; - - for(i = 0; (i < 10) && loopfinal; i++) { - if(5 == i) - loopfinal = false; - printf("%d ", i); - } - printf("\n"); - - for(i = 0; i < a; ++i) { - for(j = 0; j < b; ++j) { - printf("%d,%d\n", i, j); - } - } - return(i); -} - -int main (int argc, char *argv[]) { - printf("ForTest.c\n"); - - simpleloop(3, 10); - return 0; -} diff --git a/ir/be/test/GlobalCseTest.c b/ir/be/test/GlobalCseTest.c deleted file mode 100644 index a8d621302..000000000 --- a/ir/be/test/GlobalCseTest.c +++ /dev/null @@ -1,27 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : GlobalCseTest.c -#include - -int m(int a) { - int b; - if ( a == 1) { - /* Global cse should move the Subtraction before or after this if. */ - if( a == 0) b = a - 2; else b = a - 2; - } else { - b = 4; - } - return b; - -} - -int main (int argc, char *argv[]) { - printf("GlobalCseTest.c\n"); - - m(4); - - return 0; -} diff --git a/ir/be/test/Hanoi.c b/ir/be/test/Hanoi.c deleted file mode 100644 index ad50d5052..000000000 --- a/ir/be/test/Hanoi.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Hanoi.c - * Purpose: Towers of hanoi - * Author: Arne Frick (in Sather-k) - * Modified by: Michael Beck (for C) - * Created: XX.11.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ - -#include -#include - -typedef int boolean; - -#define true 1 -#define false 0 - -static int stick[3]; -static int moves; -static boolean verbose = false; - -void init(int n) { - //-- initializes an array of pegs - stick[0] = n; - stick[1] = 0; - stick[2] = 0; - moves = 0; -} - -void hanoi(int n, int from, int to) { - int spare = 3 - from - to; - if(n > 0) { - //-- moves the stack of pegs from stick[from] via stick[temp] - //-- to stick[to] - - hanoi (n-1, from, spare); - ++moves; - stick[from] = stick[from] - 1; - stick[to] = stick[to] + 1; - if (verbose) { - printf("move %d to %d\n", from, to); - } - hanoi (n-1, spare, to); - } -} - -//--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -int main(int argc, char *argv[]) { - int i = 1; - boolean n_specified = false; - - int n; - - /* - if args.asize > i and args[i].equals ("-v") { - verbose = true; - i = i + 1; - } - */ - printf("Hanoi.c\n"); - - if (argc <= 1) { - /* - if i /= args.asize - 1 { - << " wrong # of arguments\n\n" - "Usage: hanoi [-v] n\n" - " where n is the number of pegs\n" - " -v enables verbose printing of moves\n"; - */ - printf("Usage: hanoi n\nWhere n is the number of pegs.\nContinuing with default: n = 21 (-> 2097151)\n"); - n = 21; - } - else { - n = atoi(argv[1]); - } - - init (n); - hanoi (n, 0, 2); - //<< "Total #moves: " << p.moves << "\n"; - // hanoi(28) = 268435455 - printf(" number of moves : %d\n", moves); - - return 0; -} diff --git a/ir/be/test/HeapSort.c b/ir/be/test/HeapSort.c deleted file mode 100644 index 5d8204074..000000000 --- a/ir/be/test/HeapSort.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/HeapSort.java - * Purpose: sorting with heapsort - * Author: - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.11.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - * URL: http://www-info1.informatik.uni-wuerzburg.de/staff/wolf/teaching/pi1_ws98/java/Heapsort.java - * Bugs: Fails for input 5,3,4,7,99 - */ - -#include -#include - -/** - * Heapsort-Algorithmus laut Vorlesung. - */ -/** Größe des Heaps */ -static int N; - -/** - * Tauscht die Elemente a[i] und a[j]. - */ -static void exchange(int *a, int i, int j) { - int v; - v = a[i]; - a[i] = a[j]; - a[j] = v; -} - -/** - * Läßt a[k] im Feld aufsteigen. - */ -static void upheap(int *a, int k) { - while ((k > 0) && (a[k] < a[k / 2])) { - exchange(a, k, k / 2); - k = k / 2; - } -} - -/** - * Fügt das neue Element v in den Heap der Größe N - * ein und erhöht N um 1 - */ -static void insert(int *a, int v) { - a[N] = v; - upheap(a, N); - N++; -} - -/** -* Läßt a[k] im Feld versickern. -*/ -static void downheap(int *a, int k) { - int j = 2 * k; - if (j < N) { // a[k] hat linken Sohn a[j] - if (j + 1 < N) // a[k] hat auch rechten Sohn a[j+1] - if (a[j] > a[j + 1]) - j++; // Jetzt ist a[j] der kleinere Sohn von a[k] - if (a[k] > a[j]) { - exchange(a, k, j); - downheap(a, j); - } - } -} - -/** - * Liefert als Resultat das Heap-Element a[k], entfernt a[k] - * aus dem Heap und stellt die Heap-Eigenschaft wieder her. - */ -static int removeh(int *a, int k) { - int v = a[k]; - a[k] = a[--N]; - if ((k > 0) && (a[k] < a[k / 2])) - upheap(a, k); - else - downheap(a, k); - - return v; -} - -/** - * Aufbau des Heaps durch downheap. - */ -static void heapaufbau1(int *a) { - int k; - - for (k = N / 2; k >= 1; k--) - downheap(a, k); -} - -/** - * Aufbau des Heaps durch insert. - */ -static void heapaufbau2(int *a, int *b, int len) { - int k; - N = 0; - for (k = 0; k < len; ++k) - insert(a, b[k]); -} - -/** - * Sortiert das gegebene Feld b mit den oben angegebenen - * Heap-Methoden und gibt das sortierte Feld zurück. - */ -static int *heapsort_(int *b, int len) { - int k; - int *c; - int *a; - - // Globale Variablen für die Heap-Methoden setzen - a = malloc(sizeof(a[0]) * len); - heapaufbau2(a, b, len); - - // Ergebnis in c kopieren - c = malloc(sizeof(c[0]) * len); - for (k = 0; k < len; k++) - c[k] = removeh(a, 0); - - return c; -} - -static int verify(int* fld, int count) { - int i; - int last = fld[0]; - for(i = 1; i < count; ++i) { - if(fld[i] < last) - return 0; - last = fld[i]; - } - - return 1; -} - -/** - * Ein einfaches Beispielprogramm. Alle Argumente des Programms müssen - * Zahlen sein. - * Bsp:
- * java Heapsort 6 13 17 42 9 3 5
- * array={6,13,17,42,9,3,5}
- * sorted array={3,5,6,9,13,17,42}
- * 
- */ -int main (int argc, char *argv[]) { - // Umwandeln der Argumente in Zahlen - int *b; - int i, count, seed; - - printf("Heap.c\n"); - - if(argc > 1) - count = atoi(argv[1]); - else - count = 10000; - - if(argc > 2) - seed = atoi(argv[2]); - else - seed = 123456; - - srand(seed); - - b = (void*) malloc(sizeof(b[0]) * count); - for(i = 0; i < count; ++i) - b[i] = rand(); - - printf("Sorting %d random numbers (seed %d)\n", - count, seed); - - // Sortieren - b = heapsort_(b, count); - - printf("Sorted.\n"); - - if(verify(b, count)) - printf("Verify succeeded.\n"); - else - printf("Verify failed.\n"); - - return 0; -} diff --git a/ir/be/test/HelloWorld.c b/ir/be/test/HelloWorld.c deleted file mode 100644 index d65dbb7d7..000000000 --- a/ir/be/test/HelloWorld.c +++ /dev/null @@ -1,15 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Hello World - -#include - - -int main (int argc, char *argv[]) { - printf("HelloWorld.c\n"); - printf(" Hello World!\n"); - return 0; -} diff --git a/ir/be/test/IfExpr.c b/ir/be/test/IfExpr.c deleted file mode 100644 index ba4a7587c..000000000 --- a/ir/be/test/IfExpr.c +++ /dev/null @@ -1,43 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Declatations - part ][ - -#include - -static int test (int arg0) { - int a, b, c; - a = arg0; - c = 2; - b = 69; - if((a) == c) { - c = b - 1; - } - else { - c = a + 77; - } - return(c); -} - -static int const_if(int arg0) { - int a; - if(2 < 3) { - a = 5; - } - else { - a = 7; - } - return(a); -} - -int main(int argc, char *argv[]) { - printf("IfExpr.c\n"); - - printf(" test(2) = %d (should be 68)\n", test(2)); - printf(" test(3) = %d (should be 80)\n", test(3)); - printf(" const_if(0) = %d (should be 5)\n", const_if(0)); - - return 0; -} diff --git a/ir/be/test/Int.c b/ir/be/test/Int.c deleted file mode 100644 index f0692bb8b..000000000 --- a/ir/be/test/Int.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Int.c - * Purpose: smallest possible Java program - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: XX.08.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ - -#include - -static int hide_int (int i) { /* to cancel out optimization */ - return i; -} - -int main (int argc, char *argv[]) { - int imax = 2147483647; /* java.lang.Integer.MAX_VALUE */ - int imin1 = -2147483647; /* java.lang.Integer.MIN_VALUE+1 */ - int imin = -2147483648; /* java.lang.Integer.MIN_VALUE */ - int i; - - printf("Int.c\n"); - - printf(" Extreme constant integer values allowed in C:\n"); - printf(" Integer.MAX_VALUE ( 2147483647) = %d\n", imax); - printf(" Integer.MIN_VALUE-1 (-2147483647) = %d\n", imin1); - printf(" Integer.MIN_VALUE (-2147483648) = %d\n", imin); - - printf("\n Computations with integers:\n"); - i = 2147483647 - hide_int(147483647); /* to cancel out optimization */ - printf(" i = 2147483647 - 147483647 (2000000000): %d\n", i); - i = i / 5; - printf(" i = i / 5 (400000000): %d\n", i); - i = i * -2; - printf(" i = i * -2 (-800000000): %d\n", i); - i = i + 12344321; - printf(" i = i + 12344321 (-787655679): %d\n", i); - i = i % 100000000; - printf(" i = i %% 100000000 (-87655679): %d\n", i); - - printf("\n Computations exceeding the maximal values:\n"); - i = imax + 1; - printf(" i = imax + 1 () : %d\n", i); - i = imax * 2; - printf(" i = imax * 2 () : %d\n", i); - i = imax - 1; - printf(" i = imin - 1 () : %d\n", i); - i = imin * 2; - printf(" i = imin * 2 () : %d\n", i); - - return 0; -} diff --git a/ir/be/test/Label.c b/ir/be/test/Label.c deleted file mode 100644 index 0df9692c2..000000000 --- a/ir/be/test/Label.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -static void for_test(void) -{ - int i; - - for (i = 0; i < 10; ++i) { - goto end; - printf(" %d\n", i); - } -end: - printf(" Leaving with i = %d\n", i); - return; -} - -int main(int argc, char *argv[]) -{ - printf("Label.c\n"); - - goto weg; - printf(" GOTO Failed\n"); - return 0; -weg: - printf(" GOTO Successful\n"); - - for_test(); - - return 0; -} diff --git a/ir/be/test/Local.c b/ir/be/test/Local.c deleted file mode 100644 index 50767a498..000000000 --- a/ir/be/test/Local.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Local.c - - /* -public long id_0(long i, int j, long k, long l) { - return(i + 1); -} - */ -int id_1(int i, int j) { - int k; - int g; - k = i + 1; - g = j - 1; - return((k * g) / 2); -} - -int main (int argc, char *argv[]) { - printf("Local.c\n"); - printf(" id_1(3,5) = %d\n", id_1(3,5)); - return 0; -} diff --git a/ir/be/test/LongLong.c b/ir/be/test/LongLong.c deleted file mode 100644 index 51872457a..000000000 --- a/ir/be/test/LongLong.c +++ /dev/null @@ -1,59 +0,0 @@ -/*$ -std=c99 $*/ -/* - * Project: GCC-firm - * File name: test/Long.c - * Purpose: Long integer test program - * Author: Goetz Lindenmaier - * Modified by: Michael Beck - * Created: XX.04.2002 - * CVS-ID: $Id$ - * Copyright: (c) 2002 Universitaet Karlsruhe - * Licence: - */ - -#include - -static int hide_int (int i) { - return i; -} - -int main (int argc, char *argv[]) { - long long lmax, lmin, lmin1, limax, limin1, limin, l1, l; - int i; - - printf("LongLong.c\n"); - - lmax = 9223372036854775807LL; /* java.lang.Long.MAX_VALUE */ - lmin1 = -9223372036854775807LL; /* java.lang.Long.MIN_VALUE */ - lmin = -9223372036854775808LL; /* java.lang.Long.MIN_VALUE */ - limax = 2147483647L; /* java.lang.Integer.MAX_VALUE */ - limin1 = -2147483647L; /* java.lang.Integer.MAX_VALUE-1 */ - limin = -2147483648L; /* java.lang.Integer.MIN_VALUE */ - - printf(" Long long values allowed in C:\n"); - /* So far, these values are not representable by libfirm. */ - printf(" LongLong.MAX_VALUE ( 9223372036854775807LL) = %lld\n", lmax); - printf(" LongLong.MIN_VALUE-1 (-9223372036854775807LL) = %lld\n", lmin1); - printf(" LongLong.MIN_VALUE (-9223372036854775808LL) = %lld\n", lmin); - - printf("\n Extreme integer values represented as long long:\n"); - printf(" Long.MAX_VALUE ( 2147483647L) = %lld\n", limax); - printf(" Long.MIN_VALUE-1 (-2147483647L) = %lld\n", limin1); - printf(" Long.MIN_VALUE (-2147483648L) = %lld\n", limin); - - printf("\n Computations exceeding these barriers:\n"); - i = 2147483647; - //i = 2; - l = hide_int(i) + 3LL; - printf(" long long l = (int i = 2147483647) + 3LL (2147483650): %lld\n", l); - l = 2 * l; - printf(" long long l = 2 * l (4294967300): %lld\n", l); - l = l * -1; - printf(" long long l = l * -1 (-4294967300): %lld\n", l); - l = l / 3; - printf(" long long l = l / 3 (-1431655766): %lld\n", l); - l = l % 1000000000; - printf(" long long l = l %% 1000000000 (-431655766): %lld\n", l); - - return 0; -} diff --git a/ir/be/test/LuIs.c b/ir/be/test/LuIs.c deleted file mode 100644 index 60a5dc80a..000000000 --- a/ir/be/test/LuIs.c +++ /dev/null @@ -1,9 +0,0 @@ -/* testing conversion */ -int test(unsigned long long x) { - return x; -} - -int main() { - printf("%d\n", test(0x1234567812345678LL)); - return 0; -} diff --git a/ir/be/test/MergeSort.c b/ir/be/test/MergeSort.c deleted file mode 100644 index 13593eb32..000000000 --- a/ir/be/test/MergeSort.c +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include - -void merge (float *, int, int, int); - -/* sort the (sub)array v from start to end */ - -void merge_sort (float *v, int start, int end) { - int middle; /* the middle of the subarray */ - - /* no elements to sort */ - if (start == end) return; - - /* one element; already sorted! */ - if (start == end - 1) return; - - /* find the middle of the array, splitting it into two subarrays */ - middle = (start + end) / 2; - - /* sort the subarray from start..middle */ - merge_sort (v, start, middle); - - /* sort the subarray from middle..end */ - merge_sort (v, middle, end); - - /* merge the two sorted halves */ - merge (v, start, middle, end); -} - -/* merge the subarray v[start..middle] with v[middle..end], placing the - * result back into v. - */ -void merge (float *v, int start, int middle, int end) { - int v1_n, v2_n, v1_index, v2_index, i; - - float *v1 = malloc((middle - start) * sizeof(*v1)); - float *v2 = malloc((end - middle) * sizeof(*v2)); - - /* number of elements in first subarray */ - v1_n = middle - start; - - /* number of elements in second subarray */ - v2_n = end - middle; - - /* fill v1 and v2 with the elements of the first and second - * subarrays, respectively - */ - for (i=0; i\n"); - printf("Continuing with default input.\n"); - f = (void *)malloc(sizeof(*f) * (len = 6)); - f[0] = 3.3; f[1] = 18.18; f[2] = 5.5; f[3] = 99.99; f[4] = 104.104; f[5] = 2.2; - } - - // Ausgabe - printf(" array = "); - for(i = 0; i < len - 1; i++) { - printf(" %f,", f[i]); - } - if (len > 0) { - printf(" %f\n", f[len - 1]); - } - // Sortieren - merge_sort(f, 0, len); - - // Ausgabe - printf(" sorted array = "); - for(i = 0; i < len - 1; i++) { - printf(" %f,", f[i]); - } - if (len > 0) { - printf(" %f\n", f[len - 1]); - } - - return 0; -} diff --git a/ir/be/test/Or.c b/ir/be/test/Or.c deleted file mode 100644 index 47a46c30f..000000000 --- a/ir/be/test/Or.c +++ /dev/null @@ -1,12 +0,0 @@ - -#include - - -int main (void) -{ - - int i=0, j=0; - i=(j<0 || i<0 || j<1); - return 0; - -} /* main() */ diff --git a/ir/be/test/Pdg.c b/ir/be/test/Pdg.c deleted file mode 100644 index 55de027c7..000000000 --- a/ir/be/test/Pdg.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - -- - -- beispiel fuer register allokation ueber program dependence graph - -- -*/ - -#include - -int main(int argc, char *argv[]) { - int i, j, k; - - printf("Pdg.c\n"); - - i = 1; - k = 0; - while (i < 10) { - j = i + 1; - if (j == 7) - k = 0; - else - k = 1; - i = i + 1; - } - - (void) k; - return 0; -} diff --git a/ir/be/test/Queens.c b/ir/be/test/Queens.c deleted file mode 100644 index f7eadadd3..000000000 --- a/ir/be/test/Queens.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Queens.c - * Purpose: solve the queens problem - * Author: Markus Armbruster (in sather-k) - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.11.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ -/* - -- The notorious n-queens problem (C.F. Gauss, 1850) - -- Copyright (C) 1996 Markus Armbruster -*/ - -#include -#include - - -typedef int boolean; - -#define true 1 -#define false 0 - -static int *row; -// queen in column c is at row[c] - -static int myabs(int i) { - if(0 > i) - i = -i; - return(i); -} - -static boolean place_ok (int i) { - // return whether queen in column i is - // not in check from queens left of it - int j = 0; - boolean res; - - while (j < i) { - if ((row[j] == row[i]) || ((myabs(row[i]-row[j])) == (i-j))) { - res = false; - return(res); - } - j = j+1; - } - res = true; - return(res); -} - -static int solve (int n) { - // return the number of solutions to the n-queens problem - int c = 0; - int res = 0; - - row = (void *)malloc(sizeof(*row) * n); - row[0] = -1; - while (c >= 0) { - row[c] = row[c]+1; - while ((row[c] < n) && (!place_ok(c))) { - row[c] = row[c]+1; - } - if (row[c] < n) { // successfully placed at (c,row[c]) - if (c == n-1) - res = res+1; - else { - c = c+1; - row[c] = -1; - } - } - else // dead end, track back - c = c-1; - } - free(row); - - return(res); -} - -static void usage (const char *progname) { - printf("usage: %s [n]\n", progname); -} - - -int main (int argc, char *argv[]) { - int n; - - switch (argc) { - case 1: - n = 8; - break; - case 2: - n = atoi(argv[1]); - break; - default: - usage("queens"); - return 0; - } - printf("The %d-queens problem has %d solutions.\n", n, solve(n)); - - return 0; -} diff --git a/ir/be/test/QuickSort.c b/ir/be/test/QuickSort.c deleted file mode 100644 index 2bcedfca9..000000000 --- a/ir/be/test/QuickSort.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Quicksort.c - * Purpose: sorting with quicksort - * Author: - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.11.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - * URL: http://www-info1.informatik.uni-wuerzburg.de/staff/wolf/teaching/pi1_ws98/java/QuickSort.java - */ -#include -#include - -//#define COUNTACTIONS - -#ifdef COUNTACTIONS -// Variablen, in denen die Bewegungen und Vergleiche gespeichert werden -static int bewegungen = 0; -static int vergleiche = 0; -#endif - - -//-------------------- -// quicksort-Funktion -//-------------------- -static void quicksort(int *fld, int l, int r ) { - // Wenn der zu sortierende Teil eine Laenge <= 1 hat -> fertig - if( l >= r ) - return; - - int pivot = fld[r]; - int i = l-1, j = r; - int v; - - // mit dem Pivotelement sortieren - while( 1 ) { - while( fld[++i] < pivot ) { -#ifdef COUNTACTIONS - vergleiche++; -#endif - } -#ifdef COUNTACTIONS - vergleiche++; -#endif - - while( j > l && fld[--j] > pivot ) { -#ifdef COUNTACTIONS - vergleiche++; -#endif - } - -#ifdef COUNTACTIONS - vergleiche++; -#endif - // Wenn j <= i ist, wurde der zu sortierende Teil des Feldes - // durchlaufen -> fertig - if( j <= i ) - break; - - // Elemente tauschen - v = fld[i]; - fld[i] = fld[j]; - fld[j] = v; - // ein Tausch zweier Feldelemente wird als eine Bewegung gerechnet -#ifdef COUNTACTIONS - bewegungen++; -#endif - } - - // Pivotelement in die Mitte tauschen - fld[r] = fld[i]; - fld[i] = pivot; - -#ifdef COUNTACTIONS - bewegungen++; -#endif - - // Die zwei Teilfolgen rekursiv mit quicksort sortieren - quicksort( fld, l, i-1 ); - quicksort( fld, i+1, r ); -} - -static int verify(int* fld, int count) { - int i; - int last = fld[0]; - for(i = 1; i < count; ++i) { - if(fld[i] < last) - return 0; - last = fld[i]; - } - - return 1; -} - -//------------------------------ -// Hauptfunktion des Programmes -//------------------------------ -int main(int argc, char *argv[]) { - int i, *fld; - int count, seed; - - printf("QuickSort.c\n"); - - if(argc > 1) - count = atoi(argv[1]); - else - count = 10000; - - if(argc > 2) - seed = atoi(argv[2]); - else - seed = 123456; - - srand(seed); - - fld = (void*) malloc(sizeof(*fld) * count); - for(i = 0; i < count; ++i) - fld[i] = rand(); - - printf("Sorting %d random numbers (seed %d)\n", - count, seed); - // Sortieren - quicksort(fld, 0, count-1); - - // Ausgabe -#ifdef COUNTACTIONS - printf("Sorted. (needed %d comparisons and %d moves.\n", vergleiche, bewegungen); -#else - printf("Sorted.\n"); -#endif - - if(verify(fld, count)) - printf("Verify succeeded.\n"); - else - printf("Verify failed.\n"); - - return 0; -} diff --git a/ir/be/test/RegallocBug.c b/ir/be/test/RegallocBug.c deleted file mode 100644 index a531fdcaa..000000000 --- a/ir/be/test/RegallocBug.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include - -struct Arr2Object { - int a[10]; - int inrom[10]; - int b[10]; -} arr_init = { - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 }, - { 1000, 1001 , 1002, 1003, 1004 , 1005, 1006, 1007, 1008, 1009} -}; - -struct ArrObject { - int num; -}; - -void ctorArrObject(struct ArrObject *pThis, int i) { - pThis->num = i; -} - -void f(struct ArrObject *pThis) { - printf("num is %d\n", pThis->num); -} - -static void pass_array_test(struct ArrObject *a, int a_len) -{ - int i; - - for(i = 0; i < a_len; i++) { - f(&a[i]); - } -} - -#define length(a) (sizeof(a)/sizeof((a)[0])) - -int main(int argc, char *argv[]) { - int i, j, bi; - struct ArrObject ao[10]; - struct Arr2Object a2o[2]; - struct Arr2Object a2; - - (void) argc; - (void) argv; - for(i = 0; i < length(ao); i++) - ctorArrObject(&ao[i], i); - - for(i = 0; i < 10; i++) { - f(&ao[i]); - } - - pass_array_test(ao, length(ao)); - - for(i = 0; i < length(a2o); i++) - memcpy(&a2o[i], &arr_init, sizeof(arr_init)); - - for(i = 0; i < length(a2o[0].a); i++) { - memcpy(&a2, &a2o[0], sizeof(a2)); - j = a2.a[i]; - printf("%d\n", j); - } - - a2o[0].a[5] = 4711; - - for(i = 0; i < length(a2o[0].a); i++) { - printf("%d\n", a2o[0].a[i]); - } - for(i = 0; i < length(a2o[1].a); i++) { - printf("%d\n", a2o[1].a[i]); - } - - for(i = 0; i < length(a2o[0].b); i++) { - memcpy(&a2, &a2o[0], sizeof(a2)); - bi = a2.b[i]; - printf("%d\n", bi); - } - - for(i = 0; i < 10; i++) { - printf("%d\n", arr_init.inrom[i]); - } - return 0; -} diff --git a/ir/be/test/Return.c b/ir/be/test/Return.c deleted file mode 100644 index 833226968..000000000 --- a/ir/be/test/Return.c +++ /dev/null @@ -1,13 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Return - -#include - -int main (int argc, char *argv[]) { - printf("Return.c\n"); - return(0); -} diff --git a/ir/be/test/Sieve.c b/ir/be/test/Sieve.c deleted file mode 100644 index 08f24011e..000000000 --- a/ir/be/test/Sieve.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Sieve.c - * Purpose: Eratosthenes Sieve prime number benchmark in Java - * Author: Boris Boesler - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.08.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ - -#include -#include - -typedef char boolean; - -#define true 1 -#define false 0 - -static int SIZE = 500; //8190; -/* Gl: 8190 takes too long for continuous testing. */ - -static void mark_count(int c) { - printf("number of primes in [2..%d) : %d (correct: 2..500: 95)\n", SIZE, c); -} - -static void runSieve(void) { - int ITERATIONS = 100000; - boolean *flags; - int i, prime, k; - int iterations = 0; - int count; - int s = SIZE; - - flags = (void *)malloc(sizeof(*flags) * s); - - // loop around for measurements - while(ITERATIONS > iterations) { -#if 0 - for(i = 0; i < SIZE; i++) - flags[i] = true; -#endif - memset(flags, 0x01010101, s); - for(i = 2; i < s; i++) { - if(flags[i]) { - prime = i; - for(k = i + prime; k < s; k += prime) - flags[k] = false; - } - } - iterations++; - } - // test correctness - count = 0; - for(i = 2; i < s; i++) { - if(true == flags[i]) { - count++; - } - } - mark_count(count); -} - -int main(int argc, char *argv[]) { - printf("Sieve.c\n"); - - if (argc <= 1) { - printf("\nUsage: Sieve n\n"); - printf("Continuing with default input.\n"); - } else { - SIZE = atoi(argv[1]); - } - - runSieve(); - - return 0; -} diff --git a/ir/be/test/SieveBits.c b/ir/be/test/SieveBits.c deleted file mode 100644 index fda052a81..000000000 --- a/ir/be/test/SieveBits.c +++ /dev/null @@ -1,102 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// - -#include -#include -#include - -typedef int boolean; - -typedef struct BitSet -{ - int *P; - int K; -} BitSet; - -static void ctorBitSet(BitSet *pThis, int k) -{ - pThis->P = (void *)malloc(sizeof(*(pThis->P)) * (k / 32 + 1)); - pThis->K = k; -} - -static void set (BitSet *pThis, int i) -{ - if (i < 0) - return; - pThis->P[i >> 5] |= (1 << (i & 0x0000001F)); -} -static void clear (BitSet *pThis, int i) -{ - pThis->P[i >> 5] &= ~(1 << (i & 0x0000001F)); -} - -static boolean get (BitSet *pThis, int i) -{ - return (pThis->P[i >> 5] & (1 << (i & 0x0000001F))) != 0; -} - -static int size (BitSet *pThis) -{ - return pThis->K; -} - - -/* Sieve.c -Das Primzahlsieb fuer C. -*/ - -static BitSet prime; -// Enthaelt Flags fuer die ungeraden Zahlen: -// 3,5,7,... -// D.h., 2*i+3 ist prim, wenn prime[i] war ist - -static void sieve (void) { -// das Sieb - int k = size(&prime), i, j, p, l; - // Zuerst alle Zahlen auf prim setzen - for (i = 0; i < k; i++) - set(&prime, i); - // Dann Vielfache von Primzahlen aussieben - for (i = 0; i < k; i++) { - if (get(&prime, i)) { - // 2*i+3 ist prim - p = 2 * i + 3; - l = (p * p - 3) / 2; - if (l > k) - break; - for (j = l; j < k; j += p) - clear(&prime, j); // streicht p*p,p*(p+2), etc. - } - } -} - -int main (int argc, char *argv[]) { - // Hauptprogramm - int n, i, k, count; - - if (argc <= 1) - n = 10000000; - // falls keine Argumente in der Kommandozeile - else - n = atoi(argv[1]); - // lies Anzahl aus der Kommandozeile - k = (n - 3) / 2; - printf("Counting primes up to %d.\n", (2 * k + 3)); - - ctorBitSet(&prime, k); - sieve(); // das Sieb - - // Zaehle gefundene Primzahlen: - count = 1; - for (i = 0; i < k; i++) - if (get(&prime, i)) - count++; - // Ausgabe: - printf("%d primes found.\n", count); - - // list(); // nur fuer Testzwecke - return 0; -} diff --git a/ir/be/test/SimpleExpr.c b/ir/be/test/SimpleExpr.c deleted file mode 100644 index 59c1c3484..000000000 --- a/ir/be/test/SimpleExpr.c +++ /dev/null @@ -1,15 +0,0 @@ -// -// GCC-firm Project -// -// $Id$ -// -// Testprogram to test GCC-firm : Declatations - - -int main (int argc, char *argv[]) { - int i = 0; - i = 1; - i = 2; - - return 0; -} diff --git a/ir/be/test/Strings.c b/ir/be/test/Strings.c deleted file mode 100644 index ea90e12aa..000000000 --- a/ir/be/test/Strings.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Strings.c - * Purpose: test some String stuff - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: 03.03.2003 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - */ - -#include -#include - -static void print_char(char c) { - printf(" %c\n", c); -} - -static void print_int(int i) { - printf(" %d\n", i); -} - -static void print_String(const char *s) { - printf(" %s\n", s); -} - -int main(int argc, char *argv[]) { - int i; - char *s = "test"; - - printf("Strings.c\n"); - for(i = 1; i < argc; i++) { - print_String(argv[i]); - } - print_String(s); - print_char('\101'); - print_char('\x41'); - print_int(atoi("0")); - print_int(atoi("1")); - print_int(atoi("-4711")); - print_int(atoi("0815")); - print_int(atoi("+1001")); - print_int(atoi("42")); - print_int(atoi("000")); - - return 0; -} diff --git a/ir/be/test/Swap.c b/ir/be/test/Swap.c deleted file mode 100644 index 4867a7328..000000000 --- a/ir/be/test/Swap.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * File name: test/Swap.c - * Purpose: test swap of to variables in a loop - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: XX.02.2003 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - */ - -#include - -static void nop2(int i, int j) { - printf("i = %d\n", i); - printf("j = %d\n", j); -} - -int main (int argc, char *argv[]) { - int i, j, t, k; - - i = 1; j = 10; k = 3; - - while(0 < k) { - nop2(i, j); - - t = i; - i = j; - j = t; - - //nop2(i, j); - --k; - } - - return 0; -} diff --git a/ir/be/test/Switcher.c b/ir/be/test/Switcher.c deleted file mode 100644 index cdecf7dc5..000000000 --- a/ir/be/test/Switcher.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * File name: test/Switcher.c - * Purpose: test the switch statement - * Author: Boris Boesler - * Modified by: Michael Beck - * Created: XX.02.2003 - * CVS-ID: $Id$ - * Copyright: (c) 2003 Universitaet Karlsruhe - * Licence: - */ - -#include - -static void print_int(int i) { - printf(" %d\n", i); -} - -// standard switch with 1 case -static void switch1(int i) { - switch(i) { - case 0: - print_int(0); - break; - default: - print_int(-1); - //break; - } -} - -// standard switch with more than 1 case -static void switch2(int i) { - switch(i) { - case 0: - print_int(0); - break; - case 2: - print_int(2); - break; - default: - print_int(-1); - break; - } -} - -// standard switch with fall through -static void switch3(int i) { - switch(i) { - case 0: - print_int(0); - // fall through - case 3: - print_int(3); - break; - default: - print_int(-1); - break; - } -} - -// standard switch without default -static void switch4(int i) { - switch(i) { - case 0: - print_int(0); - break; - case 4: - print_int(4); - break; - } -} - -// standard switch without case -static void switch5(int i) { - switch(i) { - default: - print_int(-1); - break; - } -} - -// standard switch with more than 1 case and controlflow change -static void switch6(int i) { - switch(i) { - case 0: - print_int(0); - break; - case 2: - if(i < 6) - print_int(2); - else - print_int(-2); - break; - default: - print_int(-1); - break; - } -} - -// standard switch with more than 1 case label -static void switch7(int i) { - switch(i) { - case 0: - print_int(0); - break; - case 2: - case 3: - print_int(5); - break; - default: - print_int(-1); - break; - } -} - - -static void double_switch(int i) { - - switch(i) { - case 16: - printf(" is 16\n"); - switch(i % 4) { - case 0: - printf(" multiple of 4\n"); - break; - default: - printf(" not multiple of 4\n"); - break; - } - break; - - default: - printf(" != 10 und != 16\n"); - break; - } - -} - -int main (int argc, char *argv[]) { - printf("Switcher.c\n"); - printf(" must print:\n 0\n 2\n 0\n 3\n -1\n 2\n 5\n is 16\n multiple of 4\n\n"); - switch1(0); - switch2(2); - switch3(0); - switch4(5); - switch5(0); - switch6(2); - switch7(3); - - double_switch(16); - return 0; -} diff --git a/ir/be/test/Test.c b/ir/be/test/Test.c deleted file mode 100644 index 8c013749e..000000000 --- a/ir/be/test/Test.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -void processOutputs() { - switch(1) { - case 0: - if( 1 ) { - printf("1\n"); - } - else { - printf("0\n"); - } - } -} - -int main(int argc, char *argv[]) { - printf("Test.c\n"); - - processOutputs(); - - printf(" Ok\n"); - - return 0; -} diff --git a/ir/be/test/Thilo.c b/ir/be/test/Thilo.c deleted file mode 100644 index af8ca3b13..000000000 --- a/ir/be/test/Thilo.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include - - -static int id(int i) { - return(i); -} - -int main(int argc, char*argv[]) { - int i, s; - int count; - int size; - - printf("Thilo.c\n"); - - s = 0; - if(argc > 1) - size = atoi(argv[1]); - else - size = 1000; - for(count = 0; count < 10000; count++) { - s = 0; - for(i = 1; i <= size; i++) { - s += id(i); - } - } - printf(" %d\n", s); - - return 0; -} diff --git a/ir/be/test/While.c b/ir/be/test/While.c deleted file mode 100644 index 6d1cfc6b2..000000000 --- a/ir/be/test/While.c +++ /dev/null @@ -1,40 +0,0 @@ -// -// $Id$ -// -// Testprogram to test gcc-firm : While loop - -#include - -static int test (int i) { - int j; - j = 0; - while(i > 0) { - i = i - 1; - if(i == 3) - break; - } - printf(" 3 == %d\n", i); - return(j); -} - -static int gcd (int a, int b) { - int i = 0; - - while((a != b) && (i >= 0)){ - if(a > b) { - a = a - b; - } - else { - b = b - a; - } - ++i; - } - return(a); -} - -int main (int argc, char *argv[]) { - printf("While.c\n"); - printf(" 5 == %d\n", gcd(20, 15)); - test(10); - return 0; -} diff --git a/ir/be/test/XXEndless.c b/ir/be/test/XXEndless.c deleted file mode 100644 index 57eb50cf7..000000000 --- a/ir/be/test/XXEndless.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include - - -#define true 1 - -static int loop = 2; -static int quiet = 1; - -static void nop(void) {} - -static int me1(int num) { - int i = 0; - - if (num == 1) { - printf("Going into endless loop 1 \n .... \n "); - while(7 > 2) { - if(!quiet) - printf("%d\n", i++); - } - } else { - num ++; - } - return num; -} - -static void me2(int num) { - int i = 0; - - if (num != 2) { - nop(); - } else { - printf("Going into endless loop 2 \n .... \n "); - while(true) { - if(!quiet) - printf("%d\n", i++); - } - } -} - -static void me3(int num) { - int i = 0; - - printf("Going into endless loop 3 \n .... \n "); - while(true) { - if(!quiet) - printf("%d\n", i++); - } -} - -int main(int argc, char *argv[]) { - printf("XXEndless.c\n"); - if (argc != 2) { - printf("\nUsage: Endless n, where n determines the loop.\n"); - printf("Continuing with default input.\n"); - return 0; - } else { - loop = atoi(argv[1]); - quiet = 0; - } - me1(loop); - me2(loop); - me3(loop); -} diff --git a/ir/be/test/ack/README b/ir/be/test/ack/README deleted file mode 100644 index a33484e4f..000000000 --- a/ir/be/test/ack/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains some testapps found in the ack compiler: - http://www.cs.vu.nl/ack/ diff --git a/ir/be/test/ack/ack_conv.c b/ir/be/test/ack/ack_conv.c deleted file mode 100644 index e571b8826..000000000 --- a/ir/be/test/ack/ack_conv.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -/* Author: E.G. Keizer */ - -char rcs_id[] = "$Id$" ; - -main() { - t1() ; - t2() ; - return 0 ; -} - -t1() { - char c ; int i ; long l ; unsigned u ; -#ifndef NOFLOAT - float f ; -#endif - - /* test conversions */ - - /* first some conversions on constants */ - - printf("(int) '\\377' = %d\n",(int) '\377') ; - printf("(long) -1 = %ld\n",(long) -1 ) ; -#ifndef NOFLOAT - printf("(float) 12 = %f\n",(float) 12 ) ; - printf("(int) 3.14 = %d\n",(int) 3.14 ) ; -#endif - printf("(int) 32767L = %d\n",(int) 32767L ) ; - printf("(int) -32768L = %d\n",(int) -32768L ) ; - printf("(char) 128L = %d\n",(char) 128L) ; - printf("(char) 0377 = %d\n",(char) 0377 ) ; - printf("(char) -1 = %d\n",(char) -1 ) ; - printf("(char) 10000 = %d\n",(char) 10000 ) ; - - /* conversions from characters */ - printf("From character\n") ; - c = 127 ; - i=c ; - l=c ; - u=c ; -#ifndef NOFLOAT - f=c ; -#endif - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ; -#ifndef NOFLOAT - printf("\t\t\t\t\tfloat %f\n",f) ; -#endif - c = -1 ; - i=c ; - l=c ; - u=c ; -#ifndef NOFLOAT - f=c ; -#endif - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ; -#ifndef NOFLOAT - printf("\t\t\t\t\tfloat %f\n",f) ; -#endif - c = 0377 ; - i=c ; - l=c ; - u=c ; -#ifndef NOFLOAT - f=c ; -#endif - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ; -#ifndef NOFLOAT - printf("\t\t\t\t\tfloat %f\n",f) ; -#endif - - /* from integer */ - printf("From integer\n") ; - i= -64 ; - c=i ; - l=i ; - u=i ; -#ifndef NOFLOAT - f=i ; -#endif - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ; -#ifndef NOFLOAT - printf("\t\t\t\t\tfloat %f\n",f) ; -#endif - /* from long */ - printf("From long\n") ; - l = -3 ; - c = l ; - i = l ; - u = l ; -#ifndef NOFLOAT - f = l ; -#endif - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ; -#ifndef NOFLOAT - printf("\t\t\t\t\tfloat %f\n",f) ; -#endif - - printf("Casts from long\n"); - l = 75000; - printf("\tchar %5d, int %d, unsigned short %6o, long %11ld\n", - (char) l,(int) l,(unsigned short)l ,l) ; - -#ifndef NOFLOAT - printf("From float\n") ; - f = 121.5 ; - c = f ; - i = f ; - u = f ; - l = f ; - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ; - f = 1e-4 ; - c = f ; - i = f ; - u = f ; - l = f ; - printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ; - f = 3276.6e1 ; - i = f ; - u = f ; - l = f ; - printf("\tint %6d, unsigned %6o, long %11ld, float %f\n",i,u,l,f) ; - f = 1223432e3 ; - l = f ; - printf("\tlong %11ld, float %f\n",l,f) ; -#endif - - /* some special cases */ - { - int a[4] ; - - l = 3 ; a[3]= -17 ; - printf("a[l] (l==%ld) %d\n",l,a[l]) ; - printf("a[3l] %d\n",a[3l] ) ; - - } - return 0 ; -} - -t2() -{ - long l1 = 0x1f010L; - long l2; - - l2 = (unsigned short) l1; - printf("(unsigned short) 0x1f010L = 0x%lx\n", l2); - l2 = (short) l1; - printf("(short) 0x1f010L = 0x%lx\n", l2); -} diff --git a/ir/be/test/ack/decl.c b/ir/be/test/ack/decl.c deleted file mode 100644 index 7c1f9bd77..000000000 --- a/ir/be/test/ack/decl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -/* Author: E.G. Keizer */ - -char rcs_id[] = "$Id$" ; - -/* Test a few declaration features */ -/* Such as: - forward function declarations, - redeclarations, - pointer to function declarations. -*/ - -static int sqr() ; /* forward declarations */ -extern int sqrt(); - -main() { - fdcl() ; - hidden() ; - return 0 ; -} - -fdcl() { - int (*a[2])() ; - - printf("sqr(4) %d\n",sqr(4)) ; - - a[0]=sqr ; a[1]=sqrt ; - printf("(*a[0])(16) %d\n",(*a[0])(16) ) ; - printf("(*a[1])( (*a[0])(3) ) %d\n", (*a[1])( (*a[0])(3) ) ) ; -} - -static int sqr(par) int par ; { - return par*par ; -} - -int sqrt(par) int par ; { - int x1,x2 ; - int i ; - - if ( par<0 ) return -1 ; - x1 = par ; - i=0 ; - do { - x2 = x1 ; - x1 = ( x2*x2 + par ) / (2*x2) ; - if ( i++>=100 ) return -2 ; - } while ( ( x2 0 ) ; - return (x1+x2)/2 ; -} - -int a = -8 ; - -hidden() { - hide() ; - printf("a outside hide %d\n",a) ; -} - -int hide() { - int a ; - - a = 4 ; - printf("a in hide %d\n",a) ; - { - int a ; - - a = 16 ; - printf("a in in hide %d\n",a) ; - - } - printf("a in hide %d\n",a) ; -} diff --git a/ir/be/test/ack/init.c b/ir/be/test/ack/init.c deleted file mode 100644 index d14e037d6..000000000 --- a/ir/be/test/ack/init.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -/* Author: E.G. Keizer */ - -char rcs_id[] = "$Id$" ; - -/* Test initialisation of a V7 C-compiler */ -/* 1 sept 1980 */ -#include "local.h" - -/* Integers and constant expressions */ - -int in1 = 4 ; -int in2 = MAXINT ; -int in3 = MININT ; -int in4 ; -int inzero ; - -int ice1 = (1-2+3*4/2)%3 ; -int ice2 = ((((1&3)|4)^014) >> 1) <<1 ; -int ice3 = ( (1==2) & (3<4) ) | (4>3) | (0<=0) | -2>=17 ; -int ice4 = (~-1) ; -int ice5 = (1==1 ? 3+4 : 5+6 ) ; -int ice6 = (1!=1 ? 7+8 : 9+10 ) ; -int ina[] = { 1, 3, 5 } ; - -pint() { - static int sint = -1 ; - int lint = in1+in3+sint ; - - printf("Integers:\n\n") ; - printf("in1\t%d\nin2\t%d\nin3\t%d\nin4\t%d\ninzero\t%d\n\n", - in1,in2,in3,in4,inzero ) ; - printf("ice1\t%d\nice2\t%d\nice3\t%d\nice4\t%d\nice5\t%d\nice6\t%d\n\n", - ice1,ice2,ice3,ice4,ice5,ice6 ) ; - printf("ina\t%d,%d,%d\n\n",ina[0],ina[1],ina[2]) ; - printf("sint\t%d\nlint\t%d\n\n",sint,lint) ; -} - -/* Characters */ - -char ch1 = 'a' ; -char ch2 ; -char cha1[] = "Mesg" ; -char cha2[] = "" ; -char cha3[] = "1" ; -char cha4[] = "12" ; -char cha5[] = "0123456789112345678921234567893123456789412345678951234567896123456789712345678981234567899123456789" ; - -char cha6[2][3] = { - { 1, 2, 3 }, - { 4, 5, 6 } -}; -char *pch1 = cha2 ; -char *pch2 = "pch2" ; -char *pch3 = "ppch3" ; -char *pch4 = 0 ; - -pch() { - static char stc[] = "123" ; - static char stc1[] = "1234" ; - static char *mult[] = { "ab" , "bc" , "de" } ; - - printf("Characters:\n\n") ; - - printf("ch1\t%c(%d)\n",ch1,ch1) ; - printf("ch2\t%d\n",ch2) ; - printf("cha1\t%s\ncha2\t%s\ncha3\t%s\ncha4\t%s\n", - cha1,cha2,cha3,cha4 ) ; - printf("cha5\t%s\n\n",cha5) ; - printf("cha6\t%d, %d, %d\n\t%d, %d, %d\n", - cha6[0][0],cha6[0][1],cha6[0][2],cha6[1][0],cha6[1][1],cha6[1][2]); - printf("pch1==cha2\t%s\n",(pch1 == cha2 ? "yes" : "no" ) ) ; - printf("pch2\t%s\npch3\t%s\n",pch2,pch3+1) ; - printf("pch4==0\t%s\n\n",(pch4 != 0 ? "no" : "yes" ) ) ; - printf("stc\t%s\nstc1\t%s\n",stc,stc1) ; - printf("mult[0],mult[1],mult[2] %s, %s, %s\n",mult[0],mult[1],mult[2]); -} - -#ifndef NOFLOAT -/* floats */ - -float fl1 = 0 ; -float fl2 = 2 ; -float fl3 = 2e-10 ; -float fl4 = 4.0 ; -float fl5 = EPSFLOAT ; -float fl6 = MAXFLOAT ; -float fl7 ; - -float fla1[4][3] = { - { 1, 3, 5 }, - { 2, 4, 6 }, - { 3, 5, 7 } -} ; -float fla2[4][3] = { - -1,-3,-5,-2,-4,-6,-3,-5,-7 -} ; -float fla3[4][3] = { - { 11 } , { 12 } , { 13 } , { 14 } -} ; - -pflt() { - register i,j ; - - printf("Floats:\n\n") ; - -printf("fl1\t%.20e\nfl2\t%.20e\nfl2\t%.20e\nfl4\t%.20e\nfl5\t%.20e\nfl6\t%.20e\nfl7\t%.20e\n", - fl1,fl2,fl2,fl4,fl5,fl6,fl7 ) ; - - printf(" fla1 fla2 fla3\n") ; - for ( i=0 ; i<4 ; i++ ) { - for ( j=0 ; j<3 ; j++ ) { - printf(" %20e %20e %20e\n", - fla1[i][j],fla2[i][j],fla3[i][j]) ; - } - } - - printf("\n") ; -} - -/* doubles */ - -double dbl1 = 0 ; -double dbl2 = 2 ; -double dbl3 = 2e-10 ; -double dbl4 = 4.0 ; -double dbl5 = EPSDOUBLE ; -double dbl6 = MAXDOUBLE ; -double dbl7 ; - -double dbla1[4][3] = { - { 1, 3, 5 }, - { 2, 4, 6 }, - { 3, 5, 7 } -} ; -double dbla2[4][3] = { - -1,-3,-5,-2,-4,-6,-3,-5,-7 -} ; -double dbla3[4][3] = { - { 11 } , { 12 } , { 13 } , { 14 } -} ; - -pdbl() { - register i,j ; - - printf("Doubles:\n\n") ; - -printf("dbl1\t%.20e\ndbl2\t%.20e\ndbl2\t%.20e\ndbl4\t%.20e\ndbl5\t%.20e\ndbl6\t%.20e\ndbl7\t%.20e\n", - dbl1,dbl2,dbl2,dbl4,dbl5,dbl6,dbl7 ) ; - - printf(" dbla1 dbla2 dbla3\n") ; - for ( i=0 ; i<4 ; i++ ) { - for ( j=0 ; j<3 ; j++ ) { - printf(" %20e %20e %20e\n", - dbla1[i][j],dbla2[i][j],dbla3[i][j]) ; - } - } - - printf("\n") ; -} -#endif - -/* long */ -long lo1 = 14L ; -long lo2 = -17 ; -long lo3 = MAXLONG ; -long lo4 = MINLONG ; -long lo5 ; -long lo6 = ( 0==1 ? -1L : 1L ) ; - -plong() { - printf("long\n\n") ; - - printf("lo1\t%ld\nlo2\t%ld\nlo3\t%ld\nlo4\t%ld\nlo5\t%ld\nlo6\t%ld\n\n", - lo1,lo2,lo3,lo4,lo5,lo6 ) ; -} - -/* structures and bit fields */ - -struct s1 { - int s_i ; - char s_ca[3] ; - long s_l ; -#ifndef NOFLOAT - double s_f ; -#endif - struct s1 *s_s1 ; -} ; -struct s1 st1 ; -struct s1 sta[3] = { -#ifndef NOFLOAT - 1 , { 'a' , 'b' , 'c' } , 10 , -10 , &sta[0] , -#else - 1 , { 'a' , 'b' , 'c' } , 10 , &sta[0] , -#endif - { 2 } , - 3 -} ; -struct s2 { - int s2_1 :1 ; - int s2_2 :2 ; - int s2_3 :4 ; - int s2_4 :7 ; - int s2_5 :2 ; - int s2_6 :11 ; - int s2_7 :6 ; -} stb = { - 1,2,3,4,3,6,7 -} ; - -pstruct() { - printf("structures\n\n") ; - - printf("\t st1 sta[0..2]\n") ; - - printf("s_i\t%15d%15d%15d%15d\n", - st1.s_i,sta[0].s_i,sta[1].s_i,sta[2].s_i) ; - printf("s_ca[0]\t%15d%15d%15d%15d\n", - st1.s_ca[0],sta[0].s_ca[0],sta[1].s_ca[0],sta[2].s_ca[0]) ; - printf("s_ca[1]\t%15d%15d%15d%15d\n", - st1.s_ca[1],sta[0].s_ca[1],sta[1].s_ca[1],sta[2].s_ca[1]) ; - printf("s_ca[2]\t%15d%15d%15d%15d\n", - st1.s_ca[2],sta[0].s_ca[2],sta[1].s_ca[2],sta[2].s_ca[2]) ; - printf("s_l\t%15ld%15ld%15ld%15ld\n", - st1.s_l,sta[0].s_l,sta[1].s_l,sta[2].s_l) ; -#ifndef NOFLOAT - printf("s_f\t %13e %13e %13e %13e\n\n", - st1.s_f,sta[0].s_f,sta[1].s_f,sta[2].s_f) ; -#endif - printf("(sta[0].s_s1)->s_i = %d\n",(sta[0].s_s1)->s_i) ; - - printf("\nbit fields:\n\n") ; - printf("sizeof stb %d\n",sizeof stb) ; - printf("stb\t%d %d %d %d %d %d %d\n\n", - stb.s2_1,stb.s2_2,stb.s2_3,stb.s2_4,stb.s2_5,stb.s2_6,stb.s2_7); -} - -main() { - pint() ; - pch() ; -#ifndef NOFLOAT - pflt() ; - pdbl() ; -#endif - plong() ; - pstruct() ; - return(0) ; -} diff --git a/ir/be/test/ack/local.h b/ir/be/test/ack/local.h deleted file mode 100644 index 00ad3697b..000000000 --- a/ir/be/test/ack/local.h +++ /dev/null @@ -1,14 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -# define MAXINT 32767 -# define MININT -32768 -# define MAXLONG 2147483647 -# define MINLONG -2147483648 -# define EPSFLOAT 2.938736e-39 -# define MAXFLOAT 1.7014117e38 -# define EPSDOUBLE 2.938736e-39 -/* for 64-bit double 1.701411834604692293e38 */ -# define MAXDOUBLE 1.7014117e38 diff --git a/ir/be/test/ack/ops.c b/ir/be/test/ack/ops.c deleted file mode 100644 index e89a41d6e..000000000 --- a/ir/be/test/ack/ops.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -/* Author: E.G. Keizer */ - -char rcs_id[] = "$Id$" ; - -main() { - - assnull() ; - ushift() ; - lshift() ; - uadd() ; - return 0 ; -} - -int a,b ; -assnull() { - int c,d ; - /* test a few cases handled especially by the cem-compiler */ - - a= -1 ; b= -1 ; c= -1 ; d = -1 ; - - a=b=0 ; - c=d=0 ; - printf("a %d, b %d, c %d, d %d\n",a,b,c,d) ; - a = b = c = d = -32 ; - printf (" (a=0) %d, (c=0) %d\n",(a=0),(c=0) ) ; - printf("a %d, b %d, c %d, d %d\n",a,b,c,d) ; - -} -ushift() { - unsigned u ; - - printf("Unsigned shifts by constants\n") ; - u = 0150715 ; - printf(" u = %6o\n",u) ; - printf(" u>>0 %6o\n", u>>0 ) ; - printf(" u>>1 %6o\n", u>>1 ) ; - printf(" u>>2 %6o\n", u>>2 ) ; - printf(" u>>3 %6o\n", u>>3 ) ; - printf(" u>>4 %6o\n", u>>4 ) ; - printf(" u>>5 %6o\n", u>>5 ) ; - printf(" u>>6 %6o\n", u>>6 ) ; - printf(" u>>7 %6o\n", u>>7 ) ; - printf(" u>>8 %6o\n", u>>8 ) ; - printf(" u>>9 %6o\n", u>>9 ) ; - printf(" u>>10 %6o\n", u>>10 ) ; - printf(" u>>11 %6o\n", u>>11 ) ; - printf(" u>>12 %6o\n", u>>12 ) ; - printf(" u>>13 %6o\n", u>>13 ) ; - printf(" u>>14 %6o\n", u>>14 ) ; - printf(" u>>15 %6o\n", u>>15 ) ; - if (sizeof(unsigned) > 2) printf(" u>>16 %6o\n", u>>16 ) ; - printf(" u<<0 %6o\n", u<<0 ) ; - printf(" u<<1 %6o\n", u<<1 ) ; - printf(" u<<2 %6o\n", u<<2 ) ; - printf(" u<<3 %6o\n", u<<3 ) ; - printf(" u<<4 %6o\n", u<<4 ) ; - printf(" u<<5 %6o\n", u<<5 ) ; - printf(" u<<6 %6o\n", u<<6 ) ; - printf(" u<<7 %6o\n", u<<7 ) ; - printf(" u<<8 %6o\n", u<<8 ) ; - printf(" u<<9 %6o\n", u<<9 ) ; - printf(" u<<10 %6o\n", u<<10 ) ; - printf(" u<<11 %6o\n", u<<11 ) ; - printf(" u<<12 %6o\n", u<<12 ) ; - printf(" u<<13 %6o\n", u<<13 ) ; - printf(" u<<14 %6o\n", u<<14 ) ; - printf(" u<<15 %6o\n", u<<15 ) ; - if (sizeof(unsigned) > 2) printf(" u<<16 %6o\n", u<<16 ) ; -} - -lshift() { - long ll ; - - printf("Long shifts by constants\n") ; - ll = 400000L - 0532 ; - printf(" ll = %11lo\n",ll) ; - printf(" ll>>0 %11lo\n", ll>>0 ) ; - printf(" ll>>1 %11lo\n", ll>>1 ) ; - printf(" ll>>2 %11lo\n", ll>>2 ) ; - printf(" ll>>3 %11lo\n", ll>>3 ) ; - printf(" ll>>4 %11lo\n", ll>>4 ) ; - printf(" ll>>5 %11lo\n", ll>>5 ) ; - printf(" ll>>6 %11lo\n", ll>>6 ) ; - printf(" ll>>7 %11lo\n", ll>>7 ) ; - printf(" ll>>8 %11lo\n", ll>>8 ) ; - printf(" ll>>9 %11lo\n", ll>>9 ) ; - printf(" ll>>10 %11lo\n", ll>>10 ) ; - printf(" ll>>11 %11lo\n", ll>>11 ) ; - printf(" ll>>12 %11lo\n", ll>>12 ) ; - printf(" ll>>13 %11lo\n", ll>>13 ) ; - printf(" ll>>14 %11lo\n", ll>>14 ) ; - printf(" ll>>15 %11lo\n", ll>>15 ) ; - printf(" ll>>16 %11lo\n", ll>>16 ) ; - printf(" ll>>17 %11lo\n", ll>>17 ) ; - printf(" ll>>18 %11lo\n", ll>>18 ) ; - printf(" ll>>19 %11lo\n", ll>>19 ) ; - printf(" ll>>20 %11lo\n", ll>>20 ) ; - printf(" ll>>21 %11lo\n", ll>>21 ) ; - printf(" ll>>22 %11lo\n", ll>>22 ) ; - printf(" ll>>23 %11lo\n", ll>>23 ) ; - printf(" ll>>24 %11lo\n", ll>>24 ) ; - printf(" ll>>25 %11lo\n", ll>>25 ) ; - printf(" ll>>26 %11lo\n", ll>>26 ) ; - printf(" ll>>27 %11lo\n", ll>>27 ) ; - printf(" ll>>28 %11lo\n", ll>>28 ) ; - printf(" ll>>29 %11lo\n", ll>>29 ) ; - printf(" ll>>30 %11lo\n", ll>>30 ) ; - printf(" ll>>31 %11lo\n", ll>>31 ) ; - ll = 1 ; - printf(" ll<<0 %11lo\n", ll<<0 ) ; - printf(" ll<<1 %11lo\n", ll<<1 ) ; - printf(" ll<<2 %11lo\n", ll<<2 ) ; - printf(" ll<<3 %11lo\n", ll<<3 ) ; - printf(" ll<<4 %11lo\n", ll<<4 ) ; - printf(" ll<<5 %11lo\n", ll<<5 ) ; - printf(" ll<<6 %11lo\n", ll<<6 ) ; - printf(" ll<<7 %11lo\n", ll<<7 ) ; - printf(" ll<<8 %11lo\n", ll<<8 ) ; - printf(" ll<<9 %11lo\n", ll<<9 ) ; - printf(" ll<<10 %11lo\n", ll<<10 ) ; - printf(" ll<<11 %11lo\n", ll<<11 ) ; - printf(" ll<<12 %11lo\n", ll<<12 ) ; - printf(" ll<<13 %11lo\n", ll<<13 ) ; - printf(" ll<<14 %11lo\n", ll<<14 ) ; - printf(" ll<<15 %11lo\n", ll<<15 ) ; - printf(" ll<<16 %11lo\n", ll<<16 ) ; - printf(" ll<<17 %11lo\n", ll<<17 ) ; - printf(" ll<<18 %11lo\n", ll<<18 ) ; - printf(" ll<<19 %11lo\n", ll<<19 ) ; - printf(" ll<<20 %11lo\n", ll<<20 ) ; - printf(" ll<<21 %11lo\n", ll<<21 ) ; - printf(" ll<<22 %11lo\n", ll<<22 ) ; - printf(" ll<<23 %11lo\n", ll<<23 ) ; - printf(" ll<<24 %11lo\n", ll<<24 ) ; - printf(" ll<<25 %11lo\n", ll<<25 ) ; - printf(" ll<<26 %11lo\n", ll<<26 ) ; - printf(" ll<<27 %11lo\n", ll<<27 ) ; - printf(" ll<<28 %11lo\n", ll<<28 ) ; - printf(" ll<<29 %11lo\n", ll<<29 ) ; - printf(" ll<<30 %11lo\n", ll<<30 ) ; -} -uadd() { - unsigned u ; - int i ; - - u = 32760 ; - for ( i=0 ; i<=16 ; ++i ) { - printf("%2d %6o\n",i,u+i) ; - } -} diff --git a/ir/be/test/ack/str.c b/ir/be/test/ack/str.c deleted file mode 100644 index 5cac8308c..000000000 --- a/ir/be/test/ack/str.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -/* Author: E.G. Keizer */ -static char rcs_id[]= "$Id$" ; - -/* test for structure parameters, assignment and return */ -# define ASIZE 26 - -struct w1 { - int w1_i ; -} ; -struct w2 { - int w2_i ; - long w2_l ; -} ; -struct w3 { - char w3_a[ASIZE] ; - unsigned w3_u ; -} ; - -struct w1 es1 ; -struct w1 es2[3] ; - -main() { - asst() ; - part() ; - callt() ; - return 0 ; - -} - -asst() { - /* test structure assignment */ - struct w1 st1, st2, *st3 ; - struct w2 s2t1, s2t2, *s2t3 ; - struct w3 s3t1, s3t2, *s3t3 ; - - - register int i ; - - printf("w1\n") ; - st1.w1_i = 506 ; - st2 = st1 ; - printf("\tst2.w1_i %d\n",st2.w1_i) ; - st3 = &st1 ; - printf("\t(*st3).w1_i %d\n",(*st3).w1_i) ; - es1.w1_i = 711 ; - st1 = st2 = es1 ; - printf("\tst1.w1_i %d\n",st1.w1_i) ; - printf("\tst2.w1_i %d\n",st2.w1_i) ; - es2[2] = st1 ; - printf("\tes2[2].w1_i %d\n",es2[2].w1_i) ; - - st1.w1_i = -577 ; - es1.w1_i = 577 ; - for ( i=0 ; i<2 ; i++ ) { - st2 = ( i ? st1 : es1 ) ; - printf("\tst2.w1_i %d\n",st2.w1_i) ; - } - - st1 = ( i , es1 ) ; - printf("\tst1.w1_i %d\n",st1.w1_i) ; - - printf("w2\n") ; - s2t1.w2_i = 18000 ; - s2t1.w2_l = 31415 ; - s2t2 = s2t1 ; - printf("\ts2t2: .w2_i %d .w2_l %ld\n",s2t2.w2_i,s2t2.w2_l) ; - s2t3 = &s2t2 ; - printf("\ts2t3->w2_l %ld\n",s2t3->w2_l) ; - - printf("w3\n") ; - for ( i = 0 ; i32700; i--) - j++; - if (j != 67) e(23); - j=0; - for (i= -32768; i<-32700; i++) - j++; - if (j != 68) e(24); -} - - - - -test2() /* Testing the while statement */ -{ - int i, j; - - t = 2; - tct++; - while(1) - { - break; - e(1); - return; - } - while(0) - { - e(2); - break; - e(3); - return; - } - while (1 || 0) - { - break; - e(4); - return; - } - while (1 && 0) - { - e(5); - break; - e(6); - return; - } - j = 10; - while (--j) - ; - if (j != 0) e(7); - while (j) - { - e(8); - break; - } - while ( i=j ) - { - e(9); - break; - } - while ( (i==j) && (i!=j) ) - { - e(10); - break; - } - j = 1; - while (j) - while(j) - while(j) - while(j) - while(j) - while(--j) - ; - if (j != 0) e(11); - if (j) e(12); - j = 30; - while (--j) - { - continue; - continue; - continue; - continue; - continue; - break; - e(13); - } -} - - - - -test3() /* Combined FOR and WHILE statements */ -{ - int i,j; - - t = 3; - tct++; - j = 0; - for (i=3; i; i++) - { - while (i--) - ; - if (++j > 1) e(1); - } -} - - - - -test4() /* Do statement */ -{ - int i; - - t = 4; - tct++; - i = 0; - do - if (i) e(1); - while (i); - do - { - do - { - do - { - do - { - i++; - } - while (!i); - i++; - } - while (!i); - i++; - } - while (!i); - i++; - } - while (!i); - if (i != 4) e(2); -} - - - - -test5() /* SWITCH statement */ -{ - int i,j; - - t = 5; - tct++; - for (i=0; i<10; i++) - { - switch (i) - { - case 0: if (i != 0) e(1); - break; - case 1: if (i != 1) e(2); - break; - case 2: if (i != 2) e(3); - break; - case 3: if (i != 3) e(4); - i++; - case 4: if (i != 4) e(5); - case 5: - case 6: - case 7: - case 8: - case 9: - break; - default: e(6); - } - } - for (i=j= -18; i<10; i++, j++) - { - switch (i) - { - case -3: - case 7: - case 1: switch (j) - { - case -3: - case 7: - case 1: - break; - default: e(7); - } - break; - e(8); - case -4: switch (j) - { - case -4: if (i != -4) e(9); - break; - default: e(10); - } - } - } - i = 'a'; - switch (i) - { - case 'a': - switch ( i ) - { - case 'a': - switch ( i ) - { - case 'a': - break; - default: e(11); - } - break; - default: e(12); - } - break; - default: e(13); - } -} - - - -test6() /* goto statement */ -{ - int k; - - t = 6; - tct++; - k = 0; - goto lab0; -xl1: - k = 1; - goto lab1; -xl2: - k = 2; - goto lab2; -xl3: - k = 3; - goto lab3; -xl4: - k = 4; - goto llab1; -llab2: goto llab3; -llab4: goto llab5; -llab6: goto llab7; -llab8: if ( k != 4 ) e(5); - return ; -llab1: goto llab2; -llab3: goto llab4; -llab5: goto llab6; -llab7: goto llab8; -lab0: if ( k!= 0 ) e(1); - goto xl1 ; -lab1: if ( k!= 1 ) e(2); - goto xl2 ; -lab2: if ( k!= 2 ) e(3); - goto xl3 ; -lab3: if ( k!= 3 ) e(4); - goto xl4 ; -} - - - -test7() /* Combinations of FOR, WHILE, DO and SWITCH statements */ -{ - int i,j,k; - - t = 7; - tct++; - for ( i=j=k=0; i<6; i++, j++, k++ ) - { - if ( i != j ) e(1); - if ( i != k ) e(2); - if ( j != k ) e(3); - while ( i > j ) - { - e(4); - break; - } - while ( i > k ) - { - e(5); - break; - } - while ( j != k ) - { - e(6); - break; - } - switch(i) - { - case 0: - switch(j) - { - case 0: - switch(k) - { - case 0: if ( i+j+k != 0 ) e(7); - break; - e(8); - default: if ( i+j+k != k ) e(9); - } - break; - default: if ( j > 6 ) e(10); - if ( k != j ) e(11); - } - break; - case 1: - case 2: - case 3: - case 4: - case 5: break; - default: e(12); - } - } - for ( i=j= -3; i<0; i++,j++) - if ( j == -3 ) - do - if ( i ) - switch ( i ) - { - case -3: if ( j != i ) e(13); - case -2: if ( j != i ) e(14); - case -1: for ( k=i; k < 2*j-j; k++) - { - e(15); - break; - } - break; - case 0: e(16); - break; - default: e(17); - break; - } - else e(18); - while ( 0 ); - if ( i != j ) e(19); -} - - - - -test8() -{ - int *p1, *p2; - int i,j,k; - int a1[1], a2[2][2], a3[3][3][3]; - - t = 8; - tct++; - a1[0] = 0; - for ( i=0; i<2; i++ ) - for ( j=0; j<2; j++ ) - a2[i][j] = (i*j) ^ (i+j); - if ( a2[0][0] != 0 ) e(1); - if ( a2[0][1] != 1 ) e(2); - if ( a2[1][0] != a2[0][1] ) e(3); - for ( i=0; i<3; i++) - for (j=0; j<3; j++) - for (k=0; k<3; k++) - a3[i][j][k] = i | j | k; - if ( a3[0][0][0] != 0 ) e(4); - if ( a3[0][1][2] != a3[2][0][1] ) e(5); - if ( a3[2][1][1] != (2 | 1 | 1) ) e(6); - p2 = &a3[0][1][2]; - p1 = &a3[0][1][2]; - for ( ; p1 == p2 ; p1++ ) - { - switch ( *p1 ) - { - case 3: break; - default: e(7); - } - if ( *p1 != *p2 ) e(8); - } -} diff --git a/ir/be/test/ack/test.c b/ir/be/test/ack/test.c deleted file mode 100644 index 1d1c166e3..000000000 --- a/ir/be/test/ack/test.c +++ /dev/null @@ -1,1243 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -char rcs_id[] = "$Id$" ; - -/* C-compiler test 1 */ -/* This program can be used to test C-compilers */ - -#ifndef NOFLOAT -# define EPSD 1e-5 -# define EPSF 1e-5 -#endif - -/* global counters */ - -int t, /* the value indicates the number of the test procedure */ - ect, /* error counter */ - tct; /* count the number of test procedures called */ - -/****************************************************************************/ -/* - * The following is tested: - * INTEGER CONSTANTS in test1 - * GLOBAL INTEGER VARIABLES in test2 - * LOCAL INTEGER VARIABLES in test3 - * GLOBAL LONG VARIABLES in test4 - * LOCAL LONG VARIABLES in test5 - * REAL ARITHMETIC in test6 - * GLOBAL RECORDS in test7 - * LOCAL RECORDS in test8 - * GLOBAL ARRAYS in test9 - * LOCAL ARRAYS in test10 - * GLOBAL POINTERS in test11 - */ -/***************************************************************************/ -char alstr[1000] ; -char *alptr = alstr ; - -char *alloc(size) { - register char *retval ; - - retval=alptr ; - alptr += size ; - if ( alptr-alstr>sizeof alstr ) { - printf("allocation overflow\n") ; - exit(8) ; - } - return(retval) ; -} - -#ifndef NOFLOAT -double fabs(a) double a ; { return( a<0 ? -a : a) ; } -#endif - - - -/* global variables for the test procedures */ - -int i,j,k,l,m; - -long li,lj,lk,ll,lm; - -#ifndef NOFLOAT -float xf, yf, zf; - -double xd, yd, zd; -#endif - -struct tp2 { - char c1; - int i,j; -#ifndef NOFLOAT - float aaa; - double bbb; -#endif -} r1, r2; - -int p, *p1, *p11, **p2, ***p3, ****p4, *****p5; - -struct tp2 *pp1, *pp2, *pp3; -int a1[20]; -#ifndef NOFLOAT -float a2[20]; -double a3[20]; -#endif - -main() -{ - tct = 0; - ect = 0; - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); -#ifndef NOFLOAT - test11(); -#endif - printf("End of test program, %d tests completed, %d errors detected\n", - tct,ect); - return 0 ; -} - - - -e(n) -int n; -{ - ect++; - printf("Error %d in test%d \n",n,t); -} - - - -test1() /* testing integer constants */ -{ - t = 1; - tct++; - if (0) e(1); - if (!1) e(2); - if ( 1+2 != 3 ) e(3); - if (-500 - 234 != -734) e(4); - if (-32 + 155 != 123) e(5); - if ( 2*3 != 6) e(6); - if ( 3*4*5*6 != 360) e(7); - if ( 654-3*2 != 648) e(8); - if (5*5 + 5*5 != 50) e(9); - if ( 1+1-1+1-1+1-1+1-1+1 != 2) e(10); -/**********************************************************************/ - if ( ((((((((((((((((((((0)))))))))))))))))))) ) e(11); - if ( (((-2))) - ((((-3)))) * (3+((2))) != 13 ) e(12); - if ( 1+1 != 2 ) e(13); - if ( 3333 + 258 != 3591) e(14); - if (3*4 != 12) e(15); - if (111*111 != 12321) e(16); - if (50 / 5 != 10) e(17); - if (7498 / 75 != 99) e(18); - if (456 - 345 != 111) e(19); - if (1+(-2) != -1) e(20); - if (-3 * -4 != 12) e(21); - if (-2 / 2 != -1) e(22); - if (-5 / 1 != -5) e(23); - if (-4 - -5 != 1) e(24); - if ( 03 + 02 != 05) e(25); - if ( 03456 + 88 != 03606 ) e(26); - if ( 0100 * 23 != 02700 ) e(27); - if ( 045 / 020 != 2 ) e(28); - if ( 0472 - 0377 != 073 ) e(29); - if ( 'a' != 'a' ) e(30); - if ( 'a' + 'c' != 'b' + 'b' ) e(31); - if ( 'z' * 'z' != 14884 ) e(32); - if ( -'z' / 01 != -'z' ) e(33); - if ( 077777 >> 3 != 07777 ) e(34); - if ( 077777 >> 15 ) e(35); - if ( ( 0124 & 07765 ) != 0124 ) e(37); - if ( ( 34 & 31 ) != 2 ) e(38); - if (( 5 | 013 | 020 ) != 31 ) e(39); - if ( ( -7 ^ 3 ) != -6 ) e(40); - if ( (07373 ^ 4632 ) != 016343 ) e(41); - if ( (1+2+3)*(2+3+4)*(3+5+5) / 2 != ((3*((5+3+2)*10)+51)*6)/6 ) e(42); - if ( (1000*2+5*7+13)/8 != 2*2*2*2*4*4 ) e(43); - if ( ( 1*2*3*4*5*6*7 / 5040 ) != 5040 / 7 / 6 / 5 / 4 / 3 / 2 / 1 ) e(44); - if ( (-(-(-(-(-(-(1))))))) != 1) e(45); - if ( - 1 != -((((((((1)))))))) ) e(46); - if ( -1-1-1-1-1-1 != -6+3-3 ) e(47); - if ( 2<1 ) e(48); - if ( 2==3 ) e(49); - if ( 2 != 2 ) e(50); - if ( 2>3 ) e(51); - if ( 2+0 != 2 ) e(52); - if ( 2-0 != 2 ) e(53); - if ( 2*0 != 0 ) e(54); - if ( 0/1 != 0 ) e(55); - if ( 0*0 != 0 ) e(56); - if (32767 > 32767) e(57); - if ( -32768 > -32767 ) e(58); - if ( 0456 < 0400 ) e(59); - if ( 0456 != ( 0400 | 050 | 06 ) ) e(60); - if ( 2*2 + (2<<2) != 12 ) e(61); - if ( 0 || 0 ) e(62); - if ( 1 && 0 ) e(63); - if ( ( 123 ? 123*4 : 345 ) != 492 ) e(64); - if ( ( 0 ? 345 : 280 ) != 280 ) e(65); - if ( ( 4>>10 ) + 3 != 3 ) e(66); - if ( ! ( 111 || 23 && 0 ) ) e(67); - if ( !1 ) e(68); - if ( !0 == 0 ) e(69); - if ( !!!!!!!!!!0 ) e(70); - if ( 2*2*2*2 != 4*4 ) e(71); - if ( 0 && 0 && 0 && 0000 && 000000000000 ) e(72); - if ( 1 & 1 & 1 && 1 & 1 && 1 & 0 ) e(73); - if ( 01 + 01 + 01 != 1 + 1 + 1 ) e(74); - if ( 07 + 1 != 010 ) e(75); - if ( ('a' & 017777) != 'a' ) e(76); - if ( ( 3 >> 0 ) != 3 ) e(77); - if ( ( 3 << 0 ) != 3 ) e(78); - if ( ((((((((((3)))))))))) << ((((((((((((2)))))))))))) != 12 ) e(79); - if ( (((3 << 4)) >> 4) != 3 ) e(80); - if ( (2+'a')*'b' != 2*'b' + 'a'*'b' ) e(81); - if ( 'a' * 'a' < 0 ) e(82); - if ( ('a'-'a'+'a'-'a'+('a'-'a')*'h') >> 3 ) e(82); - if ( 'z' - 01 != 'y' + 00 ) e(83); - if ( 'a' ^ 'a' ) e(84); - if ( 'h' ^ 'h' ^ 'a' ^ 'a' ) e(85); - if ( 0567 ^ (0500 | 060 | 7 ) ) e(86); - if ( 0 ^ 0 ^ 0 ^ 00 ) e(87); - if ( ( !0 ) ^ (!0) ) e(88); - if ( ( !!!40 ) ^ (!!!050) ) e(89); - if ( ( 6^7 ) * 345 != 345 ) e(90); - if ( !!!!!!!!!!!!! 'k' ) e(91); - if ( !!!((('k'))) ) e(92); - if ( -0 != 0 ) e(93) ; -} - - - - -test2() /* testing global integer variables */ -{ - t = 2; - tct++; - i = 1; - j = 2; - k = 3; - l = 4; - m = 10; - if ( i + j != k ) e(1); - if ( i + k != l ) e(2); - if ( j - k != -i ) e(3); - if ( j*(j+k) != m ) e(4); - if ( -m != -(k+k+l) ) e(5); - if ( i/i != 1 ) e(6); - if ( m*m / m != m ) e(7); - if ( 10*m != 100 ) e(8); - if ( m * (-10) != -100 ) e(9); - if ( j/k != 0 ) e(10); - if ( 100/k != 33 ) e(11); - if ( i+j*k+l+m / j+50 / k != 32 ) e(12); - if ( j*k*m / 6 != 10 ) e(13); - if ( (k>4) || (k>=4) || (k==4) ) e(14); - if ( (mj ) e(19); - if ( (i>j ? k : k*j) != 6 ) e(20); - if ( (i> i != i ) e(25); - if ( i++ != 1 ) e(26); - if ( --i != 1 ) e(27); - if ( i-- != 1 ) e(28); - if ( (i+j) && (i<0) || (m-10) && (064) ) e(29); - if ( (i+j) && !(i>=0) || (m-10) && !(0) ) e(30); - i = 2; - j = 4; - k = 8; - l = 16; - m = 32; - if ( i != 02 ) e(31); - if ( j != 04 ) e(32); - if ( k != 010 ) e(33); - if ( l != 020 ) e(34); - if ( i & j ) e(35); - if ( i & j & k & l & m ) e(36); - if ( ! ( i & j & k & l & m | i ) ) e(37); - if ( ( i >> 0 ) != i ) e(38); - if ( (( i/i ) << 1 ) != 02 ) e(39); - if ( ( i | (j) | (k) | (l) | (m) ) != i+j+k+l+m ) e(40); - if (!(i^j) ) e(41); - if ( !(i^j^k^l^m) ) e(42); - if ( ( --i << 1 ) != 2 ) e(43); - if ( ( i << 01 ) != 2 ) e(44); - if ( i%j != i ) e(45); - if ( k%l != k ) e(46); - if (( (m/l) << i >> i ) != 2 ) e(47); - if ( (i = j = k = l = m) != m ) e(48); - if ( ( i!=j ) || ( j!=k ) || !(l==m) ) e(49); - if ( (ii) || (k>3)%(i/i)) ) e(52); - if ( ! ( i++ == j++ ) ) e(53); - if ( i != j ) e(54); - if ( i++ != (j++) ) e(55); - i = 1; - j = i + 1; - if ( -i != -i ) e(56); - if ( i != --j ) e(57); - if ( (((((i))))) != -(-(-(-(i)))) ) e(59); - if ( j != 1 ) e(60); -} - - - - -test3() /* testing local integer variables */ -{ - int a,b,c,d,f; - - t = 3; - tct++; - a = 1; - b = 2; - c = 3; - d = 4; - f = 10; - if ( a + b != c ) e(1); - if ( a + c != d ) e(2); - if ( b - c != -a ) e(3); - if ( b*(b+c) != f ) e(4); - if ( -f != -(c+c+d) ) e(5); - if ( a/a != 1 ) e(6); - if ( f*f / f != f ) e(7); - if ( 10*f != 100 ) e(8); - if ( f * (-10) != -100 ) e(9); - if ( b/c != 0 ) e(10); - if ( 100/c != 33 ) e(11); - if ( a+b*c+d+f / b+50 / c != 32 ) e(12); - if ( b*c*f / 6 != 10 ) e(13); - if ( (c>4) || (c>=4) || (c==4) ) e(14); - if ( (fb ) e(19); - if ( (a>b ? c : c*b) != 6 ) e(20); - if ( (a> a != a ) e(25); - if ( a++ != 1 ) e(26); - if ( --a != 1 ) e(27); - if ( a-- != 1 ) e(28); - if ( (a+b) && (a<0) || (f-10) && (064) ) e(29); - if ( (a+b) && !(a>=0) || (f-10) && !(0) ) e(30); - a = 2; - b = 4; - c = 8; - d = 16; - f = 32; - if ( a != 02 ) e(31); - if ( b != 04 ) e(32); - if ( c != 010 ) e(33); - if ( d != 020 ) e(34); - if ( a & b ) e(35); - if ( a & b & c & d & f ) e(36); - if ( ! ( a & b & c & d & f | a ) ) e(37); - if ( ( a >> 0 ) != a ) e(38); - if ( (( a/a ) << 1 ) != 02 ) e(39); - if ( ( a | (b) | (c) | (d) | (f) ) != a+b+c+d+f ) e(40); - if (!(a^b) ) e(41); - if ( !(a^b^c^d^f) ) e(42); - if ( ( --a << 1 ) != 2 ) e(43); - if ( ( a << 01 ) != 2 ) e(44); - if ( a%b != a ) e(45); - if ( c%d != c ) e(46); - if (( (f/d) << a >> a ) != 2 ) e(47); - if ( (a = b = c = d = f) != f ) e(48); - if ( ( a!=b ) || ( b!=c ) || !(d==f) ) e(49); - if ( (aa) || (c>3)%(a/a)) ) e(52); - if ( ! ( a++ == b++ ) ) e(53); - if ( a != b ) e(54); - if ( a++ != (b++) ) e(55); - a = 1; - b = a + 1; - if ( -a != -a ) e(56); - if ( a != --b ) e(57); - if ( (((((a))))) != -(-(-(-(a)))) ) e(59); - if ( b != 1 ) e(60); -} - - - - -test4() /* testing global long variables */ -{ - t = 4; - tct++; - li = 1; - lj = 2; - lk = 3; - ll = 4; - lm = 10; - if ( li + lj != lk ) e(1); - if ( li + lk != ll ) e(2); - if ( lj - lk != -li ) e(3); - if ( lj*(lj+lk) != lm ) e(4); - if ( -lm != -(lk+lk+ll) ) e(5); - if ( li/li != 1 ) e(6); - if ( lm*lm / lm != lm ) e(7); - if ( 10*lm != 100 ) e(8); - if ( lm * (-10) != -100 ) e(9); - if ( lj/lk != 0 ) e(10); - if ( 100/lk != 33 ) e(11); - if ( li+lj*lk+ll+lm / lj+50 / lk != 32 ) e(12); - if ( lj*lk*lm / 6 != 10 ) e(13); - if ( (lk>4) || (lk>=4) || (lk==4) ) e(14); - if ( (lmlj ) e(19); - if ( (li>lj ? lk : lk*lj) != 6 ) e(20); - if ( (li> li != li ) e(25); - if ( li++ != 1 ) e(26); - if ( --li != 1 ) e(27); - if ( li-- != 1 ) e(28); - if ( (li+lj) && (li<0) || (lm-10) && (064) ) e(29); - if ( (li+lj) && !(li>=0) || (lm-10) && !(0) ) e(30); - li = 2; - lj = 4; - lk = 8; - ll = 16; - lm = 32; - if ( li != 02 ) e(31); - if ( lj != 04 ) e(32); - if ( lk != 010 ) e(33); - if ( ll != 020 ) e(34); - if ( li & lj ) e(35); - if ( li & lj & lk & ll & lm ) e(36); - if ( ! ( li & lj & lk & ll & lm | li ) ) e(37); - if ( ( li >> 0 ) != li ) e(38); - if ( (( li/li ) << 1 ) != 02 ) e(39); - if ( ( li | (lj) | (lk) | (ll) | (lm) ) != li+lj+lk+ll+lm ) e(40); - if (!(li^lj) ) e(41); - if ( !(li^lj^lk^ll^lm) ) e(42); - if ( ( --li << 1 ) != 2 ) e(43); - if ( ( li << 01 ) != 2 ) e(44); - if ( li%lj != li ) e(45); - if ( lk%ll != lk ) e(46); - if (( (lm/ll) << li >> li ) != 2 ) e(47); - if ( (li = lj = lk = ll = lm) != lm ) e(48); - if ( ( li!=lj ) || ( lj!=lk ) || !(ll==lm) ) e(49); - if ( (lili) || (lk>3)%(li/li)) ) e(52); - if ( ! ( li++ == lj++ ) ) e(53); - if ( li != lj ) e(54); - if ( li++ != (lj++) ) e(55); - li = 1; - lj = li + 1; - if ( -li != -li ) e(56); - if ( li != --lj ) e(57); - if ( (((((li))))) != -(-(-(-(li)))) ) e(59); - if ( lj != 1 ) e(60); - li = 40000; - lj = 80000; - lk = 800000L; - ll = -800000L; - lm = 1200000L; - if ( lk != -ll ) e(61); - if ( 10 * li != 400000L ) e(62); - if ( 2 * li != lj ) e(63); - if ( -(-(-(-(li)))) != li ) e(64); - if ( 10 * lj != lk ) e(65); - if ( lm + lm != 2 * lm ) e(66); - if ( lm - lm ) e(67); - if ( lk / lk != 1 ) e(68); - if ( lk / lj != 10 ) e(69); - if ( lm / li != 30 ) e(70); - if ( li + lj != lm / 10 ) e(71); - if ( li - 40000 - 1 != lk - 800001L ) e(72); - if ( li + li + li + li +li + li != lj + lj + lj ) e(73); - if ( li > lj ) e(74); - if ( lj > lk ) e(75); - if ( lm < ll ) e(76); - if ( (lm<1000000L) || (((lk-lj-lj*10)>0)) ) e(77); - if ( lm / 01 != lm ) e(78); - if ( lm * 01 != lm ) e(79); - if ( lm + 'a' != lm + 'b' -1 ) e(80); - if ( (lm % 'a') % 'a' != lm % 'a' ) e(81); - if ( lm % lm ) e(82); - if ( lj % li ) e(83); - if ( (lm<<1) != lm * 2 ) e(84); - if ( ! ( ( --lm % li ) + 1 ) ) e(86); - if ( ( lj >> 1 ) ^ li ) e(87); - li = 1; - if ( li != 1 ) e(89); - li <<= 20; - lj = 2; - if ( (lj<<19) != li ) e(90); - li = lj = lk= ll = lm = -345678L; - if ( (li != lj) || (lj != lk) || (ll != lm) ) e(91); - if ( (li != lj) || (lj != lk) || (lk != ll) || (ll != lm) ) e(92); - if ( li != -345678L ) e(93); - li = 1 | 2; - li <<= 20; - lj = li & li & li & li & li | li | li | li; - if ( li != lj ) e(94); - if ( ! ( li & lj ) ) e(95); - if ( li ^ lj ) e(96); - if ( ! (li | lj) ) e(97); - if ( (li >> 20) != 3 ) e(98); - li = 20000; - li *= 2; - if ( li < 0 ) e(99); - if ( 1 * li != li ) e(100); - lj = 20000; - if ( (lj<<1) != li ) e(101); - if ( (5*lj)/10 != lj/2 ) e(102); - if ( 4*lj != 1*01*2*2*lj ) e(103); - li = lj = 30000; - if ( li != li * lj / 30000 ) e(104); - if ( ++li != ++lj ) e(105); - lk = 5; - ll = 150000L; - if ( lk * (li-1) != ll ) e(106); -} - - - - -test5() /* testing local long variables */ -{ - long la, lb, lc, ld, lf; - - t = 5; - tct++; - la = 1; - lb = 2; - lc = 3; - ld = 4; - lf = 10; - if ( la + lb != lc ) e(1); - if ( la + lc != ld ) e(2); - if ( lb - lc != -la ) e(3); - if ( lb*(lb+lc) != lf ) e(4); - if ( -lf != -(lc+lc+ld) ) e(5); - if ( la/la != 1 ) e(6); - if ( lf*lf / lf != lf ) e(7); - if ( 10*lf != 100 ) e(8); - if ( lf * (-10) != -100 ) e(9); - if ( lb/lc != 0 ) e(10); - if ( 100/lc != 33 ) e(11); - if ( la+lb*lc+ld+lf / lb+50 / lc != 32 ) e(12); - if ( lb*lc*lf / 6 != 10 ) e(13); - if ( (lc>4) || (lc>=4) || (lc==4) ) e(14); - if ( (lflb ) e(19); - if ( (la>lb ? lc : lc*lb) != 6 ) e(20); - if ( (la> la != la ) e(25); - if ( la++ != 1 ) e(26); - if ( --la != 1 ) e(27); - if ( la-- != 1 ) e(28); - if ( (la+lb) && (la<0) || (lf-10) && (064) ) e(29); - if ( (la+lb) && !(la>=0) || (lf-10) && !(0) ) e(30); - la = 2; - lb = 4; - lc = 8; - ld = 16; - lf = 32; - if ( la != 02 ) e(31); - if ( lb != 04 ) e(32); - if ( lc != 010 ) e(33); - if ( ld != 020 ) e(34); - if ( la & lb ) e(35); - if ( la & lb & lc & ld & lf ) e(36); - if ( ! ( la & lb & lc & ld & lf | la ) ) e(37); - if ( ( la >> 0 ) != la ) e(38); - if ( (( la/la ) << 1 ) != 02 ) e(39); - if ( ( la | (lb) | (lc) | (ld) | (lf) ) != la+lb+lc+ld+lf ) e(40); - if (!(la^lb) ) e(41); - if ( !(la^lb^lc^ld^lf) ) e(42); - if ( ( --la << 1 ) != 2 ) e(43); - if ( ( la << 01 ) != 2 ) e(44); - if ( la%lb != la ) e(45); - if ( lc%ld != lc ) e(46); - if (( (lf/ld) << la >> la ) != 2 ) e(47); - if ( (la = lb = lc = ld = lf) != lf ) e(48); - if ( ( la!=lb ) || ( lb!=lc ) || !(ld==lf) ) e(49); - if ( (lala) || (lc>3)%(la/la)) ) e(52); - if ( ! ( la++ == lb++ ) ) e(53); - if ( la != lb ) e(54); - if ( la++ != (lb++) ) e(55); - la = 1; - lb = la + 1; - if ( -la != -la ) e(56); - if ( la != --lb ) e(57); - if ( (((((la))))) != -(-(-(-(la)))) ) e(59); - if ( lb != 1 ) e(60); - la = 40000; - lb = 80000; - lc = 800000L; - ld = -800000L; - lf = 1200000L; - if ( lc != -ld ) e(61); - if ( 10 * la != 400000L ) e(62); - if ( 2 * la != lb ) e(63); - if ( -(-(-(-(la)))) != la ) e(64); - if ( 10 * lb != lc ) e(65); - if ( lf + lf != 2 * lf ) e(66); - if ( lf - lf ) e(67); - if ( lc / lc != 1 ) e(68); - if ( lc / lb != 10 ) e(69); - if ( lf / la != 30 ) e(70); - if ( la + lb != lf / 10 ) e(71); - if ( la - 40000 - 1 != lc - 800001L ) e(72); - if ( la + la + la + la +la + la != lb + lb + lb ) e(73); - if ( la > lb ) e(74); - if ( lb > lc ) e(75); - if ( lf < ld ) e(76); - if ( (lf<1000000L) || (((lc-lb-lb*10)>0)) ) e(77); - if ( lf / 01 != lf ) e(78); - if ( lf * 01 != lf ) e(79); - if ( lf + 'a' != lf + 'b' -1 ) e(80); - if ( (lf % 'a') % 'a' != lf % 'a' ) e(81); - if ( lf % lf ) e(82); - if ( lb % la ) e(83); - if ( (lf<<1) != lf * 2 ) e(84); - if ( ! ( ( --lf % la ) + 1 ) ) e(86); - if ( ( lb >> 1 ) ^ la ) e(87); - la = 1; - if ( la != 1 ) e(89); - la <<= 20; - lb = 2; - if ( (lb<<19) != la ) e(90); - la = lb = lc= ld = lf = -345678L; - if ( (la != lb) || (lb != lc) || (ld != lf) ) e(91); - if ( (la != lb) || (lb != lc) || (lc != ld) || (ld != lf) ) e(92); - if ( la != -345678L ) e(93); - la = 1 | 2; - la <<= 20; - lb = la & la & la & la & la | la | la | la; - if ( la != lb ) e(94); - if ( ! ( la & lb ) ) e(95); - if ( la ^ lb ) e(96); - if ( ! (la | lb) ) e(97); - if ( (la >> 20) != 3 ) e(98); - la = 20000; - la *= 2; - if ( la < 0 ) e(99); - if ( 1 * la != la ) e(100); - lb = 20000; - if ( (lb<<1) != la ) e(101); - if ( (5*lb)/10 != lb/2 ) e(102); - if ( 4*lb != 1*01*2*2*lb ) e(103); - la = lb = 30000; - if ( la != la * lb / 30000 ) e(104); - if ( ++la != ++lb ) e(105); - lc = 5; - ld = 150000L; - if ( lc * (la-1) != ld ) e(106); -} - - - -test6() /* global records */ -{ -#ifndef NOFLOAT - double epsd; - float epsf; - double fabs(); -#endif - - t = 6; - tct++; -#ifndef NOFLOAT - epsd = EPSD; - epsf = EPSF; -#endif - r1.c1 = 'x'; - r1.i = 40; - r1.j = 50; -#ifndef NOFLOAT - r1.aaa = 3.0; - r1.bbb = 4.0; -#endif - r2.c1 = r1.c1; - r2.i = 50; - r2.j = 40; -#ifndef NOFLOAT - r2.aaa = 4.0; - r2.bbb = 5.0; -#endif - if ( r1.c1 != 'x' || r1.i != 40 ) e(1); -#ifndef NOFLOAT - if ( r1.aaa != 3.0 ) e(1); -#endif - if ( r1.i != 40 || r2.i != 50 ) e(2); - if ( r2.j != 40 || r1.j != 50 ) e(3); - if ( (r1.c1 + r2.c1)/2 != 'x' ) e(4); -#ifndef NOFLOAT - if ( r1.aaa * r1.aaa + r2.aaa * r2.aaa != r2.bbb * r2.bbb ) e(5); - r1.i = r1.j = r2.i = r2.j = 3.0; -#else - r1.i = r1.j = r2.i = r2.j = 3; -#endif - if ( r1.i != 3 ) e(6); - if ( r1.i * r2.j - 9 ) e(7); - r1.i++; - if ( r1.i != 4 ) e(8); - if ( --r1.i != 3 ) e(9); - if ( (++r2.i) * (--r2.j) != 8 ) e(10); - if ( (r2.i = r2.j = r1.j = r1.i = -5 ) != -5 ) e(11); - if ( r2.i * r1.j / 25 != 1 ) e(12); - r1.c1 = '\0'; - if ( r1.i * r1.j * r2.i * r1.c1 * r2.j ) e(13); - r2.c1 = 'j'; - if ( r1.c1 + r2.c1 != 'j' ) e(14); - if ( r1.c1 * r2.c1 ) e(15); - r2.j = r1.i = r2.i = r1.j = 1; - if ( (r1.i<<0) != r1.j ) e(16); - if ( (r1.i >> -0 ) != ( r1.j >> 0 ) ) e(17); - if ( (r1.i<<1) != 2 ) e(18); - if ( (r1.i<<2) != 4 ) e(19); - if ( (r1.j<<3) != (r2.j<<3) ) e(20); - if ( (r1.i | r1.i | r1.i | r1.i | r1.i) != r1.i ) e(21); - if ( (r2.j & r1.j & r2.j & r2.i) != (r1.i<<3>>3) ) e(22); - r1.j = 1; -#ifndef NOFLOAT - r1.aaa = 2.0; - if ( fabs ( r1.j * r1.aaa - 2.0 ) > epsd ) e(23); - if ( (r1.j << 4) * r1.aaa != (r1.j << 4) * r1.aaa ) e(24); - if ( ((r1.j<<6)&r1.j) * r1.aaa ) e(25); - if ((r1.j | (r1.j << 1)) * r1.aaa != ((r1.j << 1) ^ r1.j) * r1.aaa) e(26); -#endif - r1.i = r1.j = r2.i = r2.j = -2; - if ( r1.i > 0 || r1.j >= 0 ) e(27); - if ( r1.i != r2.j ) e(28); - if ( !!! ((((( r1.i == r2.j ))))) ) e(28); - if ( -(-(r1.j)) != r2.j ) e(29); - if ( r1.i % r1.j ) e(30); - if ( (r1.i % r1.j) % r1.i ) e(31); - if ( 0 % r2.j ) e(32); - if ( 03 * r1.i != -6 ) e(33); -#ifndef NOFLOAT - r1.aaa = r2.aaa = -4; - r1.bbb = r2.bbb = 4; - if ( r1.aaa > -3.5 ) e(34); - if ( fabs ( r1.aaa - r2.aaa ) > epsf ) e(35); -#endif - r1.c1 = '\03'; -#ifndef NOFLOAT - if ( fabs ( r2.aaa * r1.aaa - r1.c1 * 5 - 1.0 ) > epsf ) e(36); -#else - if ( 5*r1.c1 != 15 ) e(36) ; -#endif -} - - - - -test7() /* local records */ -{ -#ifndef NOFLOAT - double epsd; - float epsf; - double fabs(); -#endif - struct tp2 s1, s2; - - t = 7; - tct++; -#ifndef NOFLOAT - epsd = EPSD; - epsf = EPSF; -#endif - s1.c1 = 'x'; - s1.i = 40; - s1.j = 50; -#ifndef NOFLOAT - s1.aaa = 3.0; - s1.bbb = 4.0; -#endif - s2.c1 = s1.c1; - s2.i = 50; - s2.j = 40; -#ifndef NOFLOAT - s2.aaa = 4.0; - s2.bbb = 5.0; -#endif - if ( s1.c1 != 'x' || s1.i != 40 ) e(1); -#ifndef NOFLOAT - if ( s1.aaa != 3.0 ) e(1); -#endif - if ( s1.i != 40 || s2.i != 50 ) e(2); - if ( s2.j != 40 || s1.j != 50 ) e(3); - if ( (s1.c1 + s2.c1)/2 != 'x' ) e(4); -#ifndef NOFLOAT - if ( s1.aaa * s1.aaa + s2.aaa * s2.aaa != s2.bbb * s2.bbb ) e(5); - s1.i = s1.j = s2.i = s2.j = 3.0; -#else - s1.i = s1.j = s2.i = s2.j = 3; -#endif - if ( s1.i != 3 ) e(6); - if ( s1.i * s2.j - 9 ) e(7); - s1.i++; - if ( s1.i != 4 ) e(8); - if ( --s1.i != 3 ) e(9); - if ( (++s2.i) * (--s2.j) != 8 ) e(10); - if ( (s2.i = s2.j = s1.j = s1.i = -5 ) != -5 ) e(11); - if ( s2.i * s1.j / 25 != 1 ) e(12); - s1.c1 = '\0'; - if ( s1.i * s1.j * s2.i * s1.c1 * s2.j ) e(13); - s2.c1 = 'j'; - if ( s1.c1 + s2.c1 != 'j' ) e(14); - if ( s1.c1 * s2.c1 ) e(15); - s2.j = s1.i = s2.i = s1.j = 1; - if ( (s1.i<<0) != s1.j ) e(16); - if ( (s1.i >> -0 ) != ( s1.j >> 0 ) ) e(17); - if ( (s1.i<<1) != 2 ) e(18); - if ( (s1.i<<2) != 4 ) e(19); - if ( (s1.j<<3) != (s2.j<<3) ) e(20); - if ( (s1.i | s1.i | s1.i | s1.i | s1.i) != s1.i ) e(21); - if ( (s2.j & s1.j & s2.j & s2.i) != (s1.i<<3>>3) ) e(22); - s1.j = 1; -#ifndef NOFLOAT - s1.aaa = 2.0; - if ( fabs ( s1.j * s1.aaa - 2.0 ) > epsd ) e(23); - if ( (s1.j << 4) * s1.aaa != (s1.j << 4) * s1.aaa ) e(24); - if ( ((s1.j<<6)&s1.j) * s1.aaa ) e(25); - if ((s1.j | (s1.j << 1)) * s1.aaa != ((s1.j << 1) ^ s1.j) * s1.aaa) e(26); -#endif - s1.i = s1.j = s2.i = s2.j = -2; - if ( s1.i > 0 || s1.j >= 0 ) e(27); - if ( s1.i != s2.j ) e(28); - if ( !!! ((((( s1.i == s2.j ))))) ) e(28); - if ( -(-(s1.j)) != s2.j ) e(29); - if ( s1.i % s1.j ) e(30); - if ( (s1.i % s1.j) % s1.i ) e(31); - if ( 0 % s2.j ) e(32); - if ( 03 * s1.i != -6 ) e(33); -#ifndef NOFLOAT - s1.aaa = s2.aaa = -4; - s1.bbb = s2.bbb = 4; - if ( s1.aaa > -3.5 ) e(34); - if ( fabs ( s1.aaa - s2.aaa ) > epsf ) e(35); -#endif - s1.c1 = '\03'; -#ifndef NOFLOAT - if ( fabs ( s2.aaa * s1.aaa - s1.c1 * 5 - 1.0 ) > epsf ) e(36); -#else - if ( 5*s1.c1 != 15 ) e(36) ; -#endif -} - - - - -test8() /* global arrays */ -{ -#ifndef NOFLOAT - float epsf; - double epsd; - double fabs(); -#endif - - t = 8; - tct++; -#ifndef NOFLOAT - epsf = EPSF; - epsd = EPSD; -#endif - for ( i=0; i<20 ; i++ ) - a1[i] = i*i; - if ( a1[9] != 81 || a1[17] != 289 || a1[0] != 0 ) e(1); - if ( a1[1] + a1[2] + a1[3] != 14 ) e(2); - if ( ! a1[15] ) e(3); - if ( a1[8] / a1[4] != 4 ) e(4); -#ifndef NOFLOAT - for ( i=0; i<20; i++ ) - a2[i] = 10.0e-1 + i/54.324e-1; - if ( fabs(a2[4]*a2[4]-a2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5); - if ( fabs(a2[8]/a2[8]*a2[9]/a2[9]-a2[10]+a2[10]-1.0 ) > epsf ) e(6); - if ( fabs(a2[5]-a2[4]-1/54.324e-1 ) > epsf ) e(7); - for ( i=0; i<20; i++) - a3[i]= 10.0e-1 + i/54.324e-1; - if ( fabs(a3[4]*a3[4]-a3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8); - if ( fabs( a3[8]*a3[9]/a3[8]/a3[9]-a3[10]+a3[10]-1000e-3) > epsd ) e(9); - if ( fabs(a3[8]+a3[6]-2*a3[7]) > epsd ) e(10); -#endif - for ( i=0; i<20; i++ ) - a1[i] = i+1; - if ( a1[a1[a1[a1[a1[a1[0]]]]]] != 6 ) e(11); - if ( a1[a1[0]+a1[1]+a1[2]+a1[3]] != 11 ) e(12); - if ( (a1[0] << 2) != 4 ) e(13); - if ( (a1[0] >> 2) ) e(14); - if ( (a1[0] << 3 >> 3) != a1[0] ) e(15); - if ( a1[a1[0] << 1] != 3 ) e(16); - if ( a1[4<<1] != 9 ) e(17); - if ( a1[4 << 1] != 9 ) e(18); - if ( (1 << a1[0]) != 2 ) e(19); - if ( (1 & a1[0]) != 1 ) e(20); - if ( a1[4]++ != 5 ) e(21); - if ( a1[4] != 6 ) e(22); - if ( --a1[4] != 5 ) e(23); - if ( a1[ --a1[10] ] != 10 ) e(24); - a1[0] = 0; - a1[1] = 1; - a1[2] = 2; - a1[3] = 3; - i = 3; - if ( a1[--i] != 2 ) e(25); - if ( a1[ a1[--i] ] != 1 ) e(26); - if ( a1[a1[a1[a1[a1[a1[a1[a1[3]]]]]]]] != 3 ) e(27); - if ( a1[1+2] != 3 ) e(28); - if ( a1[1+2] != a1[3/3] + 2 ) e(29); - if ( a1[i=2] != 2 ) e(30); - if ( -a1[i==3] ) e(31); - if ( a1[3*2 + a1[0]*6 - 10/2 -4 + 3/1] != 0 ) e(32); - if ( a1['a' + 'c' -2*'b'] ) e(33); - if ( a1[ a1[0]==a1[1] ] ) e(34); - if ( a1[a1[1<<1]>>1] != 1 ) e(35); - a1[i=j=4] = 10; - if ( (i!=4) || (j!=4) || (i!=j) ) e(36); - if ( a1[4] != 10 ) e(37); - if ( a1[--i] != 3 ) e(38); - if ( a1[i++] != 3 ) e(39); - if ( --a1[--i] != 2 ) e(40); - a1[a1[a1[a1[a1[0]=7]=5]=8]=2]=0; - if ( a1[0] != 7) e(41); - if ((a1[7] != 5) || (a1[5]!=8) || (a1[8]!=2))e(42); - if (a1[2]) e(43); - for ( i=0 ; i<20; i++) - a1[i] = i; - a1[0] = 0; - a1[1] = 01; - a1[2] = 02; - a1[3] = 04; - a1[4] = 010; - if ((a1[0] | a1[1] | a1[2] | a1[3] | a1[4]) != 017 ) e(44); - if ( a1[0]<<4 ) e(45); - if ( (a1[4]>>3) != 1 ) e(46); - a1[4] = 04; - a1[010] = 010; - if ( a1[8] != 8 ) e(47); - if ( a1[0|1|2|4|8] != (a1[0]|a1[1]|a1[2]|a1[4]|a1[8]) ) e(48); - if ( a1[a1[0]|a1[1]|a1[2]|a1[4]|a1[8]] != a1[017] ) e(49); - if ( a1[a1[1]^a1[2]^a1[4]^a1[8]] != a1[a1[1]|a1[2]|a1[4]|a1[8]] ) e(50); - for ( i = 0; i<20; i++ ) - a1[i] = i+1; -#ifndef NOFLOAT - for ( i = 0; i<20; i++ ) - a2[i] = a3[i] = a1[i]; - if ( a2[5] != 6.0 ) e(51); - if ( a2[13] != 14.0 ) e(52); - if ( a2[a1[a1[a1[a1[a1[0]]]]]] != 6.0 ) e(53); -#endif - if ( a1[12] != 13 ) e(54); -#ifndef NOFLOAT - if ( a1[ a1[12] = a2[a1[11]] ] != 14 ) e(55); - if ( fabs( a2[13] - a2[a1[12]] ) > epsf ) e(56); - if ( a2[8] != a1[8] ) e(57); -#endif -} - - - - -test9() /* local arrays */ -{ -#ifndef NOFLOAT - float epsf; - double epsd; - double fabs(); -#endif - int b1[20]; -#ifndef NOFLOAT - float b2[20]; - double b3[20]; -#endif - - t = 9; - tct++; -#ifndef NOFLOAT - epsf = EPSF; - epsd = EPSD; -#endif - for ( i=0; i<20 ; i++ ) - b1[i] = i*i; - if ( b1[9] != 81 || b1[17] != 289 || b1[0] != 0 ) e(1); - if ( b1[1] + b1[2] + b1[3] != 14 ) e(2); - if ( ! b1[15] ) e(3); - if ( b1[8] / b1[4] != 4 ) e(4); -#ifndef NOFLOAT - for ( i=0; i<20; i++ ) - b2[i] = 10.0e-1 + i/54.324e-1; - if ( fabs(b2[4]*b2[4]-b2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5); - if ( fabs(b2[8]/b2[8]*b2[9]/b2[9]-b2[10]+b2[10]-1.0 ) > epsf ) e(6); - if ( fabs(b2[5]-b2[4]-1/54.324e-1 ) > epsf ) e(7); - for ( i=0; i<20; i++) - b3[i]= 10.0e-1 + i/54.324e-1; - if ( fabs(b3[4]*b3[4]-b3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8); - if ( fabs( b3[8]*b3[9]/b3[8]/b3[9]-b3[10]+b3[10]-1000e-3) > epsd ) e(9); - if ( fabs(b3[8]+b3[6]-2*b3[7]) > epsd ) e(10); -#endif - for ( i=0; i<20; i++ ) - b1[i] = i+1; - if ( b1[b1[b1[b1[b1[b1[0]]]]]] != 6 ) e(11); - if ( b1[b1[0]+b1[1]+b1[2]+b1[3]] != 11 ) e(12); - if ( (b1[0] << 2) != 4 ) e(13); - if ( (b1[0] >> 2) ) e(14); - if ( (b1[0] << 3 >> 3) != b1[0] ) e(15); - if ( b1[b1[0] << 1] != 3 ) e(16); - if ( b1[4<<1] != 9 ) e(17); - if ( b1[4 << 1] != 9 ) e(18); - if ( (1 << b1[0]) != 2 ) e(19); - if ( (1 & b1[0]) != 1 ) e(20); - if ( b1[4]++ != 5 ) e(21); - if ( b1[4] != 6 ) e(22); - if ( --b1[4] != 5 ) e(23); - if ( b1[ --b1[10] ] != 10 ) e(24); - b1[0] = 0; - b1[1] = 1; - b1[2] = 2; - b1[3] = 3; - i = 3; - if ( b1[--i] != 2 ) e(25); - if ( b1[ b1[--i] ] != 1 ) e(26); - if ( b1[b1[b1[b1[b1[b1[b1[b1[3]]]]]]]] != 3 ) e(27); - if ( b1[1+2] != 3 ) e(28); - if ( b1[1+2] != b1[3/3] + 2 ) e(29); - if ( b1[i=2] != 2 ) e(30); - if ( -b1[i==3] ) e(31); - if ( b1[3*2 + b1[0]*6 - 10/2 -4 + 3/1] != 0 ) e(32); - if ( b1['a' + 'c' -2*'b'] ) e(33); - if ( b1[ b1[0]==b1[1] ] ) e(34); - if ( b1[b1[1<<1]>>1] != 1 ) e(35); - b1[i=j=4] = 10; - if ( (i!=4) || (j!=4) || (i!=j) ) e(36); - if ( b1[4] != 10 ) e(37); - if ( b1[--i] != 3 ) e(38); - if ( b1[i++] != 3 ) e(39); - if ( --b1[--i] != 2 ) e(40); - b1[b1[b1[b1[b1[0]=7]=5]=8]=2]=0; - if ( b1[0] != 7) e(41); - if ((b1[7] != 5) || (b1[5]!=8) || (b1[8]!=2))e(42); - if (b1[2]) e(43); - for ( i=0 ; i<20; i++) - b1[i] = i; - b1[0] = 0; - b1[1] = 01; - b1[2] = 02; - b1[3] = 04; - b1[4] = 010; - if ((b1[0] | b1[1] | b1[2] | b1[3] | b1[4]) != 017 ) e(44); - if ( b1[0]<<4 ) e(45); - if ( (b1[4]>>3) != 1 ) e(46); - b1[4] = 04; - b1[010] = 010; - if ( b1[8] != 8 ) e(47); - if ( b1[0|1|2|4|8] != (b1[0]|b1[1]|b1[2]|b1[4]|b1[8]) ) e(48); - if ( b1[b1[0]|b1[1]|b1[2]|b1[4]|b1[8]] != b1[017] ) e(49); - if ( b1[b1[1]^b1[2]^b1[4]^b1[8]] != b1[b1[1]|b1[2]|b1[4]|b1[8]] ) e(50); - for ( i = 0; i<20; i++ ) - b1[i] = i+1; -#ifndef NOFLOAT - for ( i = 0; i<20; i++ ) - b2[i] = b3[i] = b1[i]; - if ( b2[5] != 6.0 ) e(51); - if ( b2[13] != 14.0 ) e(52); - if ( b2[b1[b1[b1[b1[b1[0]]]]]] != 6.0 ) e(53); -#endif - if ( b1[12] != 13 ) e(54); -#ifndef NOFLOAT - if ( b1[ b1[12] = b2[b1[11]] ] != 14 ) e(55); - if ( fabs( b2[13] - b2[b1[12]] ) > epsf ) e(56); - if ( b2[8] != b1[8] ) e(57); -#endif -} - - - - -test10() /* global pointers */ -{ -#ifndef NOFLOAT - float epsf; - double fabs(); -#endif - int li; - struct tp2 strp2; - -#ifndef NOFLOAT - epsf = EPSF; -#endif - t = 10; - tct++; - p1 = &li; - li = 076; - if ( p1 != &li ) e(1); - p11 = &li; - if ( p1 != p11 ) e(3); - if ( *p1 != *p11 ) e(4); - if ( &li != p11 ) e(5); - if ( *&p1 != p1 ) e(6); - if ( &*p1 != p1 ) e(7); - if ( **&p1 != *&*p1 ) e(10); - if ( *&*&*&*&*&li != li ) e(11); - p1 = &p ; - p2 = &p1; - *p1 = **p2 = 34; - if ( p1 != *p2 ) e(25); - li = 4; - p1 = &li; - p2 = &p1; - p3 = &p2; - p4 = &p3; - p5 = &p4; - if ( *p1 != **p2 ) e(26); - if ( **p2 != **p2 ) e(27); - if ( ***p3 != **p2 ) e(28); - if ( *****p5 != 4 ) e(30); - li = 3; - if ( *p1 - *p1 ) e(44); - if ( p1 != &li ) e(46); - pp1 = (struct tp2 *) alloc( sizeof *pp1 ); - pp2 = (struct tp2 *) alloc( sizeof *pp2 ); - pp3 = (struct tp2 *) alloc( sizeof *pp3 ); - pp1->i = 1325; - if ( pp1->i != 1325 ) e(47); - pp1->i = pp2->i = pp3->i = 3; - if ( pp1->i * pp1->i != 9 ) e(48); - if ( pp1->i * pp2->i * pp3->i != pp2->i * 3 * 3 ) e(49); - if ( pp1->i - pp3->i ) e(50); - if ( (*pp1).i != pp1->i ) e(51); - pp1->i++; - if ( ++pp2->i != pp1->i ) e(52); - if ( pp2->i != 4 ) e(53); -#ifndef NOFLOAT - pp1->aaa = 3.0; - pp2->aaa = -3.0; - pp3->bbb = 25.0; - if ( pp1->aaa != 3.0 ) e(54); - if ( fabs( pp1->aaa + pp2->aaa ) > epsf ) e(55); - if ( fabs( pp1->aaa * pp2->aaa + pp3->bbb - 16 ) > epsf ) e(56); - if ( fabs( pp1->aaa / pp2->aaa + 1 ) > epsf ) e(57); -#endif - pp1->c1 = 'x'; - pp1->i = pp1->j = 45; -#ifndef NOFLOAT - pp1->aaa = 100.0; - pp1->bbb = 1024.0; -#endif - strp2.c1 = pp1->c1; /* strp2 is a local struct */ - strp2.i = pp1->i = strp2.j = pp1->j; -#ifndef NOFLOAT - strp2.aaa = pp1->aaa; - strp2.bbb = pp1->bbb; -#endif - if ( strp2.c1 != 'x' ) e(58); - if ( strp2.i != strp2.j ) e(59); -#ifndef NOFLOAT - if ( strp2.aaa != pp1->aaa ) e(60); - if ( strp2.bbb != pp1->bbb ) e(61); -#endif -} - -#ifndef NOFLOAT - -test11() /* real arithmetic */ -{ - double fabs(); - double epsd; - float epsf; - float locxf; - - t = 11 ; - tct++; - epsf = EPSF; - epsd = EPSD; - xf = 1.50; - yf = 3.00; - zf = 0.10; - xd = 1.50; - yd = 3.00; - zd = 0.10; - if ( fabs(1.0 + 1.0 - 2.0) > epsd ) e(1); - if ( fabs( 1e10-1e10 ) > epsd ) e(2); - if ( fabs( 1.0e+5 * 1.0e+5 - 100e+8 ) > epsd ) e(3); - if ( fabs( 10.0/3.0 * 3.0/10.0 - 100e-2 ) > epsd ) e(4); - if ( 0.0e0 != 0 ) e(5); - if ( fabs( 32767.0 - 32767 ) > epsd ) e(6); - if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7); - if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8); - if ( fabs(5.0*yf*zf-xf) > epsf ) e(9); - if ( fabs(5.0*yd*zd-xd) > epsd ) e(10); - if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11); - if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12); - if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsf ) e(13); - if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14); - xf = 1.10; - yf = 1.20; - if ( yd=yd ) e(18); - if ( yd epsd ) e(20); - if ( 1.0 * 3.0 != 3.0 * 1.0 ) e(21); - if ( 1.0 != 1e+0 ) e(22); - if ( 4.5 < 4.4 ) e(23); - if ( -3.4 != -3.4 ) e(24); - if ( 10/3.0 - 10/3.0 != 0.0 ) e(25); - if ( fabs( (1<<0) * (-5.3) + 5.3 ) > epsd ) e(26); - if ( fabs( (1<<3) * 5.0 - 4e+1 ) > epsd ) e(27); - if ( fabs( ((1<<5)>>5) - 1e-0 ) > epsd ) e(28); - if ( fabs ( 00000 * 3.0 ) > epsd ) e(29); - if ( fabs ( 8 * 5.0 - 02 * 02 + 04 / 1.0 -40.0 ) > epsd ) e(30); - if ( fabs ( 'a' / 1.0 - 'a' ) > epsd ) e(31); - if ( fabs ( (!1) * ( 2.0 / -34e-1 ) ) > epsd ) e(32); - if ( fabs ( (01 | 1 | 2) * 4.0 - 12.0 ) > epsd ) e(33); - if ( fabs ( 1.0 * 2.0 * 3.0 * 4.0 * 5.0 - 120.0 ) > epsd ) e(34); - if ( fabs ( 1.0 * 2.0 * (1 | (4>>1)) - 6 ) > epsd ) e(35); - if ( fabs ( ( 0 ^ 0 ^ 0 ^ 0 ) * 0.0 ) > epsd ) e(36); - if ( fabs ( 1.0 * 2.0 * (1 ^ (4>>1)) - 6 ) > epsd ) e(37); - if ( fabs ( (((((-1.0 * (((((-1.0))))) - 1.0 ))))) ) > epsd) e(38); - if ( fabs ( ( 2==3 ) * 3.0 ) > epsd ) e(39); - if ( ( 4 + 3 > 5 ? 3.4 : -5e+3 ) != 3.4 ) e(40); - if ( ( -4 -'a' > 0 ? 3.4 : -5e+3 ) != -5e+3 ) e(41); - locxf = 3.0; - xf = 3.0; - if ( locxf != locxf ) e(42); - if ( locxf != xf ) e(43); - if ( locxf * xf != xf * locxf ) e(44); - if ( fabs ( ((2*3)>>1) / 3.0 - 1.0 ) > epsd ) e(45); - if ( fabs ( 'a' / locxf - 'a' / xf ) > epsd ) e(46); - if ( fabs( xf * locxf - 9.0 ) > epsd ) e(47); - yd = 3.0; - if ( fabs( xf*yd - 9.0) > epsd ) e(48); - if ( yd >= 4 ) e(49); - if ( locxf == 2 ) e(50); -} - -#endif diff --git a/ir/be/test/ack/test1.c b/ir/be/test/ack/test1.c deleted file mode 100644 index 0040db529..000000000 --- a/ir/be/test/ack/test1.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ -#include -#include - -char rcs_id[] = "$Id$" ; - -/* This program can be used to test C-compilers */ - -int i,j,k,l,m,ect,pct,t,*p1; -int a1[20]; -#ifndef NOFLOAT -float a2[20],xf,yf,zf; -double a3[20],xd,yd,zd; -#endif - -char alstr[3000] ; -char *alptr = alstr ; - -struct tp2 -{ char c1; - int i,j; -#ifndef NOFLOAT - float aaa; - double bbb; -#endif -} r1,r2,*p3; - -struct node -{ int val; - struct node *next; -} *head,*tail,*p2; - -main() -{ ect = 0; pct = 0; - test1();test2();test3(); - test4();test5(); - test6();test7();test8(); - test9();test10(); -#ifndef NOFLOAT - test11(); -#endif - printf("program test1\n"); - printf("%d tests completed. Number of errors = %d\n",pct,ect); - return 0 ; -} - -char *alloc(size) { - register char *retval ; - - retval=alptr ; - alptr += size ; - if ( alptr-alstr>sizeof alstr ) { - printf("allocation overflow\n") ; - exit(8) ; - } - return(retval) ; -} - -int abs(a) int a ; { return ( a<0 ? -a : a) ; } -#ifndef NOFLOAT -double fabs(a) double a ; { return( a<0 ? -a : a) ; } -#endif - -e(n) -{ ect++; printf("error %d in test %d \n",n,t); -} - -inc(n) -{ return(++n);} - -/***********************************************************************/ - -test1() -/*arithmetic on constants */ -{ t = 1; pct++; - if (1+1 != 2) e(1); - if (3333 + 258 != 3591) e(2); - if (3*4 != 12) e(3); - if (111*111 != 12321) e(4); - if (50 / 5 != 10) e(5); - if (7498 / 75 != 99) e(6); - if (456 - 345 != 111) e(7); - if (1+(-2) != -1) e(8); - if (-3 * -4 != 12) e(9); - if (-2 / 2 != -1) e(10); - if (-5 / 1 != -5 ) e(11); - if (-4 - -5 != 1) e(12); - if ( 03 + 02 != 05) e(13); - if ( 03456 + 88 != 03606 ) e(14); - if ( 0100 * 23 != 02700 ) e(15); - if ( 045 / 020 != 2) e(16); - if (0472 - 0377 != 073 ) e(17); - if ('a' + 3 != 100) e(18); - if ('a' + 'c' != 'b' + 'b') e(19); - if ( 'z' * 'z' != 14884 ) e(20); - if ( -'z' / 01 != -'z' ) e(21); - if ( 077777 >> 3 != 07777 ) e(22); - if ( 077777 >> 15 ) e(23); - if ( 234 << 6 != 234 << 6 ) e(24); - if ( 0124 & 07765 != 0124 ) e(25); - if ( 34 & 31 != 2 ) e(26); - if ( ( -4 | 3 ) != -1 ) e(27); - if ( ( 5 | 013 | 020 ) != 31 ) e(28); - if ( ( -7 ^ 3 ) != -6 ) e(29); - if ( ( 07373 ^ 4632 ) != 016343 ) e(30); - if ( (1+2+3)*(2+3+4)*(3+5+5) / 2 != ((3*((5+3+2)*10)+51)*6)/6 ) e(31); - if ( (1000*2+5*7+13)/ 8 != 2*2*2*2*4*4 ) e(32); - if ((1*2*3*4*5*6*7 / 5040 != - 5040 / 7 / 6 / 5 / 4 / 3 / 2 / 1 )) e(33); - if ( -(-(-(-(-(-(1)))))) != 1 ) e(34); - if (- 1 != -((((((((((1)))))))))) ) e(35); - if ( -1-1-1-1-1-1 != -6-3+3 ) e(36); - if ( -4 * -5 != 20 ) e(37); - if ( 2<1 ) e(38); - if ( 2<= 1 ) e(39); - if ( 2==3 ) e(40); - if ( 2 != 2 ) e(41); - if ( 2 >= 3) e(42); - if ( 2 > 3 ) e(43); - if (2 + 0 != 2 ) e(44); - if (2 - 0 != 2 ) e(45); - if (2 * 0 != 0 ) e(46); - if ( 0 / 1 != 0 ) e(47); - if ( -0 != 0 ) e(48); - if ( 0 * 0 != 0 ) e(49); - if ( 32767 > 32767 ) e(50); - if ( 0456 < 0400 ) e(51); - if ( 0456 != ( 0400 | 050 | 06 ) ) e(52); - if ( 2*2<<2*2/4 != 010 ) e(53); - if ( 0 || 0 ) e(54); - if ( 1 && 0 ) e(55); - if ( ( 123 ? 123 * 4 :345) != 492 ) e(56); - if ( ( 0 ? 345 : 280) != 280 ) e(57); - if ( ( (2*2/2<<2)|(2/2) ) != 9 ) e(58); - if ( !( 111 || 23 && 0 ) ) e(59); - if ( !1 ) e(60); - if ( !0 == 0 ) e(61); - if ( !!!!!!!!0 ) e(62); -} - -/***********************************************************************/ - -test2() -/*arithmetic on global integer variables*/ -{ t = 2; pct++; - i = 1; j = 2; k = 3; l = 4; m = 10; - if ( i+j != k ) e(1); - if ( i+k != l ) e(2); - if ( j-k != -i ) e(3); - if ( j*(j + k) != m ) e(4); - if ( -m != -(k+k+l) ) e(5); - if ( i / i != 1 ) e(6); - if ( m*m / m != m ) e(7); - if ( 10 * m != 100 ) e(8); - if ( m * (-10) != -100 ) e(9); - if ( j / k != 0 ) e(10); - if ( 100 / k != 33 ) e(11); - if ( i+j*k+l+m / j + 50 / k != 32 ) e(12); - if ( j*k*m / 6 != 10 ) e(13); - if ( (k>4) || (k>=4) || (k==4) ) e(14); - if ( (m j ) e(19); - if ( (i > j ? k : k*j ) != 6 ) e(20); - if ( (i < j ? k : k*j ) != 3 ) e(21); - if ( j<> i != i ) e(25); - if ( i++ != 1 ) e(26); - if ( --i != 1 ) e(27); - if ( i-- != 1 ) e(28); - if ( ( i+j ) && ( i<0 ) || (m-10) && (064) ) e(29); - if ( ( i+j ) && !(i>=0) || (m-10) && !( 0 ) ) e(30); -} - -/***********************************************************************/ - -test3() -/*arithmetic on local integer variables*/ -{ int a,b,c,d,f; - t = 3; pct++; - a = 1; b = 2; c = 3; d = 4; f = 10; - if ( a+b != c ) e(1); - if ( a+c != d ) e(2); - if ( b-c != -a ) e(3); - if ( b*(b + c) != f ) e(4); - if ( -f != -(c+c+d) ) e(5); - if ( a / a != 1 ) e(6); - if ( f*f / f != f ) e(7); - if ( 10 * f != 100 ) e(8); - if ( f * (-10) != -100 ) e(9); - if ( b / c != 0 ) e(10); - if ( 100 / c != 33 ) e(11); - if ( a+b*c+d+f / b + 50 / c != 32 ) e(12); - if ( b*c*f / 6 != 10 ) e(13); - if ( (c>4) || (c>=4) || (c==4) ) e(14); - if ( (f b ) e(19); - if ( (a > b ? c : c*b ) != 6 ) e(20); - if ( (a < b ? c : c*b ) != 3 ) e(21); - if ( b<> a != a ) e(25); - if ( a++ != 1 ) e(26); - if ( --a != 1 ) e(27); - if ( a-- != 1 ) e(28); - if ( ( a+b ) && ( a<0 ) || (f-10) && (064) ) e(29); - if ( ( a+b ) && !(a>=0) || (f-10) && !( 0 ) ) e(30); -} - -/***********************************************************************/ - -test4() -/* global arrays */ -{ -#ifndef NOFLOAT - float epsf; - double epsd; -#endif - t=4; pct++; -#ifndef NOFLOAT - epsf = 1e-7; epsd = 1e-14; -#endif - for ( i=0; i<20 ; i++ ) a1[i] = i*i; - if ( a1[9] != 81 || a1[17] != 289 || a1[0] != 0 ) e(1); - if ( a1[1] + a1[2] + a1[3] != 14 ) e(2); - if ( ! a1[15] ) e(3); - if ( a1[8] / a1[4] != 4 ) e(4); -#ifndef NOFLOAT - for ( i=0; i<20; i++ ) a2[i] = 10.0e-1 + i/54.324e-1; - if ( fabs(a2[4]*a2[4]-a2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5); - if ( fabs(a2[8]/a2[8]*a2[9]/a2[9]-a2[10]+a2[10]-1.0 ) > epsf ) e(6); - if ( fabs(a2[5]-a2[4]-1/54.324e-1 ) > epsf ) e(7); - for ( i=0; i<20; i++ ) a3[i]= 10.0e-1 + i/54.324e-1; - if ( fabs(a3[4]*a3[4]-a3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8); - if ( fabs( a3[8]*a3[9]/a3[8]/a3[9]-a3[10]+a3[10]-1000e-3) > epsd ) e(9); - if ( fabs(a3[8]+a3[6]-2*a3[7]) > epsd ) e(10); -#endif -} - -/****************************************************************/ - -test5() -/* local arrays */ -{ int b1[20]; -#ifndef NOFLOAT - float epsf, b2[20]; double b3[20],epsd; - epsf = 1e-7; epsd = 1e-14; -#endif - t = 5; pct++; - for ( i=0; i<20 ; i++ ) b1[i] = i*i; - if ( b1[9]-b1[8] != 17 ) e(1); - if ( b1[3] + b1[4] != b1[5] ) e(2); - if ( b1[1] != 1||b1[3] != 9 || b1[5] != 25 || b1[7] != 49 ) e(3); - if ( b1[12] / b1[6] != 4 ) e(4); -#ifndef NOFLOAT - for ( i=0; i<20; i += 1) b2[i] = 10.0e-1+i/54.324e-1; - if (fabs(b2[4]*b2[4]-b2[4]*(10.0e-1+4/54.324e-1)) > epsf ) e(5); - if (fabs(b2[8]/b2[8]*b2[9]/b2[9]-b2[10]+b2[10]-1.0) > epsf ) e(6); - if ( fabs(b2[5]-b2[4]-1/5.4324 ) > epsf ) e(7); - for ( i=0; i<20 ; i += 1 ) b3[i] = 10.0e-1+i/54.324e-1; - if (fabs(b3[4]*b3[4]-b3[4]*(10.0e-1+4/54.324e-1)) > epsd ) e(8); - if (fabs(b3[8]*b3[9]/b3[8]/b3[9]+b3[10]-b3[10]-1.0) > epsd ) e(9); - if (fabs(b3[10]+b3[18]-2*b3[14]) > epsd ) e(10); -#endif -} - - -/****************************************************************/ - - - -test6() -/* mixed local and global */ -{ int li,b1[20]; -#ifndef NOFLOAT - double b3[10],xxd,epsd; -#endif - t = 6; pct++; -#ifndef NOFLOAT - epsd = 1e-14; -#endif - li = 6; i = li ; - if ( i != 6 ) e(1); - i = 6; li = i; - if ( i != li ) e(2); - if ( i % li ) e(3); - i=li=i=li=i=li=i=i=i=li=j; - if ( i != li || i != j ) e(4); - for ( i=li=0; i<20 ; i=li ) { b1[li]= (li+1)*(i+1) ; li++; } - if ( b1[9] != a1[10] ) e(5); - if ( b1[7]/a1[4] != a1[2] ) e(6); - li = i = 121; - if ( b1[10] != i && a1[11]!= li ) e(7); -#ifndef NOFLOAT - for ( li=0 ; li<10; li++ ) b3[li]= 1.0e0 + li/54.324e-1; - if ( fabs(b3[9]-a3[9]) > epsd ) e(8); - if ( fabs(8/54.324e-1 - b3[9]+a3[1] ) > epsd ) e(9); -#endif -} - -/***************************************************************/ - - -test7() -/*global records */ -{ t=7; pct++; - r1.c1= 'x';r1.i=40;r1.j=50; -#ifndef NOFLOAT - r1.aaa=3.0;r1.bbb=4.0; -#endif - r2.c1=r1.c1; - r2.i= 50; - r2.j=40; -#ifndef NOFLOAT - r2.aaa=4.0;r2.bbb=5.0; -#endif - if (r1.c1 != 'x' || r1.i != 40 ) e(1); -#ifndef NOFLOAT - if ( r1.aaa != 3.0 ) e(1); -#endif - i = 25;j=75; - if (r1.i != 40 || r2.i != 50 ) e(2); - if ( r2.j != 40 || r1.j != 50 ) e(3); - if ( (r1.c1 + r2.c1)/2 != 'x' ) e(4); -#ifndef NOFLOAT - if ( r1.aaa*r1.aaa+r2.aaa*r2.aaa != r2.bbb*r2.bbb) e(5); -#endif - r1.i = 34; if ( i!=25 ) e(6); -} - - -/****************************************************************/ - - -test8() -/*local records */ -{ struct tp2 s1,s2; - t=8; pct++; - s1.c1= 'x';s1.i=40;s1.j=50; -#ifndef NOFLOAT - s1.aaa=3.0;s1.bbb=4.0; -#endif - s2.c1=s1.c1; - s2.i= 50; - s2.j=40; -#ifndef NOFLOAT - s2.aaa=4.0;s2.bbb=5.0; -#endif - if (s1.c1 != 'x' || s1.i != 40 ) e(1); -#ifndef NOFLOAT - if ( s1.aaa != 3.0 ) e(1); -#endif - i = 25;j=75; - if (s1.i != 40 || s2.i != 50 ) e(2); - if ( s2.j != 40 || s1.j != 50 ) e(3); - if ( (s1.c1 + s2.c1)/2 != 'x' ) e(4); -#ifndef NOFLOAT - if ( s1.aaa*s1.aaa+s2.aaa*s2.aaa != s2.bbb*s2.bbb) e(5); -#endif - s1.i = 34; if ( i!=25 ) e(6); -} - - - -/***********************************************************************/ -test9() -/*global pointers */ -{ t=9; pct++; - p1=alloc( sizeof *p1 ); - p2=alloc( sizeof *p2); - p3=alloc(sizeof *p3); - *p1 = 1066; - if ( *p1 != 1066 ) e(1); - p3->i = 1215; - if ( p3->i != 1215 ) e(2); - p2->val = 1566; - if ( p2->val != 1566 || p2->next ) e(3); - if ( a1 != &a1[0] ) e(4); - p1 = a1; - if ( ++p1 != &a1[1] ) e(5); - head = 0; - for (i=0;i<=100;i += 1) - { tail = alloc(sizeof *p2); - tail->val = 100+i;tail->next = head; - head = tail; - } - if ( tail->val != 200 || tail->next->val != 199 ) e(6); - if ( tail->next->next->next->next->next->val != 195) e(7); - tail->next->next->next->next->next->val = 1; - if ( tail->next->next->next->next->next->val != 1) e(8); - i = 27; - if ( *&i != 27 ) e(9); - if ( &*&*&*&i != &i ) e(10); - p1 = &i;i++; - if ( p1 != &i ) e(11); -} - -/*****************************************************************/ -test10() -/*local pointers */ -{ struct tp2 *pp3; - struct node *pp2,*ingang,*uitgang; - int *pp1; - int b1[20]; - t=10; pct++; - pp1=alloc( sizeof *pp1 ); - pp2=alloc( sizeof *p2); - pp3=alloc(sizeof *pp3); - *pp1 = 1066; - if ( *pp1 != 1066 ) e(1); - pp3->i = 1215; - if ( pp3->i != 1215 ) e(2); - pp2->val = 1566; - if ( pp2->val != 1566 || p2->next ) e(3); - if ( b1 != &b1[0] ) e(4); - pp1 = b1; - if ( ++pp1 != &b1[1] ) e(5); - ingang = 0; - for (i=0;i<=100;i += 1) - { uitgang = alloc(sizeof *pp2); - uitgang->val = 100+i;uitgang->next = ingang; - ingang = uitgang; - } - if ( uitgang->val != 200 || uitgang->next->val != 199 ) e(6); - if ( uitgang->next->next->next->next->next->val != 195 ) e(7); - uitgang->next->next->next->next->next->val = 1; - if ( uitgang->next->next->next->next->next->val != 1) e(8); -} - -/***************************************************************/ - -#ifndef NOFLOAT -test11() -/* real arithmetic */ -{ - double epsd; float epsf; - t = 11; pct++; epsf = 1e-6; epsd = 1e-14; - xf = 1.50 ; yf = 3.00 ; zf = 0.10; - xd = 1.50 ; yd = 3.00 ; zd = 0.10; - if ( fabs(1.0 + 1.0 - 2.0 ) > epsd ) e(1); - if ( fabs( 1e10-1e10 ) > epsd ) e(2); - if ( fabs( 1.0e+5*1.0e+5-100e+8 ) > epsd ) e(3); - if ( fabs( 10.0/3.0*3.0/10.0-100e-2 ) > epsd ) e(4); - if ( 0.0e0 != 0 ) e(5); - if ( fabs( 32767.0 - 32767 ) > epsd ) e(6); - if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7); - if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8); - if ( fabs(5.0*yf*zf-xf) > epsf ) e(9); - if ( fabs(5.0*yd*zd-xd) > epsd ) e(10); - if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11); - if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12); - if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsd ) e(13); - if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14); - xf=1.10;yf=1.20; - if ( yd=yd ) e(18); - if ( yd epsd ) e(20); -} -#endif - - -/*****************************************************************/ diff --git a/ir/be/test/ack/test2.c b/ir/be/test/ack/test2.c deleted file mode 100644 index dc496699b..000000000 --- a/ir/be/test/ack/test2.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - * - */ - -char rcs_id[] = "$Id$" ; - -/* This program can be used to test C-compilers */ - - -int t, ect, tct; - - -/**********************************************************************/ -/* - * Testing basic function calls - * - */ - - - -main() -{ - tct = 0; - ect = 0; - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - printf("End of test program, %d tests completed, %d errors detected\n", - tct,ect); - return 0 ; -} - - - - -e(n) -int n; -{ - ect++; - printf("Error %d in test%d \n",n,t); -} - - - - -one() -{ - return(1); -} - - - - -two() -{ - return(2); -} - - - - -three() -{ - return(3); -} - - - - -four() -{ - return(4); -} - - - - -five() -{ - return(5); -} - - - - -plus() -{ - return ( one() + two() + three() + four() + five() ); -} - - - - -multipl() -{ - return( one() * two() * three() * four() * five() ); -} - - - - -subtr() -{ - return( - one() - two() - three() - four() - five() ); -} - - - - -test1() -{ - int i; - int count; - - t = 1; - tct++; - if ( one() != 1 ) e(1); - if ( two() != 2 ) e(2); - if ( three() != 3 ) e(3); - if ( four() != 4 ) e(4); - if ( five() != 5 ) e(5); - if ( (one() + two()) != 3 ) e(6); - if ( ((((((one() + two())))))) != 3) e(7); - if ( (one() * three()) != 3) e(8); - if (( (four() + three()) * two()) != 14) e(9); - if ( (four() + four()) != (two() * four()) ) e(10); - if ( (four() - four()) / three() ) e(11); - if (( four() + 3 * 12 - ( one() * two() * 2 ) ) != 36 ) e(12); - if ( one() & two() & four() & three() ) e(13); - if ( !( three() && two() ) ) e(14); - for (i=0; i<8; i++) - { - count = one() + two() + three() + four(); - count = count * one(); - count = count * two() - one() - two() - three() - four(); - } - if (count != 10) e(15); - if ( !one() ) e(16); - if ( plus() != 15 ) e(17); - if ( multipl() != 120 ) e(18); - if ( subtr() != -15 ) e(19); - if ( -subtr() != plus() ) e(18); - if ( -subtr() != plus() ) e(21); -} - - - - -echo(a) -int a; -{ - return ( a ); -} - - - - -min(a,b) -int a,b; -{ - if ( a < b ) - return(a); - return(b); -} - - - - -max1(a,b) -int a,b; -{ - if ( a < b ) - return(b); - return(a); -} - - - - -max2(a,b) -int a,b; -{ - return ( ( a < b ? b : a ) ); -} - - - - -test2() -{ - int i,j; - int a,b; - - t = 2; - tct++; - if ( echo(1) != 1 ) e(1); - if ( echo(3) != 3 ) e(2); - if ( echo(0) ) e(3); - if ( echo(2) + echo(3) != echo(5) ) e(4); - if ( echo( 2 + 3 ) != 5 ) e(5); - if ( echo ( 1 + 2 + 3 + 4 + 5 ) != 10 + echo(5) ) e(6); - if (( echo( 2<<1 ) ) != 4 ) e(7); - if ( echo( 2 >> 1 ) != 1 ) e(8); - if ( echo( 1 << 4 ) != echo( 2 << 3 ) ) e(9); - if ( echo( echo(4) ) != echo(4) ) e(10); - if (( echo ( echo ( echo( echo ( echo ( 3 ) ) ) ) ) ) != 3 ) e(11); - if ( echo( echo( echo(2+3-4+echo(4)*echo(2))) ) != 9 ) e(12); - if ( min(1,2) != 1) e(13); - if (min(0,45) != 0) e(14); - if (min(45,0) != 0) e(15); - if (min(-72,-100) != -100) e(16); - if (min(-100,-72) != -100) e(17); - if (min(1<<3,2<<3) != (1<<3) ) e(18); - if ( min( echo(3), echo(3) ) != echo (echo(3)) ) e(19); - if ( max1('a','b') != 'b' ) e(20); - if ( max1('b','a') != 'b' ) e(21); - if ( max1(-3,54+2) != ( -3 < 54+2 ? 54+2 : -3 ) ) e(22); - if (max1('a'+'b'+34,'a'*2) != max2('a'*2,'a'+'b'+34)) e(23); - if (max1(345/23,4) != max1( echo(345/23), 4) ) e(24); - if ( max1( max1(2,3), max1(2,3) ) != max1(2,3) ) e(25); - for (i=3; i<5; i++) - if ((max1(i,-i)) != i) e(26); - for (j=min('a',34); jmax1(min(34,'a'),max2(34,'a')) ) e(28); - } - a=b= -32768; - if ( min(echo(a),a) != a) e(29); - if ( max1(echo(b),max1(b,b)) != b) e(30); -} - - - - -sum(k) -int k; -{ - if (k<=0) - return(0); - return(k+sum(k-1)); -} - - - - -formula(k) -int k; -{ - if (k<=0) - return(0); - return ( ((((( (k*(k+1))/2 ))))) ); -} - - - - -test3() -{ - int k; - int count; - - t = 3; - tct++; - count=0; - if ( sum(-4) != 0 ) e(1); - if ( sum(0) != 0 ) e(2); - if ( sum(2) != 3 ) e(3); - if ( sum(10) != 55 ) e(4); - if ( sum(34) != formula(34) ) e(5); - if ( sum(101) != formula(101) ) e(6); - if ( sum( sum(11) ) != formula( formula(11) ) ) e(7); - if ( sum( sum(11) ) != formula( sum(11) ) ) e(8); - if ( sum( sum( sum(4) )) != sum ( formula ( sum( 4) )) ) e(9); - for (k = sum(-45); k - -int hallo() -{ - int i = 0; - int j = 2; - - i = add(i, j, i, j); - - return i; -} - -int add(int i, int j, int k, int l) -{ - return i + j + k +l; -} - -int main() { - printf("%d\n", hallo()); - return 0; -} diff --git a/ir/be/test/add64.c b/ir/be/test/add64.c deleted file mode 100644 index 593fac45a..000000000 --- a/ir/be/test/add64.c +++ /dev/null @@ -1,15 +0,0 @@ -long long k; -long long k2; - -void f(long long a, long long b) -{ - long long c = (a & 0xffffffffLL) | 0x100000000LL; - k = c + b; - k2 = a + b; -} - -int main(int argc, char **argv) { - f(0x100000000LL, 0x100000000LL); - printf("Res: %llx %llx\n", k, k2); - return 0; -} diff --git a/ir/be/test/addn.c b/ir/be/test/addn.c deleted file mode 100644 index c355c8889..000000000 --- a/ir/be/test/addn.c +++ /dev/null @@ -1,8 +0,0 @@ -int x = 1; - -int main() { - int a = x + x + x + x; - - printf("A = %d\n", a); - return 0; -} diff --git a/ir/be/test/addr_test.c b/ir/be/test/addr_test.c deleted file mode 100644 index 59946b610..000000000 --- a/ir/be/test/addr_test.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int blubber(int a, int b, int c, int d) { - int *x = &a; - int *y = &b; - - *x = c; - *y = d; - - return a * b; -} - -int main(void) { - printf("Result: %d\n", blubber(2, 3, 22, 33)); - return 0; -} diff --git a/ir/be/test/after_compile.sh.example b/ir/be/test/after_compile.sh.example deleted file mode 100644 index 232dae374..000000000 --- a/ir/be/test/after_compile.sh.example +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# move results over to public_html dir -rm -rf "$HOME/public_html/$1" -mv "$1" "$HOME/public_html" -fs setacl "$HOME/public_html/$1" system:anyuser rl diff --git a/ir/be/test/alloca.c b/ir/be/test/alloca.c deleted file mode 100644 index 54ff02509..000000000 --- a/ir/be/test/alloca.c +++ /dev/null @@ -1,39 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#endif - -#include - -struct x { - int a, b; -}; - -static void t(struct x *p) -{ - printf("%d\n", p->a + p->b); -} - -static void t2() -{ - char *mem; - - printf("hallo\n"); - mem = alloca(23); - - printf("%.0s", mem); -} - -int main(int argc, char *argv[]) -{ - struct x *p = alloca(sizeof(*p)); - - p->a = argc; - p->b = 3; - - t(p); - t2(); - - return 0; -} diff --git a/ir/be/test/am_explode.c b/ir/be/test/am_explode.c deleted file mode 100644 index 1d950bec4..000000000 --- a/ir/be/test/am_explode.c +++ /dev/null @@ -1,43 +0,0 @@ -int a = 42; -int array[32]; -int b = 990100; - -int main(void) -{ - int c = a+b; - - array[0] = c + 1; - array[1] = c + 2; - array[2] = c + 3; - array[3] = c + 4; - array[4] = c + 5; - array[5] = c + 6; - array[6] = c + 7; - array[7] = c + 8; - array[8] = c + 9; - array[9] = c + 10; - array[10] = c + 11; - array[11] = c + 12; - array[12] = c + 13; - array[13] = c + 14; - array[14] = c + 15; - array[15] = c + 16; - array[16] = c + 17; - array[17] = c + 18; - array[18] = c + 19; - array[29] = c + 20; - array[20] = c + 21; - array[21] = c + 22; - array[22] = c + 23; - array[23] = c + 24; - array[24] = c + 25; - array[25] = c + 26; - array[26] = c + 27; - array[27] = c + 28; - array[28] = c + 29; - array[29] = c + 30; - array[30] = c + 31; - array[31] = c + 32; - - return array[10] - a - b - 11; -} diff --git a/ir/be/test/am_possibilities.c b/ir/be/test/am_possibilities.c deleted file mode 100644 index 5118e7483..000000000 --- a/ir/be/test/am_possibilities.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - B - base - IN - index - IS - index (shifted) - C - const - SC - symconst - - # | B | I | IS | C | SC | note - -------+-------+-------+-------+-------+-------+------------------------------- - 00 | | | | | | senseless - 01 | | | | | x | - 02 | | | | x | | senseless ? - 03 | | | | x | x | - 04 | | | x | | | missing base ? - 05 | | | x | | x | missing base ? - 06 | | | x | x | | missing base ? - 07 | | | x | x | x | missing base ? - 08 | | x | | | | missing base - 09 | | x | | | x | missing base - 10 | | x | | x | | missing base - 11 | | x | | x | x | missing base - 12 | | x | x | | | impossible - 13 | | x | x | | x | impossible - 14 | | x | x | x | | impossible - 15 | | x | x | x | x | impossible - 16 | x | | | | | - 17 | x | | | | x | - 18 | x | | | x | | - 19 | x | | | x | x | - 20 | x | | x | | | - 21 | x | | x | | x | - 22 | x | | x | x | | - 23 | x | | x | x | x | - 24 | x | x | | | | - 25 | x | x | | | x | - 26 | x | x | | x | | - 27 | x | x | | x | x | - 28 | x | x | x | | | impossible - 29 | x | x | x | | x | impossible - 30 | x | x | x | x | | impossible - 31 | x | x | x | x | x | impossible - */ - -char sc[100]; -char* sc_pointers[100]; -char c; - -int main(int argc, char **argv) -{ - return 0; -} - -/* Source address modes */ - -void load_01(void) -{ - c = sc[0]; -} - -void load_03(void) -{ - c = sc[1]; -} - -void load_16(char* base) -{ - c = base[0]; -} - -void load_17(int base) -{ - c = sc[base]; -} - -void load_18(char* base) -{ - c = base[1]; -} - -void load_19(int base) -{ - c = sc[base + 1]; -} - -void load_20_add(char* base, int index) -{ - c = base[2 * index]; -} - -void load_20_shift(char* base, int index) -{ - c = base[4 * index]; -} - -void load_21_add(int base, int index) -{ - c = sc[base + 2 * index]; -} - -void load_21_shift(int base, int index) -{ - c = sc[base + 4 * index]; -} - -void load_22_add(char* base, int index) -{ - c = base[2 * index + 1]; -} - -void load_22_shift(char* base, int index) -{ - c = base[4 * index + 1]; -} - -void load_23_add(int base, int index) -{ - c = sc[base + 2 * index + 1]; -} - -void load_23_shift(int base, int index) -{ - c = sc[base + 4 * index + 1]; -} - -void load_24(char* base, int index) -{ - c = base[index]; -} - -void load_25(int base, int index) -{ - c = sc[base + index]; -} - -void load_26(char* base, int index) -{ - c = base[index + 1]; -} - -void load_27(int base, int index) -{ - c = sc[base + index + 1]; -} - -/* Destination address modes */ - -void store_immediate_01(void) -{ - sc_pointers[0] = sc + 42; -} - -void store_immediate_03(void) -{ - sc_pointers[1] = sc + 42; -} - -void store_immediate_16(char** base) -{ - base[0] = sc + 42; -} - -void store_immediate_17(int base) -{ - sc_pointers[base] = sc + 42; -} - -void store_immediate_18(char** base) -{ - base[1] = sc + 42; -} - -void store_immediate_19(int base) -{ - sc_pointers[base + 1] = sc + 42; -} - -void store_immediate_20_add(char** base, int index) -{ - base[2 * index] = sc + 42; -} - -void store_immediate_20_shift(char** base, int index) -{ - base[4 * index] = sc + 42; -} - -void store_immediate_21_add(int base, int index) -{ - sc_pointers[base + 2 * index] = sc + 42; -} - -void store_immediate_21_shift(int base, int index) -{ - sc_pointers[base + 4 * index] = sc + 42; -} - -void store_immediate_22_add(char** base, int index) -{ - base[2 * index + 1] = sc + 42; -} - -void store_immediate_22_shift(char** base, int index) -{ - base[4 * index + 1] = sc + 42; -} - -void store_immediate_23_add(int base, int index) -{ - sc_pointers[base + 2 * index + 1] = sc + 42; -} - -void store_immediate_23_shift(int base, int index) -{ - sc_pointers[base + 4 * index + 1] = sc + 42; -} - -void store_immediate_24(char** base, int index) -{ - base[index] = sc + 42; -} - -void store_immediate_25(int base, int index) -{ - sc_pointers[base + index] = sc + 42; -} - -void store_immediate_26(char** base, int index) -{ - base[index + 1] = sc + 42; -} - -void store_immediate_27(int base, int index) -{ - sc_pointers[base + index + 1] = sc + 42; -} diff --git a/ir/be/test/am_test.c b/ir/be/test/am_test.c deleted file mode 100644 index fb9ac0375..000000000 --- a/ir/be/test/am_test.c +++ /dev/null @@ -1,61 +0,0 @@ -/*$ -fno-inline $*/ - -#include - -int val; - -#define TTYPE(name,type,OP) \ - type test_##name##type(void) { return val OP 7; } \ - type test2_##name##type(type v) { return val OP v; } \ - type testp_##name##type(void) { return 7 OP val; } \ - type testp2_##name##type(type v) { return v OP val; } - -int test_cmp_testset(int v, int v2) { return (v & 14) > 0; } - -#define T(name,OP) \ - TTYPE(name,int,OP) \ - TTYPE(name,short,OP) \ - TTYPE(name,char,OP) - -T(add,+) -T(sub,-) -T(or,|) -T(and,&) -T(xor,^) -T(cmp,<) -T(shl,<<) -T(shr,>>) - -#undef T -#undef TTYPE - -int main(void) { - int res1, res2, res3, res4; - val = 11; - -#define TTYPE(name,type,OP) \ - res1 = test_##name##type(); \ - res2 = test2_##name##type(20); \ - res3 = testp_##name##type(); \ - res4 = testp2_##name##type(20); \ - printf("Test %s: %d (should be %d)\n", #name, res1, (type) 11 OP (type) 7); \ - printf("Test2 %s: %d (should be %d)\n", #name, res2, (type) 11 OP (type)20); \ - printf("Testp %s: %d (should be %d)\n", #name, res3, (type) 7 OP (type)11); \ - printf("Testp2 %s: %d (should be %d)\n", #name, res4, (type) 20 OP (type)11); - -#define T(name,OP) \ - TTYPE(name,int,OP) \ - TTYPE(name,short,OP) \ - TTYPE(name,char,OP) - - T(add,+) - T(sub,-) - T(or,|) - T(and,&) - T(xor,^) - T(cmp,<) - T(shl,<<) - T(shr,>>) - - return 0; -} diff --git a/ir/be/test/am_test2.c b/ir/be/test/am_test2.c deleted file mode 100644 index fb1534fcf..000000000 --- a/ir/be/test/am_test2.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - -int sum(int from, int to) { - int i, res = 0, res2 = 666; - int len = to - from; - - for(i = 0; i < len; ++i) { - res += arr[from + i]; - res2 -= arr[i]; - } - - return res ^ res2; -} - -int main(int argc, char **argv) { - int from = 0; - int to = 10; - if(argc > 1) - to = atoi(argv[1]); - - printf("Res: %d\n", sum(from, to)); - return 0; -} diff --git a/ir/be/test/am_test3.c b/ir/be/test/am_test3.c deleted file mode 100644 index 52ce5104e..000000000 --- a/ir/be/test/am_test3.c +++ /dev/null @@ -1,19 +0,0 @@ -/*$ -fno-inline $*/ - -char arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; - -int sum(int c, int offs) { - int i, res = 0; - - for(i = 0; i < c; ++i) { - res += arr[i * 2 + offs + 2]; - } - - return res; -} - -int main(void) { - printf("Sum: %d\n", sum(10, 0)); - return 0; -} diff --git a/ir/be/test/am_test4.c b/ir/be/test/am_test4.c deleted file mode 100644 index e5722dec6..000000000 --- a/ir/be/test/am_test4.c +++ /dev/null @@ -1,80 +0,0 @@ -#include - -char c; - -int f(int x, int y) { - return x + y * 8; -} - -int f2(int x, int y) { - return x * 2 + y * 8; -} - -int f3(int x) { - return x * 2; -} - -char f4(char *p, int k) { - return p[k]; -} - -short f5(short *p, int k) { - return p[k]; -} - -#define TTYPE(name, type, OP, OP2) \ -void dest_am_##name##type(type *arr, int from, int to) { \ - int i; \ - \ - for(i = from; i < to; ++i) { \ - arr[i] = OP arr[i] OP2; \ - } \ -} - -#define T(name, OP, OP2) \ - TTYPE(name,int,OP,OP2) \ - TTYPE(name,short,OP,OP2) \ - TTYPE(name,char,OP,OP2) - -T(neg, -,) -T(not, ~,) -T(add, 3 +,) -T(sub, , - 42) -T(and, 0x12345 &,) -T(or, 0x12345 |,) -T(xor, 0x12345 ^,) -T(inc, 1 + ,) -T(dec, , - 1) -T(shl, , << 3) -T(shr, , >> 3) - -int main(void) { - int arrint[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - short arrshort[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - char arrchar[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - int i; - -#define CTYPE(type,name) dest_am_##name##type(arr##type, 0, 10); \ - for(i = 0; i < 10; ++i) { \ - printf("%d ", arr##type[i]); \ - } \ - printf("\n"); - -#define C(name) \ - CTYPE(int,name) \ - CTYPE(short,name) \ - CTYPE(char,name) - - C(neg); - C(not); - C(add); - C(sub); - C(and); - C(or); - C(inc); - C(dec); - C(xor); - - return 0; -} diff --git a/ir/be/test/am_test5.c b/ir/be/test/am_test5.c deleted file mode 100644 index 4b9925c4c..000000000 --- a/ir/be/test/am_test5.c +++ /dev/null @@ -1,16 +0,0 @@ -struct s { - int m1; - int m2; - int m3; - int m4; -}; - -int i = 3; - -int main(int argc, char **argv) { - struct s a[100]; - i = a[i].m1; - - - return 0; -} diff --git a/ir/be/test/andtest.c b/ir/be/test/andtest.c deleted file mode 100644 index 8d1bfaff2..000000000 --- a/ir/be/test/andtest.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -static int test(int a, int i) -{ - a &= ~(1 << (i & 0x0000001F)); - return a; -} - -int A = 15; -int I = 3; - -int main() -{ - printf("test(%d, %d) = %d\n", A, I, test(A,I)); - - return 0; -} diff --git a/ir/be/test/apfel.c b/ir/be/test/apfel.c deleted file mode 100644 index bd209b066..000000000 --- a/ir/be/test/apfel.c +++ /dev/null @@ -1,3 +0,0 @@ -float o=0.075,h=1.5,T,r,O,l,I;int _,L=80,s=3200;main(){for(;s%L|| -(h-=o,T= -2),s;4 -(r=O*O)<(l=I*I)|++ _==L&&write(1,(--s%L?_ - -float o=0.075,h=1.5,T,r,O,l,I; -int _,L=80,s=3200; - -int main(int argc, char *argv[]){ - for (; s;) { - if (s%L == 0) { - h -= o; - T = -2; - } - - O = I*2*O+h; - I = l+T-r; - if (4 -(r=O*O)<(l=I*I) | ++_==L) { - int index = --s%L ? (_ < L ? --_ %6:6) : 7; - char c = "Sascha \n"[index]; - putchar(c); - O = I = l = _ = r = 0; - T += o/2; - } - } - return 0; -} diff --git a/ir/be/test/arr_init.c b/ir/be/test/arr_init.c deleted file mode 100644 index 2c3f26f21..000000000 --- a/ir/be/test/arr_init.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int arr0[] = { 0, 1, 2, 3 }; -int arr1[4] = { 3, 2, 1 }; -int arrm[3][4] = { {1}, {2,3,4,5}, {6, 7, 8 } }; - -int main() -{ - int i, i2; - - for(i = 0; i < (sizeof(arr0)/sizeof(arr0[0])); ++i) { - printf("arr0[%d] = %d\n", i, arr0[i]); - } - for(i = 0; i < 4; ++i) { - printf("arr1[%d] = %d\n", i, arr1[i]); - } - for(i = 0; i < 4; ++i) { - for(i2 = 0; i2 < 3; ++i2) { - printf("arrm[%d][%d] = %d\n", i2, i, arrm[i2][i]); - } - } - - return 0; -} diff --git a/ir/be/test/array_type.c b/ir/be/test/array_type.c deleted file mode 100644 index 668b02e5d..000000000 --- a/ir/be/test/array_type.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int foo[255][4]; - -int bar[4] = { 0, 1, 2, 3 }; - -int main(void) { - printf("bar: %d %d %d %d (should be 0 1 2 3)\n", bar[0], bar[1], bar[2], bar[3]); - return 0; -} diff --git a/ir/be/test/asm_test.c b/ir/be/test/asm_test.c deleted file mode 100644 index a25e781d6..000000000 --- a/ir/be/test/asm_test.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include - -#ifdef __i386__ -static inline unsigned char inb(const unsigned short port) -{ - unsigned char val; - - __asm__ __volatile__ ("inb %w1, %0" : "=a"(val) : "dN"(port)); - - return val; -} - -static inline void outb(const unsigned short port, const unsigned char val) -{ - int k = val; /* just here to test the b modifier in %b0 */ - __asm__ __volatile__ ("outb %b0, %1" : : "a"(k), "dN"(port)); -} - -static void sincostest(double arg) -{ - double cos, sin; - - __asm__ ("fsincos" : "=t"(cos), "=u"(sin) : "0" (arg)); - printf("Arg: %f Sin: %f Cos: %f\n", arg, sin, cos); -} - -static inline int mov_noeax(int val) -{ - int res; - - __asm__ ("movl %1, %0" : "=r"(res) : "ri" (val) : "eax"); - - return res; -} - -static inline unsigned short swap16(unsigned short x) -{ - __asm__("xchgb %b0, %h0 /* in: %1 out: %0 */" : "=q" (x) : "0" (x)); - return x; -} - -static inline unsigned int swap32(unsigned int x) -{ - __asm__("bswap %0 /* %1 */" : "=r" (x) : "0" (x)); - return x; -} - -void inc(int *v) -{ - __asm__("incl %0" : "+rm" (*v) : : "cc"); -} - -void inc2(int *v) -{ - __asm__("incl %0" : "+m" (*v) : : "cc"); -} - -#if 1 -typedef struct kernel_fd_set { - int bla; - int blup; -} kernel_fd_set; -#else -typedef int kernel_fd_set; -#endif - -void fd_set(int fd, kernel_fd_set* set) { - __asm__("btsl %1,%0" : "=m" (*(set)) : "r" (fd) : "cc"); -} - -int fd_isset(int fd, kernel_fd_set *set) { - unsigned char result; - - __asm__ __volatile__("btl %1,%2\n" - "\tsetb %0" - : "=q" (result) - : "r" (fd), "m" (*set) - : "cc"); - return result; -} - -int justcompile(void) -{ - outb(123, 42); - outb(12345, 42); - return inb(20) + inb(5); -} - -int main() -{ - kernel_fd_set s; - int k; - - fd_set(20, &s); - assert(fd_isset(20, &s)); - - printf("Swap16(0xAABB): %X Swap32(0xAABBCCDD): %X\n", - swap16(0xAABB), swap32(0xAABBCCDD)); - k = 41; - inc(&k); - printf("mov(inc(41)): %d\n", mov_noeax(k)); - - return mov_noeax(0); -} - -#else - -int main() -{ - printf("Warning: asmtest only work on x86\n"); - return 0; -} - -#endif diff --git a/ir/be/test/asm_test2.c b/ir/be/test/asm_test2.c deleted file mode 100644 index 65b960beb..000000000 --- a/ir/be/test/asm_test2.c +++ /dev/null @@ -1,19 +0,0 @@ - -int main(int argc, char **argv) { - int i; - - for(i = 0; i < 10; ++i) { - __asm__ __volatile__("/* dummy3 */" - : : : "eax", "ebx", "ecx", "edx", "esi", "edi" ); - } - - if(argc) { - if(argc * 2 > 14) { - __asm__ __volatile__("/* dummy */"); - } else { - __asm__ __volatile__("/* dummy2 */"); - } - } - - return 0; -} diff --git a/ir/be/test/asm_test3.c b/ir/be/test/asm_test3.c deleted file mode 100644 index 697acc5cb..000000000 --- a/ir/be/test/asm_test3.c +++ /dev/null @@ -1,23 +0,0 @@ -/* THIS IS WRONG, but gcc compiles it: (unsigned int)x is NO lvalue */ -#define udiv_qrnnd(q, r, n1, n0, dv) \ - __asm__ ("divl %4" \ - : "=a" ((unsigned int) (q)), \ - "=d" ((unsigned int) (r)) \ - : "0" ((unsigned int) (n0)), \ - "1" ((unsigned int) (n1)), \ - "rm" ((unsigned int) (dv))) - -unsigned int X; -unsigned test(void) { - unsigned int d0, n0, n1, q0; - - n1 = n0 = d0 = X; - - udiv_qrnnd (q0, n0, n1, n0, d0); - - return q0; -} - -int main(void) { - return 0; -} diff --git a/ir/be/test/asm_test4.c b/ir/be/test/asm_test4.c deleted file mode 100644 index d93f1c082..000000000 --- a/ir/be/test/asm_test4.c +++ /dev/null @@ -1,11 +0,0 @@ -unsigned long get_sp(void) -{ - unsigned long esp; - __asm__("movl %%esp, %0" : "=mr" (esp)); - return esp; -} - -int main(void) { - printf("stack pointer available: %d\n", get_sp() > 42); - return 0; -} diff --git a/ir/be/test/asm_test5.c b/ir/be/test/asm_test5.c deleted file mode 100644 index 9e51f5040..000000000 --- a/ir/be/test/asm_test5.c +++ /dev/null @@ -1,12 +0,0 @@ - -unsigned get(void) -{ - unsigned a; - __asm__(" movl $17,%0 ": "=D"(a)); - return a; -} - -int main(void) { - printf("a: %u\n", get()); - return 0; -} diff --git a/ir/be/test/asmq3.c b/ir/be/test/asmq3.c deleted file mode 100644 index 6d038b275..000000000 --- a/ir/be/test/asmq3.c +++ /dev/null @@ -1,21 +0,0 @@ -/*$ -fomit-frame-pointer -O3 $*/ - -int main(void) -{ - int in = 42; - int out; - __asm__( - "xorl %%eax,%%eax\n" - "xorl %%ebx,%%ebx\n" - "xorl %%ecx,%%ecx\n" - "xorl %%edx,%%edx\n" - "xorl %%esi,%%esi\n" - "xorl %%edi,%%edi\n" - "movl %1,%0\n" - "incl %0\n" - : "=r" (out) : "r" (in) - : "eax", "ebx", "ecx", "edx", "esi", "edi", "cc" - ); - - return out != 43; -} diff --git a/ir/be/test/bad.c b/ir/be/test/bad.c deleted file mode 100644 index 0d56ab4ce..000000000 --- a/ir/be/test/bad.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -unsigned int -f1 (int diff) -{ - return ((unsigned int) (diff < 0 ? -diff : diff)); -} - -unsigned int -f2 (unsigned int diff) -{ - return ((unsigned int) ((signed int) diff < 0 ? -diff : diff)); -} - -unsigned long long -f3 (long long diff) -{ - return ((unsigned long long) (diff < 0 ? -diff : diff)); -} - -unsigned long long -f4 (unsigned long long diff) -{ - return ((unsigned long long) ((signed long long) diff < 0 ? -diff : diff)); -} - -int main () -{ - int i; - for (i = 0; i <= 10; i++) - { -#if 0 - if (f1 (i) != i) { - printf("f1(%d)\n", i); - abort (); - } - if (f1 (-i) != i) { - printf("f1(%d)\n", -i); - abort (); - } - if (f2 (i) != i) { - printf("f2(%d)\n", i); - abort (); - } -#endif - if ((int) f2 (-i) != i) { - printf("f2(%d) -> %d\n", -i, f2(-i)); - abort (); - } -#if 0 - if (f3 ((long long) i) != i) { - printf("f3(%lld)\n", i); - abort (); - } - if (f3 ((long long) -i) != i) { - printf("f3(%lld)\n", -i); - abort (); - } - if (f4 ((long long) i) != i) { - printf("f4(%lld)\n", i); - abort (); - } - if (f4 ((long long) -i) != i) { - printf("f4(%d)\n", -i); - abort (); - } -#endif - } - exit (0); -} diff --git a/ir/be/test/bf_constfold.c b/ir/be/test/bf_constfold.c deleted file mode 100644 index 5c3b9cb1d..000000000 --- a/ir/be/test/bf_constfold.c +++ /dev/null @@ -1,29 +0,0 @@ -//#include - -/* Demonstrates a bug where constant folding ignores width of bitfields */ - -#ifdef __GNUC__ -#define PACKED __attribute__((packed)) -#else -#define PACKED -#endif - -struct PACKED A -{ - unsigned int i:1, l:1, j:3, k:11; -}; -struct A sA; - -int main() -{ - unsigned int mask; - struct A x; - - sA.k = -1; - mask = sA.k; - x = sA; - - printf("Val1: %x (expected 7ff) val2: %x (expected 7ff)\n", mask, x.k); - - return 0; -} diff --git a/ir/be/test/bf_init.c b/ir/be/test/bf_init.c deleted file mode 100644 index 094ca693e..000000000 --- a/ir/be/test/bf_init.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "dumpmem.h" - -struct bf { - int a; - unsigned x:13; - unsigned y:17; - unsigned z:3; - unsigned char c; - double d; - unsigned w:9; -}; - -struct bf mybf = { 0xffffffff, 4097, 65537, 5, 0xff, 4.5, 257 }; - -int main() { - - dumpMem(&mybf, sizeof mybf); - printf("sizeof mybf %d\n", sizeof mybf); - - printf("int a (expected -1): %d\n", mybf.a); - printf("unsigned x:13 (expected 4097): %u\n", mybf.x); - printf("unsigned y:17 (expected 65537): %u\n", mybf.y); - printf("unsigned y:3 (expected 5): %u\n", mybf.z); - printf("unsigned char c (expected ff): %x\n", (unsigned)mybf.c); - printf("double d (expected 4.5): %.1f\n", mybf.d); - printf("unsigned w:9 (expected 257): %u\n", mybf.w); - - return 0; -} diff --git a/ir/be/test/bf_localinit.c b/ir/be/test/bf_localinit.c deleted file mode 100644 index 7e3237e50..000000000 --- a/ir/be/test/bf_localinit.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include "dumpmem.h" - -struct bf { - int a; - unsigned x:13; - unsigned y:17; - unsigned z:3; - unsigned char c; - double d; - unsigned w:9; -}; - -#ifdef offsetof -#undef offsetof -#endif -#define offsetof(TYPE, MEMB) ((char*) (&((TYPE *)0)->MEMB) - (char*) 0) - -int main(int argc, char **argv) { - struct bf mybf = { 0xffffffff, 4097, 65537, 5, 0xff, 4.5, 257 }; - - if(argc > 1) - dumpMem(&mybf, sizeof mybf); - printf("sizeof mybf %d\n", sizeof mybf); - printf("offset a = %d\n", offsetof(struct bf, a)); - printf("offset c = %d\n", offsetof(struct bf, c)); - printf("offset d = %d\n", offsetof(struct bf, d)); - - printf("int a (expected -1): %d\n", mybf.a); - printf("unsigned x:13 (expected 4097): %u\n", mybf.x); - printf("unsigned y:17 (expected 65537): %u\n", mybf.y); - printf("unsigned y:3 (expected 5): %u\n", mybf.z); - printf("unsigned char c (expected ff): %x\n", mybf.c); - printf("double d (expected 4.5): %.1f\n", mybf.d); - printf("unsigned w:9 (expected 257): %u\n", mybf.w); - - return 0; -} diff --git a/ir/be/test/bf_store.c b/ir/be/test/bf_store.c deleted file mode 100644 index c82aff799..000000000 --- a/ir/be/test/bf_store.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "dumpmem.h" - -struct bf { - unsigned x:13; - unsigned y:17; - unsigned z:3; - unsigned w:9; -} mybf; - - -int main(void) { - - mybf.x = 4097; - mybf.y = 65537; - mybf.z = 5; - mybf.w = 257; - - dumpMem(&mybf, sizeof mybf); - - return 0; -} diff --git a/ir/be/test/biggest_prime.c b/ir/be/test/biggest_prime.c deleted file mode 100644 index 5f87a7848..000000000 --- a/ir/be/test/biggest_prime.c +++ /dev/null @@ -1,70 +0,0 @@ -#include - -static int m = 754974721; -static int N; -static int t[1 << 22]; -static int a; -static int *p; -static int i; -//static int e = 1 << 22; -static int e = 1 << 10; -static int j; -static int s; -static int b; -static int c; -static int U; - -void f(int d) -{ - for (s = 1 << 23; s; s /= 2, d = d * 1L * d % m) { - if (s >= N) continue; - for (p = t; p < t + N; p += s) { - for (i = s, c = 1; i; i--) { - b = *p + p[s], p[s] = (m + *p - p[s]) * - 1L * c % m, *p++ = b % m, c = c * 1L * d % m; - } - } - } - - for (j = 0; i < N - 1;) - { - for (s = N / 2; !((j ^= s) & s); s /= 2) - {} - - if (++i < j) - a = t[i], t[i] = t[j], t[j] = a; - } -} - -int main () -{ - *t = 2; - U = N = 1; - - while (e /= 2) { - N *= 2; - U = U * 1L * (m + 1) / 2 % m; - f(362); - for (p = t; p < t + N;) - *p++ = (*p * 1L * *p % m) * U % m; - - f(415027540); - for (a = 0, p = t; p < t + N;) { - a += (0x6A64B1 & e ? 2 : 1) * *p; - *p++ = a % 10; - a /= 10; - } - } - - while (!*--p) - ; - - t[0]--; - { - int qs = 0; - while (p >= t) - qs += *p--; - printf ("Checksumme = %d\n", qs); - } - return 0; -} diff --git a/ir/be/test/bitfield.c b/ir/be/test/bitfield.c deleted file mode 100644 index 890002827..000000000 --- a/ir/be/test/bitfield.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -struct a { - unsigned int i:1; -}; - -struct b { - int x:20; - int y:8; - int z:10; -}; - -struct b B = { -1, 2, 3 }; -struct b C = { -1, 2, 3 }; - -int main() -{ - printf("sizeof(struct a) = %zu\n", sizeof(struct a)); - printf("sizeof(B) = %d\n", sizeof(B)); - - printf("x = %d\n", B.x); - printf("y = %d\n", B.y); - printf("z = %d\n", B.z); - - B.y = C.z; - - if (C.z) - return 0; - - return 42; -} diff --git a/ir/be/test/bitwise.c b/ir/be/test/bitwise.c deleted file mode 100644 index 6fc25b6ce..000000000 --- a/ir/be/test/bitwise.c +++ /dev/null @@ -1,9 +0,0 @@ - - int a, b, c, d, e; - -int main(void) { - c = a & b; - d = c | a; - e = b ^ d; - return 0; -} diff --git a/ir/be/test/blocks.c b/ir/be/test/blocks.c deleted file mode 100644 index baf962f3d..000000000 --- a/ir/be/test/blocks.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -int A, B, C; - -int test(int a, int b, int c) { - switch (a) { - case 1: - B = b; - return A + c; - case 2: - B = c; - return c + A; - case 3: - return c + A; - case 4: - abort(); - } - abort(); -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/ir/be/test/boolopts.c b/ir/be/test/boolopts.c deleted file mode 100644 index cb9b2a474..000000000 --- a/ir/be/test/boolopts.c +++ /dev/null @@ -1,223 +0,0 @@ -/*$ -fno-inline $*/ -#include -#include -#include - -int f(int a, int b) -{ - return a < 0 & b < 0; -} - -int f2(short a, short b) -{ - return a < b && b < a; -} - -int f3(short a, short b) -{ - return a < b && b > a; -} - -int f4(short a, short b, short c) -{ - return (a <= c) & (b <= c); -} - -int g(unsigned a, unsigned b) -{ - return ((a >> 12) | 5) & ((b >> 12) | 5); -} - -int g2(unsigned a, unsigned b) -{ - return (a & 5) | (b & 5); -} - -int g3(int a, int b, int z) -{ - return (a | z) & (b | z); -} - -int imp(int a, int b) -{ - /* logical implication */ - return (a < b) <= (a <= b); -} - -int eq(int a, int b) -{ - return (a < b) == (a <= b); -} - -int neq(int a, int b) -{ - return (a < b) != (a <= b); -} - -int af(int a) -{ - return (a ? 1 : 0) && !a; -} - -int at(int a) -{ - return (a ? 1 : 0) || !a; -} - -int c(int a, int b) -{ - return a < b || a == b; -} - -int c2(int a, int b) -{ - return a < b && a <= b; -} - -int c3(int a, int b) -{ - return a < b || a >= b; -} - -int c4(int a, int b) -{ - return a < b ^ a <= b; -} - -int main() -{ -#define UOP(func,val,should_be) { printf("%s(%d) -> %d (should be %d)\n", #func, val, func(val), should_be); assert(func(val) == should_be); } -#define BOP(func,val1,val2,should_be) { printf("%s(%d,%d) -> %d (should be %d)\n", #func, val1, val2, func(val1,val2), should_be); assert(func(val1,val2) == should_be); } -#define TOP(func,val1,val2,val3,should_be) { printf("%s(%d,%d,%d) -> %d (should be %d)\n", #func, val1, val2, val3, func(val1,val2,val3), should_be); assert(func(val1,val2,val3) == should_be); } - BOP(f, 0, 0, 0); - BOP(f, -1, 0, 0); - BOP(f, 0, -42, 0); - BOP(f, -1, 1, 0); - BOP(f, -42, -23, 1); - BOP(f, 13, -1, 0); - BOP(f, -1, -1, 1); - BOP(f, INT_MIN, INT_MIN, 1); - BOP(f, INT_MIN, -1, 1); - BOP(f, -1, INT_MIN, 1); - - BOP(f2, 0, 0, 0); - BOP(f2, -1, 0, 0); - BOP(f2, 0, -42, 0); - BOP(f2, -1, 1, 0); - BOP(f2, -42, -23, 0); - BOP(f2, 13, -1, 0); - BOP(f2, -1, -1, 0); - BOP(f2, SHRT_MIN, SHRT_MIN, 0); - BOP(f2, SHRT_MIN, -1, 0); - BOP(f2, -1, SHRT_MIN, 0); - - BOP(f3, 0, 0, 0); - BOP(f3, -1, 0, 1); - BOP(f3, 0, -42, 0); - BOP(f3, -1, 1, 1); - BOP(f3, -42, -23, 1); - BOP(f3, 13, -1, 0); - BOP(f3, -1, -1, 0); - BOP(f3, SHRT_MIN, SHRT_MIN, 0); - BOP(f3, SHRT_MIN, -1, 1); - BOP(f3, -1, SHRT_MIN, 0); - - TOP(f4, 1, 2, 3, 1); - TOP(f4, -1, -2, -3, 0); - TOP(f4, SHRT_MIN, SHRT_MIN, -1, 1); - TOP(f4, SHRT_MIN, SHRT_MIN, SHRT_MIN, 1); - TOP(f4, SHRT_MAX, SHRT_MIN, SHRT_MAX, 1); - TOP(f4, SHRT_MIN, SHRT_MIN, SHRT_MAX, 1); - TOP(f4, 13, 42, SHRT_MAX, 1); - TOP(f4, 0, 0, 0, 1); - TOP(f4, 1, 1, 1, 1); - - BOP(g, UINT_MAX, UINT_MAX, 1048575); - BOP(g, 0, 0, 5); - BOP(g, 12345, 54321, 5); - - BOP(g2, UINT_MAX, UINT_MAX, 5); - BOP(g2, 0, 0, 0); - BOP(g2, 12345, 54321, 1); - - BOP(imp, UINT_MAX, UINT_MAX, 1); - BOP(imp, 0, 0, 1); - BOP(imp, 12345, 54321, 1); - BOP(imp, 42, 23, 1); - - BOP(eq, UINT_MAX, UINT_MAX, 0); - BOP(eq, 0, 0, 0); - BOP(eq, 12345, 54321, 1); - BOP(eq, 42, 23, 1); - - BOP(neq, UINT_MAX, UINT_MAX, 1); - BOP(neq, 0, 0, 1); - BOP(neq, 12345, 54321, 0); - BOP(neq, 42, 23, 0); - - TOP(g3, 1, 2, 3, 3); - TOP(g3, -1, -2, -3, -1); - TOP(g3, INT_MIN, INT_MIN, -1, -1); - TOP(g3, INT_MIN, INT_MIN, INT_MIN, INT_MIN); - TOP(g3, INT_MAX, INT_MIN, INT_MAX, INT_MAX); - TOP(g3, INT_MIN, INT_MIN, INT_MAX, -1); - TOP(g3, 13, 42, INT_MAX, INT_MAX); - TOP(g3, 0, 0, 0, 0); - TOP(g3, 1, 1, 1, 1); - - UOP(af, 0, 0); - UOP(af, 1, 0); - UOP(af, 42, 0); - UOP(af, -1, 0); - - UOP(at, 0, 1); - UOP(at, 1, 1); - UOP(at, 42, 1); - UOP(at, -1, 1); - - BOP(c, 0, 0, 1); - BOP(c, -1, 0, 1); - BOP(c, 0, -42, 0); - BOP(c, -1, 1, 1); - BOP(c, -42, -23, 1); - BOP(c, 13, -1, 0); - BOP(c, -1, -1, 1); - BOP(c, SHRT_MIN, SHRT_MIN, 1); - BOP(c, SHRT_MIN, -1, 1); - BOP(c, -1, SHRT_MIN, 0); - - BOP(c2, 0, 0, 0); - BOP(c2, -1, 0, 1); - BOP(c2, 0, -42, 0); - BOP(c2, -1, 1, 1); - BOP(c2, -42, -23, 1); - BOP(c2, 13, -1, 0); - BOP(c2, -1, -1, 0); - BOP(c2, SHRT_MIN, SHRT_MIN, 0); - BOP(c2, SHRT_MIN, -1, 1); - BOP(c2, -1, SHRT_MIN, 0); - - BOP(c3, 0, 0, 1); - BOP(c3, -1, 0, 1); - BOP(c3, 0, -42, 1); - BOP(c3, -1, 1, 1); - BOP(c3, -42, -23, 1); - BOP(c3, 13, -1, 1); - BOP(c3, -1, -1, 1); - BOP(c3, SHRT_MIN, SHRT_MIN, 1); - BOP(c3, SHRT_MIN, -1, 1); - BOP(c3, -1, SHRT_MIN, 1); - - BOP(c4, 0, 0, 1); - BOP(c4, -1, 0, 0); - BOP(c4, 0, -42, 0); - BOP(c4, -1, 1, 0); - BOP(c4, -42, -23, 0); - BOP(c4, 13, -1, 0); - BOP(c4, -1, -1, 1); - BOP(c4, SHRT_MIN, SHRT_MIN, 1); - BOP(c4, SHRT_MIN, -1, 0); - BOP(c4, -1, SHRT_MIN, 0); - - return 0; -} diff --git a/ir/be/test/boolsimplify.c b/ir/be/test/boolsimplify.c deleted file mode 100644 index cd7481d2c..000000000 --- a/ir/be/test/boolsimplify.c +++ /dev/null @@ -1,69 +0,0 @@ -int range0(int a) -{ - return 0 <= a && a < 10; -} - -int range1(int a) -{ - return 1 <= a && a < 10; -} - -int test_lt_and_lt(int a) -{ - return a < 5 && a < 10; -} - -int test_lt_and_eq(int a) -{ - return a < 5 && a == 10; -} - -int test_lt_and_gt(int a) -{ - return a < 5 && a > 10; -} - -int test_eq_and_lt(int a) -{ - return a == 5 && a < 10; -} - -int test_eq_and_eq(int a) -{ - return a == 5 && a == 10; -} - -int test_eq_and_gt(int a) -{ - return a == 5 && a > 10; -} - -int test_ge_and_lt(int a) -{ - return a >= 5 && a < 6; -} - -int test_gt_and_lt(int a) -{ - return a > 5 && a < 6; -} - -int test_lt_or_lt(int a) -{ - return a < 5 || a < 10; -} - -int test_lt_or_eq(int a) -{ - return a < 5 || a == 5; -} - -int test_ne_or_ne(int a) -{ - return a != 5 || a != 10; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/bttest.c b/ir/be/test/bttest.c deleted file mode 100644 index 9f56ca5b6..000000000 --- a/ir/be/test/bttest.c +++ /dev/null @@ -1,33 +0,0 @@ -#include - -int bttest(int x, int n) { - if (x & (1 << n)) - return 1; - return 0; -} - -int nbttest(int x, int n) { - if (!(x & (1 << n))) - return 1; - return 0; -} - -int bttest1(int x, int n) { - if ((x & (1 << n)) == (1 << n)) - return 1; - return 0; -} - -int bttest2(int x, int n) { - if ((x & (1 << n)) != (1 << n)) - return 1; - return 0; -} - -int main() { - printf("%d\n", bttest(128, 7)); - printf("%d\n", nbttest(128, 7)); - printf("%d\n", bttest1(128, 7)); - printf("%d\n", bttest2(128, 7)); - return 0; -} diff --git a/ir/be/test/callref.c b/ir/be/test/callref.c deleted file mode 100644 index bbb6105a3..000000000 --- a/ir/be/test/callref.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -void func(int *i) -{ - *i = 0; -} - -int main (int argc, char *argv[]) { - int i; - - printf("callref.c\n"); - - func(&i); - - printf(" i = %d (should be 0)\n", i); - - return 0; -} diff --git a/ir/be/test/calls.c b/ir/be/test/calls.c deleted file mode 100644 index 6fdcb672e..000000000 --- a/ir/be/test/calls.c +++ /dev/null @@ -1,33 +0,0 @@ -#if 0 - -int test(int a, int b, int c, int d, int e, int f, int g, int h, int i) -{ - x(a); - x(a, b); - x(a, b, c); - x(a, b, c, d); - x(a, b, c, d, e); - x(a, b, c, d, e, f); - x(a, b, c, d, e, f, g); - x(a, b, c, d, e, f, g, h); - x(a, b, c, d, e, f, g, h, i); -} - -#endif - - -int test(int a, int b, int c) -{ - int d, e; - - d = a/b; -// e = b/c; - - return d; -} - -int main() -{ - printf("Result: %d\n", test(1,2,3)); - return 0; -} diff --git a/ir/be/test/cfoptbug.c b/ir/be/test/cfoptbug.c deleted file mode 100644 index 7d5a35dff..000000000 --- a/ir/be/test/cfoptbug.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -struct list { - struct list *next; - int val; -}; - -struct list l = { NULL, 5 }; -struct list *sptr = &l; -struct list l2 = { NULL, 42 }; -struct list *sptr2 = &l2; - -struct list *test(int n) -{ - struct list *ptr1; - struct list *ptr2; - int sum = 0; - - if(n == 0) { - ptr1 = sptr; - } else { - ptr1 = sptr2; - } - - for(ptr2 = ptr1; ptr2 != NULL; ptr2 = ptr2->next) { - sum += ptr2->val; - } - printf("Sum: %d\n", sum); - - return ptr1; -} - -int main(int argc, char **argv) -{ - struct list *ptr1 = test(0); - struct list *ptr2 = test(1); - - assert(ptr1 == sptr); - assert(ptr2 == sptr2); - - return 0; -} diff --git a/ir/be/test/cmp.c b/ir/be/test/cmp.c deleted file mode 100644 index 909758224..000000000 --- a/ir/be/test/cmp.c +++ /dev/null @@ -1,149 +0,0 @@ -#include - -int cmp1(int a, int b) -{ - return a < b; -} - -int cmp2(int a, int b) -{ - return a > b; -} - -int cmp3(int a) -{ - return a < 3; -} - -int cmp4(int a) -{ - return a > 3; -} - -int cmp5(int a) -{ - return -3 < a; -} - -int cmp6(int a) -{ - return -3 > a; -} - -int cmp7(int a) -{ - return 3 < -a; -} - -int cmp8(int a) -{ - return 3 > -a; -} - -int cmp9(int a, int b) -{ - return -a < -b; -} - -int cmp10(int a, int b) -{ - return a-b == 0; -} - -int cmp11(int a) -{ - return a-3 != 5; -} - -int cmp12(int a) -{ - return a+3 == 5; -} - -int cmp13(int a) -{ - if (a < 0) - return -a; - else - return a; -} - -int cmp14(int a) -{ - return a == 0 ? a : -a; -} - -int cmp15(int a) -{ - return a > 0; -} - -int cmp16(int a) -{ - return a < 0 ? -1 : 0; -} - -int cmp17(int a, int b) -{ - if (a < b) - return a; - return b; -} - -int cmp18(int a, int b) -{ - if (a > b) - return a; - return b; -} - -double dcmp1(double a, double b) { - if (a < b) - return a; - else - return b; -} - -double dcmp2(double a, double b) { - if (a > b) - return a; - else - return b; -} - -int A = 1; -int B = -1; -double Fa = 200.; -double Fb = 2; - -int main() -{ - int a = A, b = B; - double fa = Fa, fb = Fb; - - printf("cmp1(%d, %d) = %d\n", a, b, cmp1(a, b)); - printf("cmp2(%d, %d) = %d\n", a, b, cmp2(a, b)); - printf("cmp3(%d) = %d\n", a, cmp3(a)); - printf("cmp4(%d) = %d\n", a, cmp4(a)); - printf("cmp5(%d) = %d\n", a, cmp5(a)); - printf("cmp6(%d) = %d\n", a, cmp6(a)); - printf("cmp7(%d) = %d\n", a, cmp7(a)); - printf("cmp8(%d) = %d\n", a, cmp8(a)); - printf("cmp9(%d, %d) = %d\n", a, b, cmp9(a, b)); - printf("cmp10(%d, %d) = %d\n", a, b, cmp10(a, b)); - printf("cmp11(%d) = %d\n", a, cmp11(a)); - printf("cmp12(%d) = %d\n", a, cmp12(a)); - printf("cmp13(%d) = %d\n", a, cmp13(a)); - printf("cmp14(%d) = %d\n", a, cmp14(a)); - printf("cmp15(%d) = %d\n", a, cmp15(a)); - printf("cmp16(%d) = %d\n", a, cmp16(a)); - printf("cmp17(%d, %d) = %d\n", a, b, cmp18(a, b)); - printf("cmp18(%d, %d) = %d\n", a, b, cmp18(a, b)); - - printf("dcmp1(%f, %f) = %f\n", -fa, -fb, dcmp1(-fa, -fb)); - printf("dcmp2(%f, %f) = %f\n", -fa, -fb, dcmp2(-fa, -fb)); - printf("dcmp1(%f, %f) = %f\n", fa, fb, dcmp1(fa, fb)); - printf("dcmp2(%f, %f) = %f\n", fa, fb, dcmp2(fa, fb)); - - return 0; -} diff --git a/ir/be/test/cmp_cse.c b/ir/be/test/cmp_cse.c deleted file mode 100644 index 9f24d5f6d..000000000 --- a/ir/be/test/cmp_cse.c +++ /dev/null @@ -1,9 +0,0 @@ - -int sign(int x) -{ - return (x > 5) - (x <= 5); -} - -int main(void) { - return 0; -} diff --git a/ir/be/test/codegen/README b/ir/be/test/codegen/README deleted file mode 100644 index e8599a6b0..000000000 --- a/ir/be/test/codegen/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains some interesting chalenges for an x86 backend... diff --git a/ir/be/test/codegen/countingloop.c b/ir/be/test/codegen/countingloop.c deleted file mode 100644 index dad82ea53..000000000 --- a/ir/be/test/codegen/countingloop.c +++ /dev/null @@ -1,21 +0,0 @@ -char *pt; - -int gf, gm; - -int f(int max) { - int i; - int f = 0; - int m = 0; - char *p = pt; - - for(i = 0; i < max; ++i) { - if(pt[i] == 0) { - f++; - } else { - m++; - } - } - gf = f; - gm = m; - return 0; -} diff --git a/ir/be/test/codegen/crafty.c b/ir/be/test/codegen/crafty.c deleted file mode 100644 index ffd5def32..000000000 --- a/ir/be/test/codegen/crafty.c +++ /dev/null @@ -1,22 +0,0 @@ -int first_ones[256]; - - int FirstOne(unsigned long long arg1) - { - union doub { - unsigned short i[4]; - unsigned long long d; - }; - union doub x; - x.d=arg1; - - if (x.i[3]) - return (first_ones[x.i[3]]); - if (x.i[2]) - return (first_ones[x.i[2]]+16); - if (x.i[1]) - return (first_ones[x.i[1]]+32); - if (x.i[0]) - return (first_ones[x.i[0]]+48); - - return(64); - } diff --git a/ir/be/test/codegen/intfloatconv.c b/ir/be/test/codegen/intfloatconv.c deleted file mode 100644 index 7b5618690..000000000 --- a/ir/be/test/codegen/intfloatconv.c +++ /dev/null @@ -1,22 +0,0 @@ - -#define SIZE 10000 -int arr1[SIZE]; -int arr2[SIZE]; - -int main(int argc, char **argv) -{ - int i; - int iter; - int iterations = 100; - - if(argc > 1) - iterations = atoi(argv[1]); - - for(iter = 0; iter < iterations; ++iter) { - for(i = 0; i < SIZE; ++i) { - arr1[i] = arr2[i] + 23.5; - } - } - - return 0; -} diff --git a/ir/be/test/codegen/leas.c b/ir/be/test/codegen/leas.c deleted file mode 100644 index 74ebc0333..000000000 --- a/ir/be/test/codegen/leas.c +++ /dev/null @@ -1,42 +0,0 @@ -int k, g, h; - -char *arr; - -enum e_block_types {CLB, OUTPAD, INPAD, IO, ILLEGAL}; -struct s_block { - char *name; - enum e_block_types type; - int *nets; - int x; - int y; -}; - -extern struct s_block *block; -extern int num_blocks; - -int my_rand(int max); - -int f(int x, int y, int z) -{ - k = x; - g = y; - h = z; - int b_from = my_rand(num_blocks - 1); - - while(block[b_from].type != CLB) { - b_from = my_rand(num_blocks-1); - } - return 0; -} - -int t2(int a) { - return a*2 + 2; -} - -int t3(int a) { - return a*8 + 2; -} - -int t4(int x, int y) { - return x + y + y; -} diff --git a/ir/be/test/codegen/loadstore.c b/ir/be/test/codegen/loadstore.c deleted file mode 100644 index 1a32204e2..000000000 --- a/ir/be/test/codegen/loadstore.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -static char *block; - -int processblock(void) -{ - int i; - block[0] = 10; - for(i = 0; i < 100; ++i) { - block[i] += 5; - } - - return 0; -} - -/* just here so the block variable doesn't get optimized away... */ -void initblock(void) -{ - block = malloc(100); -} - -char* getme(void) -{ - return block; -} diff --git a/ir/be/test/codegen/overspilling.c b/ir/be/test/codegen/overspilling.c deleted file mode 100644 index e0534651e..000000000 --- a/ir/be/test/codegen/overspilling.c +++ /dev/null @@ -1,11 +0,0 @@ -int x; - -void f(int a, int b, char* p) -{ - int y = x; - do { - *p++ = 0; - } while (++a != b); - rand(); - x = y; -} diff --git a/ir/be/test/codegen/spill_copymin.c b/ir/be/test/codegen/spill_copymin.c deleted file mode 100644 index 1258b91f2..000000000 --- a/ir/be/test/codegen/spill_copymin.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -static void __attribute__((noinline)) f(void) -{ - /* firm spiller will probably spill %ebp which will result in 2 additional - * copies; %ebx->%ebp before asm and %ebp->%ebx at the end */ - unsigned eax = 0; - unsigned ebx; - unsigned ecx; - unsigned edx; - - asm("cpuid" : "+a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)); - - unsigned buf[] = { ebx, edx, ecx }; - printf("%.12s\n", (char const*)buf); -} - -int main(void) -{ - f(); - return 0; -} diff --git a/ir/be/test/codegen/spillharness.c b/ir/be/test/codegen/spillharness.c deleted file mode 100644 index c5404009f..000000000 --- a/ir/be/test/codegen/spillharness.c +++ /dev/null @@ -1,32 +0,0 @@ -int max = 1000000; - -int printf(const char *str, ...); - -int main(int argc, char **argv) { - int i; - int i2; - int val; - - for(i = 0; i < max; ++i) { - val = rand(); - } - - rand(); - for(i2 = 0; i2 < 100; ++i2) { - for(i = 0; i < max; ++i) { - int i1 = rand(); - int i2 = rand(); - int i3 = rand(); - int i4 = rand(); - int i5 = rand(); - int i6 = rand(); - int i7 = rand(); - - i += i1 +i2 +i3+i4+i5+i6+i7; - printf("%d\n", i); - } - } - - printf("end\n"); - return val; -} diff --git a/ir/be/test/codegen/spillharness2.c b/ir/be/test/codegen/spillharness2.c deleted file mode 100644 index bcb16ab2e..000000000 --- a/ir/be/test/codegen/spillharness2.c +++ /dev/null @@ -1,52 +0,0 @@ -volatile int G1, G2, G3, G4, G5; - -volatile int VG; - -static void __attribute__((noinline)) f(int k) -{ - (void) k; -} - -static void __attribute__((noinline)) test() -{ - int foo = rand(); - - // spill foo. - int t1 = G1; - int t2 = G2; - int t3 = G3; - int t4 = G4; - int t5 = G5; - - int bar = rand(); - int i; - - G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5; - G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5; - G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5; - - i = 10000; - while (i--) { - VG = foo; // really keep foo in a reg. - f(bar); // bar live - G1 = t1; - VG = foo; - G2 = t2; - VG = foo; - G3 = t3; - VG = foo; - G4 = t4; - VG = foo; - G5 = t5; - - } -} - -int main(void) -{ - int i; - - for(i = 0; i < 50000; ++i) { - test(); - } -} diff --git a/ir/be/test/codegen/type_noalias.c b/ir/be/test/codegen/type_noalias.c deleted file mode 100644 index 18d8b24b7..000000000 --- a/ir/be/test/codegen/type_noalias.c +++ /dev/null @@ -1,14 +0,0 @@ - -struct bar { - unsigned int size; -}; - -char *foo; - -void f(void) -{ - foo += 5; - ((struct bar*) (foo - 10))->size = 10; - ((struct bar*) (foo - 10))->size += 1; - ((struct bar*) (foo - 10))->size -= 1; -} diff --git a/ir/be/test/combo_comm.c b/ir/be/test/combo_comm.c deleted file mode 100644 index 7571cc903..000000000 --- a/ir/be/test/combo_comm.c +++ /dev/null @@ -1,19 +0,0 @@ -/*$ -fcombo -fno-inline $*/ -int test(int a, int b) { - int c, d; - - c = a + b; - - if (0) - d = 0; - else - d = b; - - d = d + a; - - return c + d; -} - -int main(int argc, char *argv[]) { - return test(2,3) != 10; -} diff --git a/ir/be/test/compilerhang1.c b/ir/be/test/compilerhang1.c deleted file mode 100644 index 5fbe4bb3a..000000000 --- a/ir/be/test/compilerhang1.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Verify that flexible arrays can be initialized from STRING_CST - constructors. */ - -/* The tests. */ -struct S3 { - char a3c; - char a3p[]; -} a3 = { - 'o', - "wx" -}; - -main() -{ - if (a3.a3c != 'o') - abort(); - if (a3.a3p[0] != 'w') - abort(); - if (a3.a3p[1] != 'x') - abort(); - - return 0; -} diff --git a/ir/be/test/compilerhang2.c b/ir/be/test/compilerhang2.c deleted file mode 100644 index 9a32a1ea3..000000000 --- a/ir/be/test/compilerhang2.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Macros to emit "L Nxx R" for each octal number xx between 000 and 037. */ -#define OP1(L, N, R, I, J) L N##I##J R -#define OP2(L, N, R, I) \ - OP1(L, N, R, 0, I), OP1(L, N, R, 1, I), \ - OP1(L, N, R, 2, I), OP1(L, N, R, 3, I) -#define OP(L, N, R) \ - OP2(L, N, R, 0), OP2(L, N, R, 1), OP2(L, N, R, 2), OP2(L, N, R, 3), \ - OP2(L, N, R, 4), OP2(L, N, R, 5), OP2(L, N, R, 6), OP2(L, N, R, 7) - -/* Declare 32 unique variables with prefix N. */ -#define DECLARE(N) OP (, N,) - -/* Copy 32 variables with prefix N from the array at ADDR. - Leave ADDR pointing to the end of the array. */ -#define COPYIN(N, ADDR) OP (, N, = *(ADDR++)) - -/* Likewise, but copy the other way. */ -#define COPYOUT(N, ADDR) OP (*(ADDR++) =, N,) - -/* Add the contents of the array at ADDR to 32 variables with prefix N. - Leave ADDR pointing to the end of the array. */ -#define ADD(N, ADDR) OP (, N, += *(ADDR++)) - -volatile double gd[32]; -volatile float gf[32]; - -void foo (int n) -{ - double DECLARE(d); - float DECLARE(f); - volatile double *pd; - volatile float *pf; - int i; - - pd = gd; COPYIN (d, pd); - for (i = 0; i < n; i++) - { - pf = gf; COPYIN (f, pf); - pd = gd; ADD (d, pd); - pd = gd; ADD (d, pd); - pd = gd; ADD (d, pd); - pf = gf; COPYOUT (f, pf); - } - pd = gd; COPYOUT (d, pd); -} - -int main () -{ - int i; - - for (i = 0; i < 32; i++) { - gd[i] = i, gf[i] = i; - } - - foo (1); - - for (i = 0; i < 32; i++) { - if(gf[i] != i) { - printf("abort1 (%d) expected %d, got %f\n", i, i, gf[i]); - abort(); - } - if (gd[i] != i * 4) { - printf("abort2 (%d) expected %d, got %f\n", i, i*4, gd[i]); - abort (); - } - } - - exit (0); -} diff --git a/ir/be/test/compilerhang3.c b/ir/be/test/compilerhang3.c deleted file mode 100644 index 936fed33a..000000000 --- a/ir/be/test/compilerhang3.c +++ /dev/null @@ -1,162 +0,0 @@ -#include -#include - -/* Test arithmetics on bitfields. */ - -extern void abort (void); -extern void exit (int); - -unsigned int -myrnd (void) -{ - static unsigned int s = 1388815473; - s *= 1103515245; - s += 12345; - return (s / 65536) % 2048; -} - -#define T(S) \ -struct S s##S; \ -struct S retme##S (struct S x) \ -{ \ - return x; \ -} \ - \ -unsigned int fn1##S (unsigned int x) \ -{ \ - struct S y = s##S; \ - y.k += x; \ - y = retme##S (y); \ - return y.k; \ -} \ - \ -unsigned int fn2##S (unsigned int x) \ -{ \ - struct S y = s##S; \ - y.k += x; \ - y.k %= 15; \ - return y.k; \ -} \ - \ -unsigned int retit##S (void) \ -{ \ - return s##S.k; \ -} \ - \ -unsigned int fn3##S (unsigned int x) \ -{ \ - s##S.k += x; \ - return retit##S (); \ -} \ - \ -void test##S (void) \ -{ \ - int i; \ - unsigned int mask, v, a, r; \ - struct S x; \ - char *p = (char *) &s##S; \ - for (i = 0; i < sizeof (s##S); ++i) \ - *p++ = myrnd (); \ - if (__builtin_classify_type (s##S.l) == 8) \ - s##S.l = 5.25; \ - s##S.k = -1; \ - mask = s##S.k; \ - v = myrnd (); \ - a = myrnd (); \ - s##S.k = v; \ - x = s##S; \ - r = fn1##S (a); \ - if (x.i != s##S.i || x.j != s##S.j \ - || x.k != s##S.k || x.l != s##S.l \ - || ((v + a) & mask) != r) { \ - printf("abort '%s' 1\n", #S ); \ - abort (); \ - } \ - v = myrnd (); \ - a = myrnd (); \ - s##S.k = v; \ - x = s##S; \ - r = fn2##S (a); \ - if (x.i != s##S.i || x.j != s##S.j \ - || x.k != s##S.k || x.l != s##S.l \ - || ((((v + a) & mask) % 15) & mask) != r) {\ - printf("abort '%s' 2\n", #S ); \ - abort (); \ - }\ - v = myrnd (); \ - a = myrnd (); \ - s##S.k = v; \ - x = s##S; \ - r = fn3##S (a); \ - if (x.i != s##S.i || x.j != s##S.j \ - || s##S.k != r || x.l != s##S.l \ - || ((v + a) & mask) != r) { \ - printf("abort '%s' 3\n", #S ); \ - abort (); \ - } \ -} - -#ifdef __powerpc64__ -/* Temporary hack for broken PPC64 unaligned handling PR rtl-optimization/13674 */ -# define pck -#else -# define pck __attribute__((packed)) -#endif -struct pck A { unsigned short i : 1, l : 1, j : 3, k : 11; }; T(A) -struct pck B { unsigned short i : 4, j : 1, k : 11; unsigned int l; }; T(B) -struct pck C { unsigned int l; unsigned short i : 4, j : 1, k : 11; }; T(C) -struct pck D { unsigned long long l : 6, i : 6, j : 23, k : 29; }; T(D) -struct pck E { unsigned long long l, i : 12, j : 23, k : 29; }; T(E) -struct pck F { unsigned long long i : 12, j : 23, k : 29, l; }; T(F) -struct pck G { unsigned short i : 1, j : 1, k : 6; unsigned long long l; }; T(G) -struct pck H { unsigned short i : 6, j : 2, k : 8; unsigned long long l; }; T(H) -struct pck I { unsigned short i : 1, j : 6, k : 1; unsigned long long l; }; T(I) -struct pck J { unsigned short i : 1, j : 8, k : 7; unsigned short l; }; T(J) -struct pck K { unsigned int k : 6, l : 1, j : 10, i : 15; }; T(K) -struct pck L { unsigned int k : 6, j : 11, i : 15; unsigned int l; }; T(L) -struct pck M { unsigned int l; unsigned short k : 6, j : 11, i : 15; }; T(M) -struct pck N { unsigned long long l : 6, k : 6, j : 23, i : 29; }; T(N) -struct pck O { unsigned long long l, k : 12, j : 23, i : 29; }; T(O) -struct pck P { unsigned long long k : 12, j : 23, i : 29, l; }; T(P) -struct pck Q { unsigned short k : 12, j : 1, i : 3; unsigned long long l; }; T(Q) -struct pck R { unsigned short k : 2, j : 11, i : 3; unsigned long long l; }; T(R) -struct pck S { unsigned short k : 1, j : 6, i : 9; unsigned long long l; }; T(S) -struct pck T { unsigned short k : 1, j : 8, i : 7; unsigned short l; }; T(T) -struct pck U { unsigned short j : 6, k : 1, i : 9; unsigned long long l; }; T(U) -struct pck V { unsigned short j : 8, k : 1, i : 7; unsigned short l; }; T(V) -struct pck W { long double l; unsigned int k : 12, j : 13, i : 7; }; T(W) -struct pck X { unsigned int k : 12, j : 13, i : 7; long double l; }; T(X) -struct pck Y { unsigned int k : 12, j : 11, i : 9; long double l; }; T(Y) -struct pck Z { long double l; unsigned int j : 13, i : 7, k : 12; }; T(Z) - -int -main (void) -{ - testA (); - testB (); - testC (); - testD (); - testE (); - testF (); - testG (); - testH (); - testI (); - testJ (); - testK (); - testL (); - testM (); - testN (); - testO (); - testP (); - testQ (); - testR (); - testS (); - testT (); - testU (); - testV (); - testW (); - testX (); - testY (); - testZ (); - exit (0); -} diff --git a/ir/be/test/compilerhang4.c b/ir/be/test/compilerhang4.c deleted file mode 100644 index 7366607f3..000000000 --- a/ir/be/test/compilerhang4.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -char* blup() -{ - char* p = "all ok"; - - if(0) { - int i = 0; - do { - *--p = '0' - i % 10; - } while((i /= 10) != 0); - - *--p = '-'; - } - - return p; -} - -int main() { - printf("result: %s\n", blup()); - return 0; -} diff --git a/ir/be/test/compress95.c b/ir/be/test/compress95.c deleted file mode 100644 index 352db5e89..000000000 --- a/ir/be/test/compress95.c +++ /dev/null @@ -1,1177 +0,0 @@ -/* - * Compress - data compression program - */ -#define min(a,b) ((a>b) ? b : a) - - -/* - * Set USERMEM to the maximum amount of physical user memory available - * in bytes. USERMEM is used to determine the maximum BITS that can be used - * for compression. - * - * SACREDMEM is the amount of physical memory saved for others; compress - * will hog the rest. - */ -/* For SPEC95 use, SACREDMEM automatically set to 0. - Jeff Reilly, 1/15/95 */ - -#define SACREDMEM 0 - -/* For SPEC95 use, USERMEM automatically set to 450000. - Jeff Reilly, 1/15/95 */ -# define USERMEM 450000 /* default user memory */ - -#ifdef interdata /* (Perkin-Elmer) */ -#define SIGNED_COMPARE_SLOW /* signed compare is slower than unsigned */ -#endif - -/* For SPEC95 use, PBITS and BITS automatically set to 16. - Jeff Reilyy, 1/15/95 */ -#define PBITS 16 -#define BITS 16 -#define HSIZE 69001 /* 95% occupancy */ - - -/* - * a code_int must be able to hold 2**BITS values of type int, and also -1 - */ -#if BITS > 15 -typedef long int code_int; -#else -typedef int code_int; -#endif - -#ifdef SIGNED_COMPARE_SLOW -typedef unsigned long int count_int; -typedef unsigned short int count_short; -#else -typedef long int count_int; -#endif - -#ifdef NO_UCHAR - typedef char char_type; -#else - typedef unsigned char char_type; -#endif /* UCHAR */ -char_type magic_header[] = { "\037\235" }; /* 1F 9D */ - -/* Defines for third byte of header */ -#define BIT_MASK 0x1f -#define BLOCK_MASK 0x80 -/* Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is - a fourth header byte (for expansion). -*/ -#define INIT_BITS 9 /* initial number of bits/code */ - -/* SPEC95, Original comments left - Jeff Reilly, 1/18/95 */ -/* - * compress.c - File compression ala IEEE Computer, June 1984. - * - * Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) - * Jim McKie (decvax!mcvax!jim) - * Steve Davies (decvax!vax135!petsd!peora!srd) - * Ken Turkowski (decvax!decwrl!turtlevax!ken) - * James A. Woods (decvax!ihnp4!ames!jaw) - * Joe Orost (decvax!vax135!petsd!joe) - * - * $Header$ - * $Log$ - * Revision 1.2 2006/07/08 10:06:28 matze - * fixed some more testapps - * - * Revision 1.1 2006/03/17 14:47:52 chriswue - * added addtional test file - * - * Revision 1.3 90/07/18 20:22:34 mips - * a few small changes for VMS, all of the ifdef VAX is gone. - * - * Revision 1.1 90/07/12 10:58:29 10:58:29 root () - * Initial revision - * - * Revision 4.0 85/07/30 12:50:00 joe - * Removed ferror() calls in output routine on every output except first. - * Prepared for release to the world. - * - * Revision 3.6 85/07/04 01:22:21 joe - * Remove much wasted storage by overlaying hash table with the tables - * used by decompress: tab_suffix[1<putc] and - * added signal catcher [plus beef in writeerr()] to delete effluvia. - * - * Revision 2.0 84/08/28 22:00:00 petsd!joe - * Add check for foreground before prompting user. Insert maxbits into - * compressed file. Force file being uncompressed to end with ".Z". - * Added "-c" flag and "zcat". Prepared for release. - * - * Revision 1.10 84/08/24 18:28:00 turtlevax!ken - * Will only compress regular files (no directories), added a magic number - * header (plus an undocumented -n flag to handle old files without headers), - * added -f flag to force overwriting of possibly existing destination file, - * otherwise the user is prompted for a response. Will tack on a .Z to a - * filename if it doesn't have one when decompressing. Will only replace - * file if it was compressed. - * - * Revision 1.9 84/08/16 17:28:00 turtlevax!ken - * Removed scanargs(), getopt(), added .Z extension and unlimited number of - * filenames to compress. Flags may be clustered (-Ddvb12) or separated - * (-D -d -v -b 12), or combination thereof. Modes and other status is - * copied with copystat(). -O bug for 4.2 seems to have disappeared with - * 1.8. - * - * Revision 1.8 84/08/09 23:15:00 joe - * Made it compatible with vax version, installed jim's fixes/enhancements - * - * Revision 1.6 84/08/01 22:08:00 joe - * Sped up algorithm significantly by sorting the compress chain. - * - * Revision 1.5 84/07/13 13:11:00 srd - * Added C version of vax asm routines. Changed structure to arrays to - * save much memory. Do unsigned compares where possible (faster on - * Perkin-Elmer) - * - * Revision 1.4 84/07/05 03:11:11 thomas - * Clean up the code a little and lint it. (Lint complains about all - * the regs used in the asm, but I'm not going to "fix" this.) - * - * Revision 1.3 84/07/05 02:06:54 thomas - * Minor fixes. - * - * Revision 1.2 84/07/05 00:27:27 thomas - * Add variable bit length output. - * - */ -static char rcs_ident[] = "$Header$"; - -#include -#include -#include -#ifdef VMS -#include -#include -#define unlink delete -#else -#include -#include -#endif /* VMS */ - -#define ARGVAL() (*++(*argv) || (--argc && *++argv)) - -int n_bits; /* number of bits/code */ -int maxbits = BITS; /* user settable max # bits/code */ -code_int maxcode; /* maximum code, given n_bits */ -code_int maxmaxcode = 1 << BITS; /* should NEVER generate this code */ -#ifdef COMPATIBLE /* But wrong! */ -# define MAXCODE(n_bits) (1 << (n_bits) - 1) -#else -# define MAXCODE(n_bits) ((1 << (n_bits)) - 1) -#endif /* COMPATIBLE */ - -#ifdef XENIX_16 -count_int htab0[8192]; -count_int htab1[8192]; -count_int htab2[8192]; -count_int htab3[8192]; -count_int htab4[8192]; -count_int htab5[8192]; -count_int htab6[8192]; -count_int htab7[8192]; -count_int htab8[HSIZE-65536]; -count_int * htab[9] = { - htab0, htab1, htab2, htab3, htab4, htab5, htab6, htab7, htab8 }; - -#define htabof(i) (htab[(i) >> 13][(i) & 0x1fff]) -unsigned short code0tab[16384]; -unsigned short code1tab[16384]; -unsigned short code2tab[16384]; -unsigned short code3tab[16384]; -unsigned short code4tab[16384]; -unsigned short * codetab[5] = { - code0tab, code1tab, code2tab, code3tab, code4tab }; - -#define codetabof(i) (codetab[(i) >> 14][(i) & 0x3fff]) - -#else /* Normal machine */ -count_int htab [HSIZE]; -unsigned short codetab [HSIZE]; -#define htabof(i) htab[i] -#define codetabof(i) codetab[i] -#endif /* XENIX_16 */ -code_int hsize = HSIZE; /* for dynamic table sizing */ -count_int fsize; - -/* - * To save much memory, we overlay the table used by compress() with those - * used by decompress(). The tab_prefix table is the same size and type - * as the codetab. The tab_suffix table needs 2**BITS characters. We - * get this from the beginning of htab. The output stack uses the rest - * of htab, and contains characters. There is plenty of room for any - * possible stack (stack used to be 8000 characters). - */ - -#define tab_prefixof(i) codetabof(i) -#ifdef XENIX_16 -# define tab_suffixof(i) ((char_type *)htab[(i)>>15])[(i) & 0x7fff] -# define de_stack ((char_type *)(htab2)) -#else /* Normal machine */ -# define tab_suffixof(i) ((char_type *)(htab))[i] -# define de_stack ((char_type *)&tab_suffixof(1< BITS) maxbits = BITS; - maxmaxcode = 1 << maxbits; - - InCnt = from_count; - InBuff = (unsigned char *)from_buf; - OutBuff = (unsigned char *)to_buf; - do_decomp = action; - - if (do_decomp == 0) { - compress(); -#ifdef DEBUG - if(verbose) dump_tab(); -#endif /* DEBUG */ - } else { - /* Check the magic number */ - if (nomagic == 0) { - if ((getbyte() != (magic_header[0] & 0xFF)) - || (getbyte() != (magic_header[1] & 0xFF))) { - fprintf(stderr, "stdin: not in compressed format\n"); - exit(1); - } - maxbits = getbyte(); /* set -b from file */ - block_compress = maxbits & BLOCK_MASK; - maxbits &= BIT_MASK; - maxmaxcode = 1 << maxbits; - fsize = 100000; /* assume stdin large for USERMEM */ - if(maxbits > BITS) { - fprintf(stderr, - "stdin: compressed with %d bits, can only handle %d bits\n", - maxbits, BITS); - exit(1); - } - } -#ifndef DEBUG - decompress(); -#else - if (debug == 0) decompress(); - else printcodes(); - if (verbose) dump_tab(); -#endif /* DEBUG */ - } - - return( OutBuff - (unsigned char *)to_buf ); -} - -static int offset; -long int in_count = 1; /* length of input */ -long int bytes_out; /* length of compressed output */ -long int out_count = 0; /* # of codes output (for debugging) */ - -/* - * compress (Originally: stdin to stdout -- Changed by SPEC to: memory to memory) - * - * Algorithm: use open addressing double hashing (no chaining) on the - * prefix code / next character combination. We do a variant of Knuth's - * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime - * secondary probe. Here, the modular division first probe is gives way - * to a faster exclusive-or manipulation. Also do block compression with - * an adaptive reset, whereby the code table is cleared when the compression - * ratio decreases, but after the table fills. The variable-length output - * codes are re-sized at this point, and a special CLEAR code is generated - * for the decompressor. Late addition: construct the table according to - * file size for noticeable speed improvement on small files. Please direct - * questions about this implementation to ames!jaw. - */ - -compress() { - register long fcode; - register code_int i = 0; - register int c; - register code_int ent; -#ifdef XENIX_16 - register code_int disp; -#else /* Normal machine */ - register int disp; -#endif - register code_int hsize_reg; - register int hshift; - -#ifndef COMPATIBLE - if (nomagic == 0) { - putbyte(magic_header[0]); putbyte(magic_header[1]); - putbyte((char)(maxbits | block_compress)); - } -#endif /* COMPATIBLE */ - - offset = 0; - bytes_out = 3; /* includes 3-byte header mojo */ - out_count = 0; - clear_flg = 0; - ratio = 0; - in_count = 1; - checkpoint = CHECK_GAP; - maxcode = MAXCODE(n_bits = INIT_BITS); - free_ent = ((block_compress) ? FIRST : 256 ); - - ent = getbyte (); - - hshift = 0; - for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L ) - hshift++; - hshift = 8 - hshift; /* set hash code range bound */ - - hsize_reg = hsize; - cl_hash( (count_int) hsize_reg); /* clear hash table */ - -#ifdef SIGNED_COMPARE_SLOW - while ( (c = getbyte()) != (unsigned) EOF ) { -#else - while ( (c = getbyte()) != EOF ) { -#endif - in_count++; - fcode = (long) (((long) c << maxbits) + ent); - i = ((c << hshift) ^ ent); /* xor hashing */ - - if ( htabof (i) == fcode ) { - ent = codetabof (i); - continue; - } else if ( (long)htabof (i) < 0 ) /* empty slot */ - goto nomatch; - disp = hsize_reg - i; /* secondary hash (after G. Knott) */ - if ( i == 0 ) - disp = 1; -probe: - if ( (i -= disp) < 0 ) - i += hsize_reg; - - if ( htabof (i) == fcode ) { - ent = codetabof (i); - continue; - } - if ( (long)htabof (i) > 0 ) - goto probe; -nomatch: - output ( (code_int) ent ); - out_count++; - ent = c; -#ifdef SIGNED_COMPARE_SLOW - if ( (unsigned) free_ent < (unsigned) maxmaxcode) { -#else - if ( free_ent < maxmaxcode ) { -#endif - codetabof (i) = free_ent++; /* code -> hashtable */ - htabof (i) = fcode; - } - else if ( (count_int)in_count >= checkpoint && block_compress ) - cl_block (); - } - /* - * Put out the final code. - */ - output( (code_int)ent ); - out_count++; - output( (code_int)-1 ); - - /* - * Print out stats on stderr - */ - if(zcat_flg == 0 && !quiet) { -#ifdef DEBUG - fprintf( stderr, - "%ld chars in, %ld codes (%ld bytes) out, compression factor: ", - in_count, out_count, bytes_out ); - prratio( stderr, in_count, bytes_out ); - fprintf( stderr, "\n"); - fprintf( stderr, "\tCompression as in compact: " ); - prratio( stderr, in_count-bytes_out, in_count ); - fprintf( stderr, "\n"); - fprintf( stderr, "\tLargest code (of last block) was %d (%d bits)\n", - free_ent - 1, n_bits ); -#else /* !DEBUG */ - fprintf( stderr, "Compression: " ); - prratio( stderr, in_count-bytes_out, in_count ); -#endif /* DEBUG */ - } - if(bytes_out > in_count) /* exit(2) if no savings */ - exit_stat = 2; - return; -} - -/***************************************************************** - * TAG( output ) - * - * Output the given code. - * Inputs: - * code: A n_bits-bit integer. If == -1, then EOF. This assumes - * that n_bits =< (long)wordsize - 1. - * Outputs: - * Outputs code to the file. - * Assumptions: - * Chars are 8 bits long. - * Algorithm: - * Maintain a BITS character long buffer (so that 8 codes will - * fit in it exactly). Use the VAX insv instruction to insert each - * code in turn. When the buffer fills up empty it and start over. - */ - -static char buf[BITS]; - -char_type lmask[9] = {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; -char_type rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; - -output( code ) -code_int code; -{ -#ifdef DEBUG - static int col = 0; -#endif /* DEBUG */ - - /* - * On the VAX, it is important to have the register declarations - * in exactly the order given, or the asm will break. - */ - register int r_off = offset, bits= n_bits; - register char * bp = buf; - -#ifdef DEBUG - if ( verbose ) - fprintf( stderr, "%5d%c", code, - (col+=6) >= 74 ? (col = 0, '\n') : ' ' ); -#endif /* DEBUG */ - if ( code >= 0 ) { -/* - * byte/bit numbering on the VAX is simulated by the following code - */ - /* - * Get to the first byte. - */ - bp += (r_off >> 3); - r_off &= 7; - /* - * Since code is always >= 8 bits, only need to mask the first - * hunk on the left. - */ - *bp = (*bp & rmask[r_off]) | (code << r_off) & lmask[r_off]; - bp++; - bits -= (8 - r_off); - code >>= 8 - r_off; - /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ - if ( bits >= 8 ) { - *bp++ = code; - code >>= 8; - bits -= 8; - } - /* Last bits. */ - if(bits) - *bp = code; - offset += n_bits; - if ( offset == (n_bits << 3) ) { - bp = buf; - bits = n_bits; - bytes_out += bits; - do - putbyte(*bp++); - while(--bits); - offset = 0; - } - - /* - * If the next entry is going to be too big for the code size, - * then increase it, if possible. - */ - if ( free_ent > maxcode || (clear_flg > 0)) - { - /* - * Write the whole buffer, because the input side won't - * discover the size increase until after it has read it. - */ - if ( offset > 0 ) { - writebytes( buf, n_bits ); - bytes_out += n_bits; - } - offset = 0; - - if ( clear_flg ) { - maxcode = MAXCODE (n_bits = INIT_BITS); - clear_flg = 0; - } - else { - n_bits++; - if ( n_bits == maxbits ) - maxcode = maxmaxcode; - else - maxcode = MAXCODE(n_bits); - } -#ifdef DEBUG - if ( debug ) { - fprintf( stderr, "\nChange to %d bits\n", n_bits ); - col = 0; - } -#endif /* DEBUG */ - } - } else { - /* - * At EOF, write the rest of the buffer. - */ - if ( offset > 0 ) - writebytes( buf, ((offset + 7) / 8) ); - bytes_out += (offset + 7) / 8; - offset = 0; -#ifdef DEBUG - if ( verbose ) - fprintf( stderr, "\n" ); -#endif /* DEBUG */ - } -} - -/* - * Decompress stdin to stdout. This routine adapts to the codes in the - * file building the "string" table on-the-fly; requiring no table to - * be stored in the compressed file. The tables used herein are shared - * with those of the compress() routine. See the definitions above. - */ - -decompress() { - register char_type *stackp; - register int finchar; - register code_int code, oldcode, incode; - - /* - * As above, initialize the first 256 entries in the table. - */ - maxcode = MAXCODE(n_bits = INIT_BITS); - for ( code = 255; code >= 0; code-- ) { - tab_prefixof(code) = 0; - tab_suffixof(code) = (char_type)code; - } - free_ent = ((block_compress) ? FIRST : 256 ); - - finchar = oldcode = getcode(); - if(oldcode == -1) /* EOF already? */ - return; /* Get out of here */ - putbyte( (char)finchar ); /* first code must be 8 bits = char */ - stackp = de_stack; - - while ( (code = getcode()) > -1 ) { - - if ( (code == CLEAR) && block_compress ) { - for ( code = 255; code >= 0; code-- ) - tab_prefixof(code) = 0; - clear_flg = 1; - free_ent = FIRST - 1; - if ( (code = getcode ()) == -1 ) /* O, untimely death! */ - break; - } - incode = code; - /* - * Special case for KwKwK string. - */ - if ( code >= free_ent ) { - *stackp++ = finchar; - code = oldcode; - } - - /* - * Generate output characters in reverse order - */ -#ifdef SIGNED_COMPARE_SLOW - while ( ((unsigned long)code) >= ((unsigned long)256) ) { -#else - while ( code >= 256 ) { -#endif - *stackp++ = tab_suffixof(code); - code = tab_prefixof(code); - } - *stackp++ = finchar = tab_suffixof(code); - - /* - * And put them out in forward order - */ - do - putbyte ( *--stackp ); - while ( stackp > de_stack ); - - /* - * Generate the new entry. - */ - if ( (code=free_ent) < maxmaxcode ) { - tab_prefixof(code) = (unsigned short)oldcode; - tab_suffixof(code) = finchar; - free_ent = code+1; - } - /* - * Remember previous code. - */ - oldcode = incode; - } -} - -/***************************************************************** - * TAG( getcode ) - * - * Read one code from the standard input. If EOF, return -1. - * Inputs: - * stdin - * Outputs: - * code or -1 is returned. - */ - -code_int -getcode() { - /* - * On the VAX, it is important to have the register declarations - * in exactly the order given, or the asm will break. - */ - register code_int code; - static int offset = 0, size = 0; - static char_type buf[BITS]; - register int r_off, bits; - register char_type *bp = buf; - - if ( clear_flg > 0 || offset >= size || free_ent > maxcode ) { - /* - * If the next entry will be too big for the current code - * size, then we must increase the size. This implies reading - * a new buffer full, too. - */ - if ( free_ent > maxcode ) { - n_bits++; - if ( n_bits == maxbits ) - maxcode = maxmaxcode; /* won't get any bigger now */ - else - maxcode = MAXCODE(n_bits); - } - if ( clear_flg > 0) { - maxcode = MAXCODE (n_bits = INIT_BITS); - clear_flg = 0; - } - size = readbytes( buf, n_bits ); - if ( size <= 0 ) - return -1; /* end of file */ - offset = 0; - /* Round size down to integral number of codes */ - size = (size << 3) - (n_bits - 1); - } - r_off = offset; - bits = n_bits; - /* - * Get to the first byte. - */ - bp += (r_off >> 3); - r_off &= 7; - /* Get first part (low order bits) */ -#ifdef NO_UCHAR - code = ((*bp++ >> r_off) & rmask[8 - r_off]) & 0xff; -#else - code = (*bp++ >> r_off); -#endif /* NO_UCHAR */ - bits -= (8 - r_off); - r_off = 8 - r_off; /* now, offset into code word */ - /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ - if ( bits >= 8 ) { -#ifdef NO_UCHAR - code |= (*bp++ & 0xff) << r_off; -#else - code |= *bp++ << r_off; -#endif /* NO_UCHAR */ - r_off += 8; - bits -= 8; - } - /* high order bits. */ - code |= (*bp & rmask[bits]) << r_off; - offset += n_bits; - - return code; -} - -char * -rindex(s, c) /* For those who don't have it in libc.a */ -register char *s, c; -{ - char *p; - for (p = NULL; *s; s++) - if (*s == c) - p = s; - return(p); -} - -#ifdef DEBUG -printcodes() -{ - /* - * Just print out codes from input file. For debugging. - */ - code_int code; - int col = 0, bits; - - bits = n_bits = INIT_BITS; - maxcode = MAXCODE(n_bits); - free_ent = ((block_compress) ? FIRST : 256 ); - while ( ( code = getcode() ) >= 0 ) { - if ( (code == CLEAR) && block_compress ) { - free_ent = FIRST - 1; - clear_flg = 1; - } - else if ( free_ent < maxmaxcode ) - free_ent++; - if ( bits != n_bits ) { - fprintf(stderr, "\nChange to %d bits\n", n_bits ); - bits = n_bits; - col = 0; - } - fprintf(stderr, "%5d%c", code, (col+=6) >= 74 ? (col = 0, '\n') : ' ' ); - } - putc( '\n', stderr ); - exit( 0 ); -} - -code_int sorttab[1<= 0) { - sorttab[codetabof(i)] = i; - } - } - first = block_compress ? FIRST : 256; - for(i = first; i < free_ent; i++) { - fprintf(stderr, "%5d: \"", i); - de_stack[--stack_top] = '\n'; - de_stack[--stack_top] = '"'; - stack_top = in_stack((htabof(sorttab[i])>>maxbits)&0xff, - stack_top); - for(ent=htabof(sorttab[i]) & ((1< 256; - ent=htabof(sorttab[ent]) & ((1<> maxbits, - stack_top); - } - stack_top = in_stack(ent, stack_top); - fwrite( &de_stack[stack_top], 1, STACK_SIZE-stack_top, stderr); - stack_top = STACK_SIZE; - } - } else if(!debug) { /* decompressing */ - - for ( i = 0; i < free_ent; i++ ) { - ent = i; - c = tab_suffixof(ent); - if ( isascii(c) && isprint(c) ) - fprintf( stderr, "%5d: %5d/'%c' \"", - ent, tab_prefixof(ent), c ); - else - fprintf( stderr, "%5d: %5d/\\%03o \"", - ent, tab_prefixof(ent), c ); - de_stack[--stack_top] = '\n'; - de_stack[--stack_top] = '"'; - for ( ; ent != NULL; - ent = (ent >= FIRST ? tab_prefixof(ent) : NULL) ) { - stack_top = in_stack(tab_suffixof(ent), stack_top); - } - fwrite( &de_stack[stack_top], 1, STACK_SIZE - stack_top, stderr ); - stack_top = STACK_SIZE; - } - } -} - -int -in_stack(c, stack_top) - register c, stack_top; -{ - if ( (isascii(c) && isprint(c) && c != '\\') || c == ' ' ) { - de_stack[--stack_top] = c; - } else { - switch( c ) { - case '\n': de_stack[--stack_top] = 'n'; break; - case '\t': de_stack[--stack_top] = 't'; break; - case '\b': de_stack[--stack_top] = 'b'; break; - case '\f': de_stack[--stack_top] = 'f'; break; - case '\r': de_stack[--stack_top] = 'r'; break; - case '\\': de_stack[--stack_top] = '\\'; break; - default: - de_stack[--stack_top] = '0' + c % 8; - de_stack[--stack_top] = '0' + (c / 8) % 8; - de_stack[--stack_top] = '0' + c / 64; - break; - } - de_stack[--stack_top] = '\\'; - } - return stack_top; -} -#endif /* DEBUG */ - - -#ifdef SYSV -void -#endif /* SYSV */ -onintr ( ) -{ - unlink ( ofname ); - exit ( 1 ); -} - -#ifdef SYSV -void -#endif /* SYSV */ -oops ( ) /* wild pointer -- assume bad input */ -{ - if ( do_decomp == 1 ) - fprintf ( stderr, "uncompress: corrupt input\n" ); - unlink ( ofname ); - exit ( 1 ); -} - -cl_block () /* table clear for block compress */ -{ - register long int rat; - - checkpoint = in_count + CHECK_GAP; -#ifdef DEBUG - if ( debug ) { - fprintf ( stderr, "count: %ld, ratio: ", in_count ); - prratio ( stderr, in_count, bytes_out ); - fprintf ( stderr, "\n"); - } -#endif /* DEBUG */ - - if(in_count > 0x007fffff) { /* shift will overflow */ - rat = bytes_out >> 8; - if(rat == 0) { /* Don't divide by zero */ - rat = 0x7fffffff; - } else { - rat = in_count / rat; - } - } else { - rat = (in_count << 8) / bytes_out; /* 8 fractional bits */ - } - if ( rat > ratio ) { - ratio = rat; - } else { - ratio = 0; -#ifdef DEBUG - if(verbose) - dump_tab(); /* dump string table */ -#endif - cl_hash ( (count_int) hsize ); - free_ent = FIRST; - clear_flg = 1; - output ( (code_int) CLEAR ); -#ifdef DEBUG - if(debug) - fprintf ( stderr, "clear\n" ); -#endif /* DEBUG */ - } -} - -cl_hash(hsize) /* reset code table */ - register count_int hsize; -{ -#ifndef XENIX_16 /* Normal machine */ - register count_int *htab_p = htab+hsize; -#else - register j; - register long k = hsize; - register count_int *htab_p; -#endif - register long i; - register long m1 = -1; - -#ifdef XENIX_16 - for(j=0; j<=8 && k>=0; j++,k-=8192) { - i = 8192; - if(k < 8192) { - i = k; - } - htab_p = &(htab[j][i]); - i -= 16; - if(i > 0) { -#else - i = hsize - 16; -#endif - do { /* might use Sys V memset(3) here */ - *(htab_p-16) = m1; - *(htab_p-15) = m1; - *(htab_p-14) = m1; - *(htab_p-13) = m1; - *(htab_p-12) = m1; - *(htab_p-11) = m1; - *(htab_p-10) = m1; - *(htab_p-9) = m1; - *(htab_p-8) = m1; - *(htab_p-7) = m1; - *(htab_p-6) = m1; - *(htab_p-5) = m1; - *(htab_p-4) = m1; - *(htab_p-3) = m1; - *(htab_p-2) = m1; - *(htab_p-1) = m1; - htab_p -= 16; - } while ((i -= 16) >= 0); -#ifdef XENIX_16 - } - } -#endif - for ( i += 16; i > 0; i-- ) - *--htab_p = m1; -} - -prratio(stream, num, den) -FILE *stream; -long int num, den; -{ - register int q; /* Doesn't need to be long */ - - if(num > 214748L) { /* 2147483647/10000 */ - q = num / (den / 10000L); - } else { - q = 10000L * num / den; /* Long calculations, though */ - } - if (q < 0) { - putc('-', stream); - q = -q; - } - fprintf(stream, "%d.%02d%%", q / 100, q % 100); -} - -version() -{ - fprintf(stderr, "%s\n", rcs_ident); - fprintf(stderr, "Options: "); -#ifdef NO_UCHAR - fprintf(stderr, "NO_UCHAR, "); -#endif -#ifdef SIGNED_COMPARE_SLOW - fprintf(stderr, "SIGNED_COMPARE_SLOW, "); -#endif -#ifdef XENIX_16 - fprintf(stderr, "XENIX_16, "); -#endif -#ifdef COMPATIBLE - fprintf(stderr, "COMPATIBLE, "); -#endif -#ifdef DEBUG - fprintf(stderr, "DEBUG, "); -#endif -#ifdef BSD4_2 - fprintf(stderr, "BSD4_2, "); -#endif - fprintf(stderr, "BITS = %d\n", BITS); -} - - - - -/* SPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPECSPEC */ -getbyte() -{ - if( InCnt > 0 ) { - InCnt--; - return( (unsigned int)*InBuff++ ); - } else { - return( -1 ); - } -} - -putbyte( c ) -char c; -{ - *OutBuff++ = c; -} - -readbytes( buf, n ) -char *buf; -int n; -{ - int i; - - if( InCnt <= 0 ) - return( -1 ); - - if( n > InCnt ) - n = InCnt; - - for( i=0; i 42) x = 42; - return x; -} -#endif - - -#if 1 -static __inline int g(int x) -{ - return x == 42; -} - -void h(int x) -{ - if (g(x)) { - puts("1"); - } else { - puts("2"); - } -} -#endif - - -#if 1 -int rand(void); - -void i(void) -{ - int finish = 0; - int x; - int y; - int z; - - for (x = 0; x < 10 && !finish; x++) { - for (y = 0; y < 10 && !finish; y++) { - for (z = 0; z < 10 && !finish; z++) { - if (rand()) - finish = 1; - //a(); - } - } - } -} -#endif - - -#if 1 -int rand(void); - -void j(void) -{ - int finish = 0; - int x; - int y; - int z; - - for (x = 0; !finish; x++) { - for (y = 0; !finish; y++) { - for (z = 0; !finish; z++) { - if (rand()) finish = 1; - } - } - } -} -#endif - - -#if 1 -static __inline int k(int x) -{ - if (x < 23) x = 23; - if (x > 42) x = 42; - return x; -} - -int l(int x) -{ - return k(x) == 23; -} -#endif - -int main() { - return 0; -} diff --git a/ir/be/test/confirm.c b/ir/be/test/confirm.c deleted file mode 100644 index ec20e886b..000000000 --- a/ir/be/test/confirm.c +++ /dev/null @@ -1,59 +0,0 @@ -#include - -int looptest(int x) { - while (x) { - printf("%d\n", x); - } - if (x) { - printf("%d\n", x); - } - return x; -} - - -int xtest(int x) { - if (x) { - printf("%d\n", x); - } - if (x) { - printf("%d\n", x); - } - return x; -} - -int test(int a, int b) { - int x = a * b; - if (a == 0) - return x; - else - return x - 1; -} - -static int abs(int x) { - if (x < 0) - return -x; - return x; -} - -int test2(int a, int b) { - if (a > 0) { - return abs(a); - } - return b; -} - -int test3(int a, int b) { - if (a != 0) { - b = b / -a; - } - return b; -} - -int main(void) { - looptest(0); - printf("xtest() = %d\n", xtest(1)); - printf("test() = %d\n", test(0, 1)); - printf("test2() = %d\n", test2(1, 3)); - printf("test3() = %d\n", test3(-3, 3)); - return 0; -} diff --git a/ir/be/test/const.c b/ir/be/test/const.c deleted file mode 100644 index 0bfce4995..000000000 --- a/ir/be/test/const.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("%d\n", 0x1e00000); - return 0; -} diff --git a/ir/be/test/const_load.c b/ir/be/test/const_load.c deleted file mode 100644 index 9ad98479e..000000000 --- a/ir/be/test/const_load.c +++ /dev/null @@ -1,21 +0,0 @@ -static const int arr[] = { 1, 2, 3 }; - -static int func1(void) { - return arr[1]; -} - -static const struct X { int a, b[2]; } data[] = { {1,{2, 3}}, {4,{5, 6}} }; - -static int func2(void) { - return *data[1].b; -} - -static const int darr[][2] = { {1,2}, {2,3} }; - -static int func3(void) { - return darr[1][1]; -} - -int main(int argc, char *argv[]) { - return func1() + func2() + func3() != 10; -} diff --git a/ir/be/test/conv.c b/ir/be/test/conv.c deleted file mode 100644 index 3ac08fe46..000000000 --- a/ir/be/test/conv.c +++ /dev/null @@ -1,72 +0,0 @@ -int convs16_s32( short t) __attribute__((noinline)); -short convs32_s16( int t) __attribute__((noinline)); - -int convu16_s32( unsigned short t) __attribute__((noinline)); -short convu32_s16( unsigned int t) __attribute__((noinline)); - -unsigned int convs16_u32( short t) __attribute__((noinline)); -unsigned short convs32_u16( int t) __attribute__((noinline)); - -unsigned int convu16_u32( unsigned short t) __attribute__((noinline)); -unsigned short convu32_u16( unsigned int t) __attribute__((noinline)); - -int convs16_s32( short t) -{ - return t; -} - -short convs32_s16( int t) -{ - return t; -} - -int convu16_s32( unsigned short t) -{ - return t; -} - -short convu32_s16( unsigned int t) -{ - return t; -} - -unsigned int convs16_u32( short t) -{ - return t; -} - -unsigned short convs32_u16( int t) -{ - return t; -} - -unsigned int convu16_u32( unsigned short t) -{ - return t; -} - -unsigned short convu32_u16( unsigned int t) -{ - return t; -} - -int main() -{ - short s = 0x8000; - int i = 0xF0008000; - int a; - - printf(" %d -> %d = %d\n", s, i, convs16_s32( s)); - printf(" %d -> %d = %d\n", i, s, convs32_s16( i)); - - printf(" %d -> %d = %d\n", i, s, convu32_s16( i)); - printf(" %d -> %d = %d\n", i, s, convu32_s16( i)); - - printf(" %d -> %d = %d\n", i, s, convs32_u16( i)); - printf(" %d -> %d = %d\n", i, s, convs32_u16( i)); - - printf(" %d -> %d = %d\n", i, s, convu32_u16( i)); - printf(" %d -> %d = %d\n", i, s, convu32_u16( i)); - - return 0; -} diff --git a/ir/be/test/conv_orgie.c b/ir/be/test/conv_orgie.c deleted file mode 100644 index 9280d9acd..000000000 --- a/ir/be/test/conv_orgie.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -double a; - -double test(double d) { - float x = d; - double d1 = x; - float x1 = d1; - return x1; -} - -int main() { - printf("%f\n", test(a)); - return 0; -} diff --git a/ir/be/test/convfloat.c b/ir/be/test/convfloat.c deleted file mode 100644 index 0f4200143..000000000 --- a/ir/be/test/convfloat.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#ifdef __GNUC__ -long long int conv_dbl_to_ll(double d) __attribute__((noinline)); - -long long int add_dbl_to_ll(double d1, double d2) __attribute__((noinline)); -#endif - -long long int conv_dbl_to_ll(double d) { - return d; -} - -long long int add_dbl_to_ll(double d1, double d2) { - long long int a = d1; - long long int b = d2; - - return d1 + d2; -} - -int main(int argc) { - double d = 5.45, d1 = 1.00, d2 = 2.5; - - printf("double (%lf) -> int = %lld\n", d, conv_dbl_to_ll(d)); - printf("double (%lf + %lf) -> int = %lld\n", d1, d2, add_dbl_to_ll(d1, d2)); - - return 0; -} diff --git a/ir/be/test/convtest.c b/ir/be/test/convtest.c deleted file mode 100644 index 43b489e97..000000000 --- a/ir/be/test/convtest.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int bla(char a, char b, char c, char d, short e, short f, short g, int h, int i, float j) { - return a + b + c + d + e + f + g + h + i + (int)j; -} - -int convtest_func(char c, short s, int i, float f, double d) { - char sc = c + s; - char ic = c + i; - char fc = c + f; - char dc = c + d; - short is = s + i; - short fs = s + f; - short ds = s + d; - //int ti = i + s; - int fi = i + f; - int di = i + d; - float df = d + f; - - return bla(sc, ic, fc, dc, is, fs, ds, fi, di, df); -} - -int main() { - printf("%d (expected 7576)\n", convtest_func('a', 42, 2444, 7.753f, 8.222)); - return 0; -} diff --git a/ir/be/test/csetest.c b/ir/be/test/csetest.c deleted file mode 100644 index 1b459315f..000000000 --- a/ir/be/test/csetest.c +++ /dev/null @@ -1,20 +0,0 @@ -/*$ -fno-inline $*/ -#include - -int cse1(int a) { - int x = a * 3; - int y = 3 * a; - return x + y; -} - -int cse2(int a, int b) { - int x = a * b; - int y = b * a; - return x - y; -} - -int main() { - printf("cse1(3) = %d (should be 18)\n", cse1(3)); - printf("cse2(3,4) = %d (should be 0)\n", cse2(3,4)); - return 0; -} diff --git a/ir/be/test/d.c b/ir/be/test/d.c deleted file mode 100644 index ab338fd4f..000000000 --- a/ir/be/test/d.c +++ /dev/null @@ -1,44 +0,0 @@ -#include - -char C = 1; -short S = 2; -int I = 4; -long L = 4; -long long LL = 8; - -float F = 4.0; -double D = 8.0; -long double LD = 10.0; - -int a, b = 3; - -int d = 4; - -float fadd(float a, float b) -{ - return a + b; -} - -float fadd_m(float a) -{ - return a + F; -} - -int iadd(int a, int b) -{ - return a + b + (a*b) + (a / d); -} - -int iadd_m(int a) -{ - return a + I; -} - -int main (int argc, char *argv[]) { - printf("Float Add %f\n", fadd(F, 5)); - printf("Float Add+m %f\n", fadd_m(5)); - printf("Int Add %d\n", iadd(I, 5)); - printf("Int Add+m %d\n", iadd_m(5)); - - return 0; -} diff --git a/ir/be/test/dblstruct.c b/ir/be/test/dblstruct.c deleted file mode 100644 index b59f39985..000000000 --- a/ir/be/test/dblstruct.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -typedef struct TypeToken -{ - int Handle; -} tokentype; - -typedef struct CppObjTypeDesc -{ - int Handle; -} cppobjtype; - - -int test(cppobjtype *CppObject, tokentype *Anchor) -{ - CppObject->Handle = Anchor->Handle; - return 1; -} - -int main() -{ - cppobjtype CppObject; - tokentype Anchor; - - printf("%d\n", test(&CppObject, &Anchor)); - - return 0; -} diff --git a/ir/be/test/deadstores.c b/ir/be/test/deadstores.c deleted file mode 100644 index 430eefc4b..000000000 --- a/ir/be/test/deadstores.c +++ /dev/null @@ -1,19 +0,0 @@ -int a; -static int b; -struct { int a, b; } c; -static struct { int a, b; } d; -static int e; -int *ptr = &e; - -int main(void) { - union { int a; char arr[4]; } u; - - a = 1; - b = 0x42; - c.a = 2; - d.a = 0x42; - e = 3; - u.a = 0x42; - - return 0; -} diff --git a/ir/be/test/diffreports.pl b/ir/be/test/diffreports.pl deleted file mode 100644 index e3cff9738..000000000 --- a/ir/be/test/diffreports.pl +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use XML::Simple; -use Data::Dumper; - -my $resfile_name = "result.xml"; - -my $old_file = $ARGV[0]."/".$resfile_name; -my $new_file = $ARGV[1]."/".$resfile_name; -my $diff_file = "results_diff.xml"; - -$| = 1; # perform flush after each write to STDOUT - -print "reading $old_file ... "; -my $start = time; -my $res_old = XMLin("$old_file", forcearray => 1); -print "done (", time - $start," s)\n"; - -print "reading $new_file ... "; -$start = time; -my $res_new = XMLin("$new_file", forcearray => 1); -print "done (", time - $start," s)\n"; - -open(DIFF, ">$diff_file") or die "Could not open $diff_file, reason:$!\n"; - -print DIFF "\n"; -print DIFF "\n"; -print DIFF " \n"; -print DIFF " $old_file\n"; -print DIFF " $new_file\n"; -print DIFF " \n"; - -if (! exists($res_old->{"environment"})) { - print "environment missing in $old_file!\n"; -} -elsif (! exists($res_new->{"environment"})) { - print "environment missing in $new_file!\n"; -} -else { - print DIFF " \n"; - print DIFF " \n"; - - my %env = %{ @{ $res_old->{"environment"} }[0] }; - - foreach (keys(%env)) { - print DIFF " <$_>", @{ $env{"$_"} }[0], "\n"; - } - print DIFF " \n"; - print DIFF " \n"; - - %env = %{ @{ $res_new->{"environment"} }[0] }; - - foreach (keys(%env)) { - print DIFF " <$_>", @{ $env{"$_"} }[0], "\n"; - } - print DIFF " \n"; - print DIFF " \n"; -} - -my $section_old = $res_old->{"section"}; -my $section_new = $res_new->{"section"}; - -foreach (keys(%{ $section_old })) { - if (! exists($section_new->{"$_"})) { - print "Section $_ missing in $new_file!\n"; - next; - } - - print DIFF "
\n"; - - my $old = $section_old->{"$_"}{"result"}; - my $new = $section_new->{"$_"}{"result"}; - - foreach my $test (keys(%{ $old })) { - my $entry_old = $old->{"$test"}; - my $entry_new = $new->{"$test"}; - my $has_diff = 0; - - if (! exists($new->{"$test"})) { - foreach my $k1 (keys(%{ $entry_old })) { - $entry_new->{"$k1"} = [ 'missing' ]; - $has_diff = 1; - } - } - else { - foreach my $k (keys(%{ $entry_old })) { - if (! exists($entry_new->{"$k"})) { - $entry_new->{"$k"} = [ 'missing' ]; - $has_diff = 1; - } - else { - my @val_old = @{ $entry_old->{"$k"} }; - my @val_new = @{ $entry_new->{"$k"} }; - if ($val_old[0] ne $val_new[0]) { - $has_diff = 1; - } - } - } - } - - if ($has_diff == 1) { - print DIFF " \n"; - print DIFF " \n"; - emit_entry($entry_old); - print DIFF " \n"; - print DIFF " \n"; - emit_entry($entry_new); - print DIFF " \n"; - print DIFF " \n"; - } - } - - print DIFF "
\n"; -} - -print DIFF "
\n"; - -close(DIFF); - -print "processing results_diff.xml ... "; -`xsltproc --output results_diff.html makediffhtml.xslt results_diff.xml`; -print "results_diff.html created\n"; - -sub emit_entry { - my $href = shift; - - foreach (keys(%{ $href })) { - my @val = @{ $href->{"$_"} }; - print DIFF " <$_>", $val[0], "\n"; - } -} diff --git a/ir/be/test/distributive.c b/ir/be/test/distributive.c deleted file mode 100644 index 9c050dc8f..000000000 --- a/ir/be/test/distributive.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -#define T_(op1, op2, va, vb, vc) a = va; b = vb; c = vc; \ - fprintf(stderr, "Test: (%d %s %d) %s (%d %s %d) -> ", a, #op1, c, #op2, b, #op1, c);\ - fprintf(stderr, "%d\n", ((a op1 c) op2 (b op1 c))); - -#define T(op1, op2) T_(op1, op2, rand(), rand(), rand()) T_(op1, op2, rand(), rand(), 42) - -#define TU_(op1, op2, va, vb) a = va; b = vb; \ - fprintf(stderr, "Test: (%s %d) %s (%s %d) -> ", #op1, a, #op2, #op1, b); \ - fprintf(stderr, "%d\n", ((op1 a) op2 (op1 b))); - -#define TU(op1, op2) TU_(op1, op2, rand(), rand()) - -#define TT(op) T(&,op); T(|,op); T(^,op); T(&&,op); T(||,op); T(*,op); T(/,op); T(%,op); T(+,op); T(-,op); TU(-,op); TU(!,op); - -#define TS(op) T(&,op); T(|,op); T(^,op); T(&&,op); T(||,op); T(*,op); T(+,op); T(-,op); TU(-,op); - -int main() -{ - int a, b, c; - srand(1234); - - TT(&); - TT(|); - TT(^); - TT(&&); - TT(||); - TT(*); - TS(/); - TS(%); - TT(+); - TT(-); - - return 0; -} diff --git a/ir/be/test/divs.c b/ir/be/test/divs.c deleted file mode 100644 index 965cc3763..000000000 --- a/ir/be/test/divs.c +++ /dev/null @@ -1,26 +0,0 @@ -int x = 42; -int y = 10; - -int signed_div(int x, int y) { - printf("%d (should be 4)\n", x / y); - printf("%d (should be 2)\n", x % y); - return (x / y) + (x % y); -} - -unsigned int unsigned_div(unsigned int x, unsigned int y) { - printf("%u (should be 4)\n", x / y); - printf("%u (should be 2)\n", x % y); - return (x / y) + (x % y); -} - -double f_div(double x, double y) { - printf("%f (should be 4.2)\n", x / y); - return (x / y); -} - -int main(void) { - int x = signed_div(42, 10) - + unsigned_div(42, 10) - + f_div(42.0, 10.0); - return 16-x; -} diff --git a/ir/be/test/divtest.c b/ir/be/test/divtest.c deleted file mode 100644 index 03509565d..000000000 --- a/ir/be/test/divtest.c +++ /dev/null @@ -1,47 +0,0 @@ -int divtest_1(int a) -{ - return a / 2; -} - -int divtest_2(int a) -{ - return a / 8; -} - -unsigned divtest_3(unsigned a) -{ - return a / 8; -} - -int modtest_1(int a) -{ - return a % 2; -} - -int modtest_2(int a) -{ - return a % 8; -} - -unsigned modtest_3(unsigned a) -{ - return a % 8; -} - -int main() -{ - printf("+7 DIV +3 = %+d +7 MOD +3 = %+d\n", +7 / +3, +7 % +3); - printf("-7 DIV +3 = %+d -7 MOD +3 = %+d\n", -7 / +3, -7 % +3); - printf("+7 DIV -3 = %+d +7 MOD -3 = %+d\n", +7 / -3, +7 % -3); - printf("-7 DIV -3 = %+d -7 MOD -3 = %+d\n", -7 / -3, -7 % -3); - - printf("DivTest 1 = %d\n", divtest_1(17)); - printf("DivTest 2 = %d\n", divtest_2(-17)); - printf("DivTest 3 = %u\n", divtest_3(17)); - - printf("ModTest 1 = %d\n", modtest_1(17)); - printf("ModTest 2 = %d\n", modtest_2(-17)); - printf("ModTest 3 = %u\n", modtest_3(17)); - - return 0; -} diff --git a/ir/be/test/dowhile.c b/ir/be/test/dowhile.c deleted file mode 100644 index 0c51be899..000000000 --- a/ir/be/test/dowhile.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -int main() -{ - char *p = "Hallo Welt\n"; - int i = 0; - - do { - putchar(*p); - ++i; - if(i < 5) - continue; - putchar('.'); - i = 0; - } while(*++p != 0); - - return 0; -} diff --git a/ir/be/test/duffs.c b/ir/be/test/duffs.c deleted file mode 100644 index f089964c4..000000000 --- a/ir/be/test/duffs.c +++ /dev/null @@ -1,32 +0,0 @@ -const char *str = "12345678901234567890"; - -char str1[20], str2[20], str3[20]; - -char *duff_copy(char *dst, const char *from, int count) -{ - int n = (count+7)/8; - char *to = dst; - - switch (count % 8){ - do { - case 0: *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - }while(--n > 0); - } - return dst; -} - -int main(int argc, char *argv[]) -{ - printf("duff's Device 15 : %s\n", duff_copy(str1, str, 15)); - printf("duff's Device 3 : %s\n", duff_copy(str2, str, 3)); - printf("duff's Device 8 : %s\n", duff_copy(str2, str, 8)); - - return 0; -} diff --git a/ir/be/test/dumpmem.h b/ir/be/test/dumpmem.h deleted file mode 100644 index b3e9171c1..000000000 --- a/ir/be/test/dumpmem.h +++ /dev/null @@ -1,15 +0,0 @@ -#include - -static void dumpMem(void* ptr, size_t size) -{ - size_t i; - unsigned char* p = ptr; - printf("\n"); - for(i = 0; i < size; ++i) { - printf("%02x", p[i]); - if((i % 4) == 3) { - printf("\n"); - } - } - printf("\n"); -} diff --git a/ir/be/test/enum.c b/ir/be/test/enum.c deleted file mode 100644 index 1600ec904..000000000 --- a/ir/be/test/enum.c +++ /dev/null @@ -1,16 +0,0 @@ -enum t { - a, b, c, d = 5 -}; - -int main(int argc, char *argv[]) -{ - enum t x; - - x = a; - printf("a = %d\n", a); - printf("b = %d\n", b); - printf("c = %d\n", c); - printf("d = %d\n", d); - - return 0; -} diff --git a/ir/be/test/extreme/paranoia.c b/ir/be/test/extreme/paranoia.c deleted file mode 100644 index e8b516f8d..000000000 --- a/ir/be/test/extreme/paranoia.c +++ /dev/null @@ -1,2255 +0,0 @@ -#define NOPAUSE -/* A C version of Kahan's Floating Point Test "Paranoia" - - Thos Sumner, UCSF, Feb. 1985 - David Gay, BTL, Jan. 1986 - - This is a rewrite from the Pascal version by - - B. A. Wichmann, 18 Jan. 1985 - - (and does NOT exhibit good C programming style). - - Adjusted to use Standard C headers 19 Jan. 1992 (dmg); - compile with -DKR_headers or insert -#define KR_headers - at the beginning if you have an old-style C compiler. - -(C) Apr 19 1983 in BASIC version by: - Professor W. M. Kahan, - 567 Evans Hall - Electrical Engineering & Computer Science Dept. - University of California - Berkeley, California 94720 - USA - -converted to Pascal by: - B. A. Wichmann - National Physical Laboratory - Teddington Middx - TW11 OLW - UK - -converted to C by: - - David M. Gay and Thos Sumner - AT&T Bell Labs Computer Center, Rm. U-76 - 600 Mountain Avenue University of California - Murray Hill, NJ 07974 San Francisco, CA 94143 - USA USA - -with simultaneous corrections to the Pascal source (reflected -in the Pascal source available over netlib). -[A couple of bug fixes from dgh = sun!dhough incorporated 31 July 1986.] - -Reports of results on various systems from all the versions -of Paranoia are being collected by Richard Karpinski at the -same address as Thos Sumner. This includes sample outputs, -bug reports, and criticisms. - -You may copy this program freely if you acknowledge its source. -Comments on the Pascal version to NPL, please. - - -The C version catches signals from floating-point exceptions. -If signal(SIGFPE,...) is unavailable in your environment, you may -#define NOSIGNAL to comment out the invocations of signal. - -This source file is too big for some C compilers, but may be split -into pieces. Comments containing "SPLIT" suggest convenient places -for this splitting. At the end of these comments is an "ed script" -(for the UNIX(tm) editor ed) that will do this splitting. - -By #defining Single when you compile this source, you may obtain -a single-precision C version of Paranoia. - - -The following is from the introductory commentary from Wichmann's work: - -The BASIC program of Kahan is written in Microsoft BASIC using many -facilities which have no exact analogy in Pascal. The Pascal -version below cannot therefore be exactly the same. Rather than be -a minimal transcription of the BASIC program, the Pascal coding -follows the conventional style of block-structured languages. Hence -the Pascal version could be useful in producing versions in other -structured languages. - -Rather than use identifiers of minimal length (which therefore have -little mnemonic significance), the Pascal version uses meaningful -identifiers as follows [Note: A few changes have been made for C]: - - -BASIC C BASIC C BASIC C - - A J S StickyBit - A1 AInverse J0 NoErrors T - B Radix [Failure] T0 Underflow - B1 BInverse J1 NoErrors T2 ThirtyTwo - B2 RadixD2 [SeriousDefect] T5 OneAndHalf - B9 BMinusU2 J2 NoErrors T7 TwentySeven - C [Defect] T8 TwoForty - C1 CInverse J3 NoErrors U OneUlp - D [Flaw] U0 UnderflowThreshold - D4 FourD K PageNo U1 - E0 L Milestone U2 - E1 M V - E2 Exp2 N V0 - E3 N1 V8 - E5 MinSqEr O Zero V9 - E6 SqEr O1 One W - E7 MaxSqEr O2 Two X - E8 O3 Three X1 - E9 O4 Four X8 - F1 MinusOne O5 Five X9 Random1 - F2 Half O8 Eight Y - F3 Third O9 Nine Y1 - F6 P Precision Y2 - F9 Q Y9 Random2 - G1 GMult Q8 Z - G2 GDiv Q9 Z0 PseudoZero - G3 GAddSub R Z1 - H R1 RMult Z2 - H1 HInverse R2 RDiv Z9 - I R3 RAddSub - IO NoTrials R4 RSqrt - I3 IEEE R9 Random9 - - SqRWrng - -All the variables in BASIC are true variables and in consequence, -the program is more difficult to follow since the "constants" must -be determined (the glossary is very helpful). The Pascal version -uses Real constants, but checks are added to ensure that the values -are correctly converted by the compiler. - -The major textual change to the Pascal version apart from the -identifiersis that named procedures are used, inserting parameters -wherehelpful. New procedures are also introduced. The -correspondence is as follows: - - -BASIC Pascal -lines - - 90- 140 Pause - 170- 250 Instructions - 380- 460 Heading - 480- 670 Characteristics - 690- 870 History -2940-2950 Random -3710-3740 NewD -4040-4080 DoesYequalX -4090-4110 PrintIfNPositive -4640-4850 TestPartialUnderflow - -=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= - -Below is an "ed script" that splits para.c into 10 files -of the form part[1-8].c, subs.c, and msgs.c, plus a header -file, paranoia.h, that these files require. - -r paranoia.c -$ -?SPLIT - .d -+d --,$w msgs.c --,$d -?SPLIT - .d -+d --,$w subs.c --,$d -?part8 -+d -?include - .,$w part8.c - .,$d --d -?part7 -+d -?include - .,$w part7.c - .,$d --d -?part6 -+d -?include - .,$w part6.c - .,$d --d -?part5 -+d -?include - .,$w part5.c - .,$d --d -?part4 -+d -?include - .,$w part4.c - .,$d --d -?part3 -+d -?include - .,$w part3.c - .,$d --d -?part2 -+d -?include - .,$w part2.c - .,$d -?SPLIT - .d -1,/^#include/-1d -1,$w part1.c -/Computed constants/,$d -1,$s/^int/extern &/ -1,$s/^FLOAT/extern &/ -1,$s/^char/extern &/ -1,$s! = .*!;! -/^Guard/,/^Round/s/^/extern / -/^jmp_buf/s/^/extern / -/^Sig_type/s/^/extern / -s/$/\ -extern void sigfpe(INT);/ -w paranoia.h -q - -*/ - -#include -#ifndef NOSIGNAL -#include -#endif -#include - -#if #cpu(r4640) || #cpu(r4650) -#define Single -#endif - -#ifdef Single -#define FLOAT float -#define FABS(x) fabsf((x)) -#define FLOOR(x) (float)floor((double)(x)) -#define LOG(x) (float)log((double)(x)) -#define POW(x,y) (float)pow((double)(x),(double)(y)) -#define SQRT(x) sqrtf((x)) -#else -#define FLOAT double -#define FABS(x) fabs(x) -#define FLOOR(x) floor(x) -#define LOG(x) log(x) -#define POW(x,y) pow(x,y) -#define SQRT(x) sqrt(x) -#endif - -jmp_buf ovfl_buf; -#ifdef KR_headers -#define VOID /* void */ -#define INT /* int */ -#define FP /* FLOAT */ -#define CHARP /* char * */ -#define CHARPP /* char ** */ -extern double fabs(), floor(), log(), pow(), sqrt(); -extern void exit(); -typedef void (*Sig_type)(); -FLOAT Sign(), Random(); -extern void BadCond(); -extern void SqXMinX(); -extern void TstCond(); -extern void notify(); -extern int read(); -#else -#define VOID void -#define INT int -#define FP FLOAT -#define CHARP char * -#define CHARPP char ** -#ifdef __STDC__ -#include -#include -#else -#ifdef __cplusplus -extern "C" { -#endif -extern double fabs(double), floor(double), log(double); -extern double pow(double,double), sqrt(double); -extern void exit(INT); -#ifdef __cplusplus - } -#endif -#endif -typedef void (*Sig_type)(int); -FLOAT Sign(FLOAT), Random(void); -extern void BadCond(int, char*); -extern void SqXMinX(int); -extern void TstCond(int, int, char*); -extern void notify(char*); -extern int read(int, char*, int); -#endif -#undef V9 -extern void Characteristics(VOID); -extern void Heading(VOID); -extern void History(VOID); -extern void Instructions(VOID); -extern void IsYeqX(VOID); -extern void NewD(VOID); -extern void Pause(VOID); -extern void PrintIfNPositive(VOID); -extern void SR3750(VOID); -extern void SR3980(VOID); -extern void TstPtUf(VOID); - -Sig_type sigsave; - -#define KEYBOARD 0 - -FLOAT Radix, BInvrse, RadixD2, BMinusU2; - -/*Small floating point constants.*/ -FLOAT Zero = 0.0; -FLOAT Half = 0.5; -FLOAT One = 1.0; -FLOAT Two = 2.0; -FLOAT Three = 3.0; -FLOAT Four = 4.0; -FLOAT Five = 5.0; -FLOAT Eight = 8.0; -FLOAT Nine = 9.0; -FLOAT TwentySeven = 27.0; -FLOAT ThirtyTwo = 32.0; -FLOAT TwoForty = 240.0; -FLOAT MinusOne = -1.0; -FLOAT OneAndHalf = 1.5; -/*Integer constants*/ -int NoTrials = 20; /*Number of tests for commutativity. */ -#define False 0 -#define True 1 - -/* Definitions for declared types - Guard == (Yes, No); - Rounding == (Chopped, Rounded, Other); - Message == packed array [1..40] of char; - Class == (Flaw, Defect, Serious, Failure); - */ -#define Yes 1 -#define No 0 -#define Chopped 2 -#define Rounded 1 -#define Other 0 -#define Flaw 3 -#define Defect 2 -#define Serious 1 -#define Failure 0 -typedef int Guard, Rounding, Class; -typedef char Message; - -/* Declarations of Variables */ -int Indx; -char ch[8]; -FLOAT AInvrse, A1; -FLOAT C, CInvrse; -FLOAT D, FourD; -FLOAT E0, E1, Exp2, E3, MinSqEr; -FLOAT SqEr, MaxSqEr, E9; -FLOAT Third; -FLOAT F6, F9; -FLOAT H, HInvrse; -int I; -FLOAT StickyBit, J; -FLOAT MyZero; -FLOAT Precision; -FLOAT Q, Q9; -FLOAT R, Random9; -FLOAT T, Underflow, S; -FLOAT OneUlp, UfThold, U1, U2; -FLOAT V, V0, V9; -FLOAT W; -FLOAT X, X1, X2, X8, Random1; -FLOAT Y, Y1, Y2, Random2; -FLOAT Z, PseudoZero, Z1, Z2, Z9; -int ErrCnt[4]; -int fpecount; -int Milestone; -int PageNo; -int M, N, N1; -Guard GMult, GDiv, GAddSub; -Rounding RMult, RDiv, RAddSub, RSqrt; -int Break, Done, NotMonot, Monot, Anomaly, IEEE, - SqRWrng, UfNGrad; -/* Computed constants. */ -/*U1 gap below 1.0, i.e, 1.0-U1 is next number below 1.0 */ -/*U2 gap above 1.0, i.e, 1.0+U2 is next number above 1.0 */ - -/* floating point exception receiver */ - void -sigfpe(INT x) -{ - fpecount++; - printf("\n* * * FLOATING-POINT ERROR %d * * *\n", x); - fflush(stdout); - if (sigsave) { -#ifndef NOSIGNAL - signal(SIGFPE, sigsave); -#endif - sigsave = 0; - longjmp(ovfl_buf, 1); - } - exit(1); -} - - -main (VOID) -{ - /* First two assignments use integer right-hand sides. */ - Zero = 0; - One = 1; - Two = One + One; - Three = Two + One; - Four = Three + One; - Five = Four + One; - Eight = Four + Four; - Nine = Three * Three; - TwentySeven = Nine * Three; - ThirtyTwo = Four * Eight; - TwoForty = Four * Five * Three * Four; - MinusOne = -One; - Half = One / Two; - OneAndHalf = One + Half; - ErrCnt[Failure] = 0; - ErrCnt[Serious] = 0; - ErrCnt[Defect] = 0; - ErrCnt[Flaw] = 0; - PageNo = 1; - /*=============================================*/ - Milestone = 0; - /*=============================================*/ -#ifndef NOSIGNAL - signal(SIGFPE, sigfpe); -#endif - Instructions(); - Pause(); - Heading(); - Pause(); - Characteristics(); - Pause(); - History(); - Pause(); - /*=============================================*/ - Milestone = 7; - /*=============================================*/ - printf("Program is now RUNNING tests on small integers:\n"); - - TstCond (Failure, (Zero + Zero == Zero) && (One - One == Zero) - && (One > Zero) && (One + One == Two), - "0+0 != 0, 1-1 != 0, 1 <= 0, or 1+1 != 2"); - Z = - Zero; - if (Z != (FLOAT)0.0) { - ErrCnt[Failure] = ErrCnt[Failure] + 1; - printf("Comparison alleges that -0.0 is Non-zero!\n"); - U1 = (FLOAT)0.001; - Radix = 1; - TstPtUf(); - } - TstCond (Failure, (Three == Two + One) && (Four == Three + One) - && (Four + Two * (- Two) == Zero) - && (Four - Three - One == Zero), - "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0"); - TstCond (Failure, (MinusOne == (0 - One)) - && (MinusOne + One == Zero ) && (One + MinusOne == Zero) - && (MinusOne + FABS(One) == Zero) - && (MinusOne + MinusOne * MinusOne == Zero), - "-1+1 != 0, (-1)+abs(1) != 0, or -1+(-1)*(-1) != 0"); - TstCond (Failure, Half + MinusOne + Half == Zero, - "1/2 + (-1) + 1/2 != 0"); - /*=============================================*/ - /*SPLIT - { - extern void part2(VOID), part3(VOID), part4(VOID), - part5(VOID), part6(VOID), part7(VOID); - int part8(VOID); - - part2(); - part3(); - part4(); - part5(); - part6(); - part7(); - return part8(); - } - } -#include "paranoia.h" -void part2(VOID){ -*/ - Milestone = 10; - /*=============================================*/ - TstCond (Failure, (Nine == Three * Three) - && (TwentySeven == Nine * Three) && (Eight == Four + Four) - && (ThirtyTwo == Eight * Four) - && (ThirtyTwo - TwentySeven - Four - One == Zero), - "9 != 3*3, 27 != 9*3, 32 != 8*4, or 32-27-4-1 != 0"); - TstCond (Failure, (Five == Four + One) && - (TwoForty == Four * Five * Three * Four) - && (TwoForty / Three - Four * Four * Five == Zero) - && ( TwoForty / Four - Five * Three * Four == Zero) - && ( TwoForty / Five - Four * Three * Four == Zero), - "5 != 4+1, 240/3 != 80, 240/4 != 60, or 240/5 != 48"); - if (ErrCnt[Failure] == 0) { - printf("-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.\n"); - printf("\n"); - } - printf("Searching for Radix and Precision.\n"); - W = One; - do { - W = W + W; - Y = W + One; - Z = Y - W; - Y = Z - One; - } while (MinusOne + FABS(Y) < Zero); - /*.. now W is just big enough that |((W+1)-W)-1| >= 1 ...*/ - Precision = Zero; - Y = One; - do { - Radix = W + Y; - Y = Y + Y; - Radix = Radix - W; - } while ( Radix == Zero); - if (Radix < Two) Radix = One; - printf("Radix = %f .\n", Radix); - if (Radix != 1) { - W = One; - do { - Precision = Precision + One; - W = W * Radix; - Y = W + One; - } while ((Y - W) == One); - } - /*... now W == Radix^Precision is barely too big to satisfy (W+1)-W == 1 - ...*/ - U1 = One / W; - U2 = Radix * U1; - printf("Closest relative separation found is U1 = %.7e .\n\n", U1); - printf("Recalculating radix and precision\n "); - - /*save old values*/ - E0 = Radix; - E1 = U1; - E9 = U2; - E3 = Precision; - - X = Four / Three; - Third = X - One; - F6 = Half - Third; - X = F6 + F6; - X = FABS(X - Third); - if (X < U2) X = U2; - - /*... now X = (unknown no.) ulps of 1+...*/ - do { - U2 = X; - Y = Half * U2 + ThirtyTwo * U2 * U2; - Y = One + Y; - X = Y - One; - } while ( ! ((U2 <= X) || (X <= Zero))); - - /*... now U2 == 1 ulp of 1 + ... */ - X = Two / Three; - F6 = X - Half; - Third = F6 + F6; - X = Third - Half; - X = FABS(X + F6); - if (X < U1) X = U1; - - /*... now X == (unknown no.) ulps of 1 -... */ - do { - U1 = X; - Y = Half * U1 + ThirtyTwo * U1 * U1; - Y = Half - Y; - X = Half + Y; - Y = Half - X; - X = Half + Y; - } while ( ! ((U1 <= X) || (X <= Zero))); - /*... now U1 == 1 ulp of 1 - ... */ - if (U1 == E1) printf("confirms closest relative separation U1 .\n"); - else printf("gets better closest relative separation U1 = %.7e .\n", U1); - W = One / U1; - F9 = (Half - U1) + Half; - Radix = FLOOR((FLOAT)0.01 + U2 / U1); - if (Radix == E0) printf("Radix confirmed.\n"); - else printf("MYSTERY: recalculated Radix = %.7e .\n", Radix); - TstCond (Defect, Radix <= Eight + Eight, - "Radix is too big: roundoff problems"); - TstCond (Flaw, (Radix == Two) || (Radix == 10) - || (Radix == One), "Radix is not as good as 2 or 10"); - /*=============================================*/ - Milestone = 20; - /*=============================================*/ - TstCond (Failure, F9 - Half < Half, - "(1-U1)-1/2 < 1/2 is FALSE, prog. fails?"); - X = F9; - I = 1; - Y = X - Half; - Z = Y - Half; - TstCond (Failure, (X != One) - || (Z == Zero), "Comparison is fuzzy,X=1 but X-1/2-1/2 != 0"); - X = One + U2; - I = 0; - /*=============================================*/ - Milestone = 25; - /*=============================================*/ - /*... BMinusU2 = nextafter(Radix, 0) */ - BMinusU2 = Radix - One; - BMinusU2 = (BMinusU2 - U2) + One; - /* Purify Integers */ - if (Radix != One) { - X = - TwoForty * LOG(U1) / LOG(Radix); - Y = FLOOR(Half + X); - if (FABS(X - Y) * Four < One) X = Y; - Precision = X / TwoForty; - Y = FLOOR(Half + Precision); - if (FABS(Precision - Y) * TwoForty < Half) Precision = Y; - } - if ((Precision != FLOOR(Precision)) || (Radix == One)) { - printf("Precision cannot be characterized by an Integer number\n"); - printf("of significant digits but, by itself, this is a minor flaw.\n"); - } - if (Radix == One) - printf("logarithmic encoding has precision characterized solely by U1.\n"); - else printf("The number of significant digits of the Radix is %f .\n", - Precision); - TstCond (Serious, U2 * Nine * Nine * TwoForty < One, - "Precision worse than 5 decimal figures "); - /*=============================================*/ - Milestone = 30; - /*=============================================*/ - /* Test for extra-precise subepressions */ - X = FABS(((Four / Three - One) - One / Four) * Three - One / Four); - do { - Z2 = X; - X = (One + (Half * Z2 + ThirtyTwo * Z2 * Z2)) - One; - } while ( ! ((Z2 <= X) || (X <= Zero))); - X = Y = Z = FABS((Three / Four - Two / Three) * Three - One / Four); - do { - Z1 = Z; - Z = (One / Two - ((One / Two - (Half * Z1 + ThirtyTwo * Z1 * Z1)) - + One / Two)) + One / Two; - } while ( ! ((Z1 <= Z) || (Z <= Zero))); - do { - do { - Y1 = Y; - Y = (Half - ((Half - (Half * Y1 + ThirtyTwo * Y1 * Y1)) + Half - )) + Half; - } while ( ! ((Y1 <= Y) || (Y <= Zero))); - X1 = X; - X = ((Half * X1 + ThirtyTwo * X1 * X1) - F9) + F9; - } while ( ! ((X1 <= X) || (X <= Zero))); - if ((X1 != Y1) || (X1 != Z1)) { - BadCond(Serious, "Disagreements among the values X1, Y1, Z1,\n"); - printf("respectively %.7e, %.7e, %.7e,\n", X1, Y1, Z1); - printf("are symptoms of inconsistencies introduced\n"); - printf("by extra-precise evaluation of arithmetic subexpressions.\n"); - notify("Possibly some part of this"); - if ((X1 == U1) || (Y1 == U1) || (Z1 == U1)) printf( - "That feature is not tested further by this program.\n") ; - } - else { - if ((Z1 != U1) || (Z2 != U2)) { - if ((Z1 >= U1) || (Z2 >= U2)) { - BadCond(Failure, ""); - notify("Precision"); - printf("\tU1 = %.7e, Z1 - U1 = %.7e\n",U1,Z1-U1); - printf("\tU2 = %.7e, Z2 - U2 = %.7e\n",U2,Z2-U2); - } - else { - if ((Z1 <= Zero) || (Z2 <= Zero)) { - printf("Because of unusual Radix = %f", Radix); - printf(", or exact rational arithmetic a result\n"); - printf("Z1 = %.7e, or Z2 = %.7e ", Z1, Z2); - notify("of an\nextra-precision"); - } - if (Z1 != Z2 || Z1 > Zero) { - X = Z1 / U1; - Y = Z2 / U2; - if (Y > X) X = Y; - Q = - LOG(X); - printf("Some subexpressions appear to be calculated extra\n"); - printf("precisely with about %g extra B-digits, i.e.\n", - (Q / LOG(Radix))); - printf("roughly %g extra significant decimals.\n", - Q / LOG(10.)); - } - printf("That feature is not tested further by this program.\n"); - } - } - } - Pause(); - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -void part3(VOID){ -*/ - Milestone = 35; - /*=============================================*/ - if (Radix >= Two) { - X = W / (Radix * Radix); - Y = X + One; - Z = Y - X; - T = Z + U2; - X = T - Z; - TstCond (Failure, X == U2, - "Subtraction is not normalized X=Y,X+Z != Y+Z!"); - if (X == U2) printf( - "Subtraction appears to be normalized, as it should be."); - } - printf("\nChecking for guard digit in *, /, and -.\n"); - Y = F9 * One; - Z = One * F9; - X = F9 - Half; - Y = (Y - Half) - X; - Z = (Z - Half) - X; - X = One + U2; - T = X * Radix; - R = Radix * X; - X = T - Radix; - X = X - Radix * U2; - T = R - Radix; - T = T - Radix * U2; - X = X * (Radix - One); - T = T * (Radix - One); - if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero)) GMult = Yes; - else { - GMult = No; - TstCond (Serious, False, - "* lacks a Guard Digit, so 1*X != X"); - } - Z = Radix * U2; - X = One + Z; - Y = FABS((X + Z) - X * X) - U2; - X = One - U2; - Z = FABS((X - U2) - X * X) - U1; - TstCond (Failure, (Y <= Zero) - && (Z <= Zero), "* gets too many final digits wrong.\n"); - Y = One - U2; - X = One + U2; - Z = One / Y; - Y = Z - X; - X = One / Three; - Z = Three / Nine; - X = X - Z; - T = Nine / TwentySeven; - Z = Z - T; - TstCond(Defect, X == Zero && Y == Zero && Z == Zero, - "Division lacks a Guard Digit, so error can exceed 1 ulp\n\ -or 1/3 and 3/9 and 9/27 may disagree"); - Y = F9 / One; - X = F9 - Half; - Y = (Y - Half) - X; - X = One + U2; - T = X / One; - X = T - X; - if ((X == Zero) && (Y == Zero) && (Z == Zero)) GDiv = Yes; - else { - GDiv = No; - TstCond (Serious, False, - "Division lacks a Guard Digit, so X/1 != X"); - } - X = One / (One + U2); - Y = X - Half - Half; - TstCond (Serious, Y < Zero, - "Computed value of 1/1.000..1 >= 1"); - X = One - U2; - Y = One + Radix * U2; - Z = X * Radix; - T = Y * Radix; - R = Z / Radix; - StickyBit = T / Radix; - X = R - X; - Y = StickyBit - Y; - TstCond (Failure, X == Zero && Y == Zero, - "* and/or / gets too many last digits wrong"); - Y = One - U1; - X = One - F9; - Y = One - Y; - T = Radix - U2; - Z = Radix - BMinusU2; - T = Radix - T; - if ((X == U1) && (Y == U1) && (Z == U2) && (T == U2)) GAddSub = Yes; - else { - GAddSub = No; - TstCond (Serious, False, - "- lacks Guard Digit, so cancellation is obscured"); - } - if (F9 != One && F9 - One >= Zero) { - BadCond(Serious, "comparison alleges (1-U1) < 1 although\n"); - printf(" subtraction yields (1-U1) - 1 = 0 , thereby vitiating\n"); - printf(" such precautions against division by zero as\n"); - printf(" ... if (X == 1.0) {.....} else {.../(X-1.0)...}\n"); - } - if (GMult == Yes && GDiv == Yes && GAddSub == Yes) printf( - " *, /, and - appear to have guard digits, as they should.\n"); - /*=============================================*/ - Milestone = 40; - /*=============================================*/ - Pause(); - printf("Checking rounding on multiply, divide and add/subtract.\n"); - RMult = Other; - RDiv = Other; - RAddSub = Other; - RadixD2 = Radix / Two; - A1 = Two; - Done = False; - do { - AInvrse = Radix; - do { - X = AInvrse; - AInvrse = AInvrse / A1; - } while ( ! (FLOOR(AInvrse) != AInvrse)); - Done = (X == One) || (A1 > Three); - if (! Done) A1 = Nine + One; - } while ( ! (Done)); - if (X == One) A1 = Radix; - AInvrse = One / A1; - X = A1; - Y = AInvrse; - Done = False; - do { - Z = X * Y - Half; - TstCond (Failure, Z == Half, - "X * (1/X) differs from 1"); - Done = X == Radix; - X = Radix; - Y = One / X; - } while ( ! (Done)); - Y2 = One + U2; - Y1 = One - U2; - X = OneAndHalf - U2; - Y = OneAndHalf + U2; - Z = (X - U2) * Y2; - T = Y * Y1; - Z = Z - X; - T = T - X; - X = X * Y2; - Y = (Y + U2) * Y1; - X = X - OneAndHalf; - Y = Y - OneAndHalf; - if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T <= Zero)) { - X = (OneAndHalf + U2) * Y2; - Y = OneAndHalf - U2 - U2; - Z = OneAndHalf + U2 + U2; - T = (OneAndHalf - U2) * Y1; - X = X - (Z + U2); - StickyBit = Y * Y1; - S = Z * Y2; - T = T - Y; - Y = (U2 - Y) + StickyBit; - Z = S - (Z + U2 + U2); - StickyBit = (Y2 + U2) * Y1; - Y1 = Y2 * Y1; - StickyBit = StickyBit - Y2; - Y1 = Y1 - Half; - if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) - && ( StickyBit == Zero) && (Y1 == Half)) { - RMult = Rounded; - printf("Multiplication appears to round correctly.\n"); - } - else if ((X + U2 == Zero) && (Y < Zero) && (Z + U2 == Zero) - && (T < Zero) && (StickyBit + U2 == Zero) - && (Y1 < Half)) { - RMult = Chopped; - printf("Multiplication appears to chop.\n"); - } - else printf("* is neither chopped nor correctly rounded.\n"); - if ((RMult == Rounded) && (GMult == No)) notify("Multiplication"); - } - else printf("* is neither chopped nor correctly rounded.\n"); - /*=============================================*/ - Milestone = 45; - /*=============================================*/ - Y2 = One + U2; - Y1 = One - U2; - Z = OneAndHalf + U2 + U2; - X = Z / Y2; - T = OneAndHalf - U2 - U2; - Y = (T - U2) / Y1; - Z = (Z + U2) / Y2; - X = X - OneAndHalf; - Y = Y - T; - T = T / Y1; - Z = Z - (OneAndHalf + U2); - T = (U2 - OneAndHalf) + T; - if (! ((X > Zero) || (Y > Zero) || (Z > Zero) || (T > Zero))) { - X = OneAndHalf / Y2; - Y = OneAndHalf - U2; - Z = OneAndHalf + U2; - X = X - Y; - T = OneAndHalf / Y1; - Y = Y / Y1; - T = T - (Z + U2); - Y = Y - Z; - Z = Z / Y2; - Y1 = (Y2 + U2) / Y2; - Z = Z - OneAndHalf; - Y2 = Y1 - Y2; - Y1 = (F9 - U1) / F9; - if ((X == Zero) && (Y == Zero) && (Z == Zero) && (T == Zero) - && (Y2 == Zero) && (Y2 == Zero) - && (Y1 - Half == F9 - Half )) { - RDiv = Rounded; - printf("Division appears to round correctly.\n"); - if (GDiv == No) notify("Division"); - } - else if ((X < Zero) && (Y < Zero) && (Z < Zero) && (T < Zero) - && (Y2 < Zero) && (Y1 - Half < F9 - Half)) { - RDiv = Chopped; - printf("Division appears to chop.\n"); - } - } - if (RDiv == Other) printf("/ is neither chopped nor correctly rounded.\n"); - BInvrse = One / Radix; - TstCond (Failure, (BInvrse * Radix - Half == Half), - "Radix * ( 1 / Radix ) differs from 1"); - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -void part4(VOID){ -*/ - Milestone = 50; - /*=============================================*/ - TstCond (Failure, ((F9 + U1) - Half == Half) - && ((BMinusU2 + U2 ) - One == Radix - One), - "Incomplete carry-propagation in Addition"); - X = One - U1 * U1; - Y = One + U2 * (One - U2); - Z = F9 - Half; - X = (X - Half) - Z; - Y = Y - One; - if ((X == Zero) && (Y == Zero)) { - RAddSub = Chopped; - printf("Add/Subtract appears to be chopped.\n"); - } - if (GAddSub == Yes) { - X = (Half + U2) * U2; - Y = (Half - U2) * U2; - X = One + X; - Y = One + Y; - X = (One + U2) - X; - Y = One - Y; - if ((X == Zero) && (Y == Zero)) { - X = (Half + U2) * U1; - Y = (Half - U2) * U1; - X = One - X; - Y = One - Y; - X = F9 - X; - Y = One - Y; - if ((X == Zero) && (Y == Zero)) { - RAddSub = Rounded; - printf("Addition/Subtraction appears to round correctly.\n"); - if (GAddSub == No) notify("Add/Subtract"); - } - else printf("Addition/Subtraction neither rounds nor chops.\n"); - } - else printf("Addition/Subtraction neither rounds nor chops.\n"); - } - else printf("Addition/Subtraction neither rounds nor chops.\n"); - S = One; - X = One + Half * (One + Half); - Y = (One + U2) * Half; - Z = X - Y; - T = Y - X; - StickyBit = Z + T; - if (StickyBit != Zero) { - S = Zero; - BadCond(Flaw, "(X - Y) + (Y - X) is non zero!\n"); - } - StickyBit = Zero; - if ((GMult == Yes) && (GDiv == Yes) && (GAddSub == Yes) - && (RMult == Rounded) && (RDiv == Rounded) - && (RAddSub == Rounded) && (FLOOR(RadixD2) == RadixD2)) { - printf("Checking for sticky bit.\n"); - X = (Half + U1) * U2; - Y = Half * U2; - Z = One + Y; - T = One + X; - if ((Z - One <= Zero) && (T - One >= U2)) { - Z = T + Y; - Y = Z - X; - if ((Z - T >= U2) && (Y - T == Zero)) { - X = (Half + U1) * U1; - Y = Half * U1; - Z = One - Y; - T = One - X; - if ((Z - One == Zero) && (T - F9 == Zero)) { - Z = (Half - U1) * U1; - T = F9 - Z; - Q = F9 - Y; - if ((T - F9 == Zero) && (F9 - U1 - Q == Zero)) { - Z = (One + U2) * OneAndHalf; - T = (OneAndHalf + U2) - Z + U2; - X = One + Half / Radix; - Y = One + Radix * U2; - Z = X * Y; - if (T == Zero && X + Radix * U2 - Z == Zero) { - if (Radix != Two) { - X = Two + U2; - Y = X / Two; - if ((Y - One == Zero)) StickyBit = S; - } - else StickyBit = S; - } - } - } - } - } - } - if (StickyBit == One) printf("Sticky bit apparently used correctly.\n"); - else printf("Sticky bit used incorrectly or not at all.\n"); - TstCond (Flaw, !(GMult == No || GDiv == No || GAddSub == No || - RMult == Other || RDiv == Other || RAddSub == Other), - "lack(s) of guard digits or failure(s) to correctly round or chop\n\ -(noted above) count as one flaw in the final tally below"); - /*=============================================*/ - Milestone = 60; - /*=============================================*/ - printf("\n"); - printf("Does Multiplication commute? "); - printf("Testing on %d random pairs.\n", NoTrials); - Random9 = SQRT(3.0); - Random1 = Third; - I = 1; - do { - X = Random(); - Y = Random(); - Z9 = Y * X; - Z = X * Y; - Z9 = Z - Z9; - I = I + 1; - } while ( ! ((I > NoTrials) || (Z9 != Zero))); - if (I == NoTrials) { - Random1 = One + Half / Three; - Random2 = (U2 + U1) + One; - Z = Random1 * Random2; - Y = Random2 * Random1; - Z9 = (One + Half / Three) * ((U2 + U1) + One) - (One + Half / - Three) * ((U2 + U1) + One); - } - if (! ((I == NoTrials) || (Z9 == Zero))) - BadCond(Defect, "X * Y == Y * X trial fails.\n"); - else printf(" No failures found in %d integer pairs.\n", NoTrials); - /*=============================================*/ - Milestone = 70; - /*=============================================*/ - printf("\nRunning test of square root(x).\n"); - TstCond (Failure, (Zero == SQRT(Zero)) - && (- Zero == SQRT(- Zero)) - && (One == SQRT(One)), "Square root of 0.0, -0.0 or 1.0 wrong"); - MinSqEr = Zero; - MaxSqEr = Zero; - J = Zero; - X = Radix; - OneUlp = U2; - SqXMinX (Serious); - X = BInvrse; - OneUlp = BInvrse * U1; - SqXMinX (Serious); - X = U1; - OneUlp = U1 * U1; - SqXMinX (Serious); - if (J != Zero) Pause(); - printf("Testing if sqrt(X * X) == X for %d Integers X.\n", NoTrials); - J = Zero; - X = Two; - Y = Radix; - if ((Radix != One)) do { - X = Y; - Y = Radix * Y; - } while ( ! ((Y - X >= NoTrials))); - OneUlp = X * U2; - I = 1; - while (I <= NoTrials) { - X = X + One; - SqXMinX (Defect); - if (J > Zero) break; - I = I + 1; - } - printf("Test for sqrt monotonicity.\n"); - I = - 1; - X = BMinusU2; - Y = Radix; - Z = Radix + Radix * U2; - NotMonot = False; - Monot = False; - while ( ! (NotMonot || Monot)) { - I = I + 1; - X = SQRT(X); - Q = SQRT(Y); - Z = SQRT(Z); - if ((X > Q) || (Q > Z)) NotMonot = True; - else { - Q = FLOOR(Q + Half); - if ((I > 0) || (Radix == Q * Q)) Monot = True; - else if (I > 0) { - if (I > 1) Monot = True; - else { - Y = Y * BInvrse; - X = Y - U1; - Z = Y + U1; - } - } - else { - Y = Q; - X = Y - U2; - Z = Y + U2; - } - } - } - if (Monot) printf("sqrt has passed a test for Monotonicity.\n"); - else { - BadCond(Defect, ""); - printf("sqrt(X) is non-monotonic for X near %.7e .\n", Y); - } - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -void part5(VOID){ -*/ - Milestone = 80; - /*=============================================*/ - MinSqEr = MinSqEr + Half; - MaxSqEr = MaxSqEr - Half; - Y = (SQRT(One + U2) - One) / U2; - SqEr = (Y - One) + U2 / Eight; - if (SqEr > MaxSqEr) MaxSqEr = SqEr; - SqEr = Y + U2 / Eight; - if (SqEr < MinSqEr) MinSqEr = SqEr; - Y = ((SQRT(F9) - U2) - (One - U2)) / U1; - SqEr = Y + U1 / Eight; - if (SqEr > MaxSqEr) MaxSqEr = SqEr; - SqEr = (Y + One) + U1 / Eight; - if (SqEr < MinSqEr) MinSqEr = SqEr; - OneUlp = U2; - X = OneUlp; - for( Indx = 1; Indx <= 3; ++Indx) { - Y = SQRT((X + U1 + X) + F9); - Y = ((Y - U2) - ((One - U2) + X)) / OneUlp; - Z = ((U1 - X) + F9) * Half * X * X / OneUlp; - SqEr = (Y + Half) + Z; - if (SqEr < MinSqEr) MinSqEr = SqEr; - SqEr = (Y - Half) + Z; - if (SqEr > MaxSqEr) MaxSqEr = SqEr; - if (((Indx == 1) || (Indx == 3))) - X = OneUlp * Sign (X) * FLOOR(Eight / (Nine * SQRT(OneUlp))); - else { - OneUlp = U1; - X = - OneUlp; - } - } - /*=============================================*/ - Milestone = 85; - /*=============================================*/ - SqRWrng = False; - Anomaly = False; - RSqrt = Other; /* ~dgh */ - if (Radix != One) { - printf("Testing whether sqrt is rounded or chopped.\n"); - D = FLOOR(Half + POW(Radix, One + Precision - FLOOR(Precision))); - /* ... == Radix^(1 + fract) if (Precision == Integer + fract. */ - X = D / Radix; - Y = D / A1; - if ((X != FLOOR(X)) || (Y != FLOOR(Y))) { - Anomaly = True; - } - else { - X = Zero; - Z2 = X; - Y = One; - Y2 = Y; - Z1 = Radix - One; - FourD = Four * D; - do { - if (Y2 > Z2) { - Q = Radix; - Y1 = Y; - do { - X1 = FABS(Q + FLOOR(Half - Q / Y1) * Y1); - Q = Y1; - Y1 = X1; - } while ( ! (X1 <= Zero)); - if (Q <= One) { - Z2 = Y2; - Z = Y; - } - } - Y = Y + Two; - X = X + Eight; - Y2 = Y2 + X; - if (Y2 >= FourD) Y2 = Y2 - FourD; - } while ( ! (Y >= D)); - X8 = FourD - Z2; - Q = (X8 + Z * Z) / FourD; - X8 = X8 / Eight; - if (Q != FLOOR(Q)) Anomaly = True; - else { - Break = False; - do { - X = Z1 * Z; - X = X - FLOOR(X / Radix) * Radix; - if (X == One) - Break = True; - else - Z1 = Z1 - One; - } while ( ! (Break || (Z1 <= Zero))); - if ((Z1 <= Zero) && (! Break)) Anomaly = True; - else { - if (Z1 > RadixD2) Z1 = Z1 - Radix; - do { - NewD(); - } while ( ! (U2 * D >= F9)); - if (D * Radix - D != W - D) Anomaly = True; - else { - Z2 = D; - I = 0; - Y = D + (One + Z) * Half; - X = D + Z + Q; - SR3750(); - Y = D + (One - Z) * Half + D; - X = D - Z + D; - X = X + Q + X; - SR3750(); - NewD(); - if (D - Z2 != W - Z2) Anomaly = True; - else { - Y = (D - Z2) + (Z2 + (One - Z) * Half); - X = (D - Z2) + (Z2 - Z + Q); - SR3750(); - Y = (One + Z) * Half; - X = Q; - SR3750(); - if (I == 0) Anomaly = True; - } - } - } - } - } - if ((I == 0) || Anomaly) { - BadCond(Failure, "Anomalous arithmetic with Integer < "); - printf("Radix^Precision = %.7e\n", W); - printf(" fails test whether sqrt rounds or chops.\n"); - SqRWrng = True; - } - } - if (! Anomaly) { - if (! ((MinSqEr < Zero) || (MaxSqEr > Zero))) { - RSqrt = Rounded; - printf("Square root appears to be correctly rounded.\n"); - } - else { - if ((MaxSqEr + U2 > U2 - Half) || (MinSqEr > Half) - || (MinSqEr + Radix < Half)) SqRWrng = True; - else { - RSqrt = Chopped; - printf("Square root appears to be chopped.\n"); - } - } - } - if (SqRWrng) { - printf("Square root is neither chopped nor correctly rounded.\n"); - printf("Observed errors run from %.7e ", MinSqEr - Half); - printf("to %.7e ulps.\n", Half + MaxSqEr); - TstCond (Serious, MaxSqEr - MinSqEr < Radix * Radix, - "sqrt gets too many last digits wrong"); - } - /*=============================================*/ - Milestone = 90; - /*=============================================*/ - Pause(); - printf("Testing powers Z^i for small Integers Z and i.\n"); - N = 0; - /* ... test powers of zero. */ - I = 0; - Z = -Zero; - M = 3; - Break = False; - do { - X = One; - SR3980(); - if (I <= 10) { - I = 1023; - SR3980(); - } - if (Z == MinusOne) Break = True; - else { - Z = MinusOne; - /* .. if(-1)^N is invalid, replace MinusOne by One. */ - I = - 4; - } - } while ( ! Break); - PrintIfNPositive(); - N1 = N; - N = 0; - Z = A1; - M = (int)FLOOR(Two * LOG(W) / LOG(A1)); - Break = False; - do { - X = Z; - I = 1; - SR3980(); - if (Z == AInvrse) Break = True; - else Z = AInvrse; - } while ( ! (Break)); - /*=============================================*/ - Milestone = 100; - /*=============================================*/ - /* Powers of Radix have been tested, */ - /* next try a few primes */ - M = NoTrials; - Z = Three; - do { - X = Z; - I = 1; - SR3980(); - do { - Z = Z + Two; - } while ( Three * FLOOR(Z / Three) == Z ); - } while ( Z < Eight * Three ); - if (N > 0) { - printf("Errors like this may invalidate financial calculations\n"); - printf("\tinvolving interest rates.\n"); - } - PrintIfNPositive(); - N += N1; - if (N == 0) printf("... no discrepancies found.\n"); - if (N > 0) Pause(); - else printf("\n"); - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -void part6(VOID){ -*/ - Milestone = 110; - /*=============================================*/ - printf("Seeking Underflow thresholds UfThold and E0.\n"); - D = U1; - if (Precision != FLOOR(Precision)) { - D = BInvrse; - X = Precision; - do { - D = D * BInvrse; - X = X - One; - } while ( X > Zero); - } - Y = One; - Z = D; - printf("Y: %20.20f Z: %20.20f\n", Y, Z); - /* ... D is power of 1/Radix < 1. */ - do { - C = Y; - Y = Z; - Z = Y * Y; - } while ((Y > Z) && (Z + Z > Z)); - Y = C; - Z = Y * D; - do { - C = Y; - Y = Z; - Z = Y * D; - } while ((Y > Z) && (Z + Z > Z)); - if (Radix < Two) HInvrse = Two; - else HInvrse = Radix; - H = One / HInvrse; - /* ... 1/HInvrse == H == Min(1/Radix, 1/2) */ - CInvrse = One / C; - E0 = C; - Z = E0 * H; - /* ...1/Radix^(BIG Integer) << 1 << CInvrse == 1/C */ - do { - Y = E0; - E0 = Z; - Z = E0 * H; - } while ((E0 > Z) && (Z + Z > Z)); - UfThold = E0; - E1 = Zero; - Q = Zero; - E9 = U2; - S = One + E9; - D = C * S; - if (D <= C) { - E9 = Radix * U2; - S = One + E9; - D = C * S; - if (D <= C) { - BadCond(Failure, "multiplication gets too many last digits wrong.\n"); - Underflow = E0; - Y1 = Zero; - PseudoZero = Z; - Pause(); - } - } - else { - Underflow = D; - PseudoZero = Underflow * H; - UfThold = Zero; - do { - Y1 = Underflow; - Underflow = PseudoZero; - if (E1 + E1 <= E1) { - Y2 = Underflow * HInvrse; - E1 = FABS(Y1 - Y2); - Q = Y1; - if ((UfThold == Zero) && (Y1 != Y2)) UfThold = Y1; - } - PseudoZero = PseudoZero * H; - } while ((Underflow > PseudoZero) - && (PseudoZero + PseudoZero > PseudoZero)); - } - /* Comment line 4530 .. 4560 */ - if (PseudoZero != Zero) { - printf("\n"); - Z = PseudoZero; - /* ... Test PseudoZero for "phoney- zero" violates */ - /* ... PseudoZero < Underflow or PseudoZero < PseudoZero + PseudoZero - ... */ - if (PseudoZero <= Zero) { - BadCond(Failure, "Positive expressions can underflow to an\n"); - printf("allegedly negative value\n"); - printf("PseudoZero that prints out as: %g .\n", PseudoZero); - X = - PseudoZero; - if (X <= Zero) { - printf("But -PseudoZero, which should be\n"); - printf("positive, isn't; it prints out as %g .\n", X); - } - } - else { - BadCond(Flaw, "Underflow can stick at an allegedly positive\n"); - printf("value PseudoZero that prints out as %g .\n", PseudoZero); - } - TstPtUf(); - } - /*=============================================*/ - Milestone = 120; - /*=============================================*/ - if (CInvrse * Y > CInvrse * Y1) { - S = H * S; - E0 = Underflow; - } - if (! ((E1 == Zero) || (E1 == E0))) { - BadCond(Defect, ""); - if (E1 < E0) { - printf("Products underflow at a higher"); - printf(" threshold than differences.\n"); - if (PseudoZero == Zero) - E0 = E1; - } - else { - printf("Difference underflows at a higher"); - printf(" threshold than products.\n"); - } - } - printf("Smallest strictly positive number found is E0 = %g .\n", E0); - Z = E0; - TstPtUf(); - Underflow = E0; - if (N == 1) Underflow = Y; - I = 4; - if (E1 == Zero) I = 3; - if (UfThold == Zero) I = I - 2; - UfNGrad = True; - switch (I) { - case 1: - UfThold = Underflow; - if ((CInvrse * Q) != ((CInvrse * Y) * S)) { - UfThold = Y; - BadCond(Failure, "Either accuracy deteriorates as numbers\n"); - printf("approach a threshold = %.17e\n", UfThold);; - printf(" coming down from %.17e\n", C); - printf(" or else multiplication gets too many last digits wrong.\n"); - } - Pause(); - break; - - case 2: - BadCond(Failure, "Underflow confuses Comparison, which alleges that\n"); - printf("Q == Y while denying that |Q - Y| == 0; these values\n"); - printf("print out as Q = %.17e, Y = %.17e .\n", Q, Y2); - printf ("|Q - Y| = %.17e .\n" , FABS(Q - Y2)); - UfThold = Q; - break; - - case 3: - X = X; - break; - - case 4: - if ((Q == UfThold) && (E1 == E0) - && (FABS( UfThold - E1 / E9) <= E1)) { - UfNGrad = False; - printf("Underflow is gradual; it incurs Absolute Error =\n"); - printf("(roundoff in UfThold) < E0.\n"); - Y = E0 * CInvrse; - Y = Y * (OneAndHalf + U2); - X = CInvrse * (One + U2); - Y = Y / X; - IEEE = (Y == E0); - } - } - if (UfNGrad) { - printf("\n"); - sigsave = sigfpe; - if (setjmp(ovfl_buf)) { - printf("Underflow / UfThold failed!\n"); - R = H + H; - } - else R = SQRT(Underflow / UfThold); - sigsave = 0; - if (R <= H) { - Z = R * UfThold; - X = Z * (One + R * H * (One + H)); - } - else { - Z = UfThold; - X = Z * (One + H * H * (One + H)); - } - if (! ((X == Z) || (X - Z != Zero))) { - BadCond(Flaw, ""); - printf("X = %.17e\n\tis not equal to Z = %.17e .\n", X, Z); - Z9 = X - Z; - printf("yet X - Z yields %.17e .\n", Z9); - printf(" Should this NOT signal Underflow, "); - printf("this is a SERIOUS DEFECT\nthat causes "); - printf("confusion when innocent statements like\n");; - printf(" if (X == Z) ... else"); - printf(" ... (f(X) - f(Z)) / (X - Z) ...\n"); - printf("encounter Division by Zero although actually\n"); - sigsave = sigfpe; - if (setjmp(ovfl_buf)) printf("X / Z fails!\n"); - else printf("X / Z = 1 + %g .\n", (X / Z - Half) - Half); - sigsave = 0; - } - } - printf("The Underflow threshold is %.17e, %s\n", UfThold, - " below which"); - printf("calculation may suffer larger Relative error than "); - printf("merely roundoff.\n"); - Y2 = U1 * U1; - Y = Y2 * Y2; - Y2 = Y * U1; - if (Y2 <= UfThold) { - if (Y > E0) { - BadCond(Defect, ""); - I = 5; - } - else { - BadCond(Serious, ""); - I = 4; - } - printf("Range is too narrow; U1^%d Underflows.\n", I); - } - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -void part7(VOID){ -*/ - Milestone = 130; - /*=============================================*/ - Y = - FLOOR(Half - TwoForty * LOG(UfThold) / LOG(HInvrse)) / TwoForty; - Y2 = Y + Y; - printf("Since underflow occurs below the threshold\n"); - printf("UfThold = (%.17e) ^ (%.17e)\nonly underflow ", HInvrse, Y); - printf("should afflict the expression\n\t(%.17e) ^ (%.17e);\n", - HInvrse, Y2); - printf("actually calculating yields:"); - if (setjmp(ovfl_buf)) { - sigsave = 0; - BadCond(Serious, "trap on underflow.\n"); - } - else { - sigsave = sigfpe; - V9 = POW(HInvrse, Y2); - sigsave = 0; - printf(" %.17e .\n", V9); - if (! ((V9 >= Zero) && (V9 <= (Radix + Radix + E9) * UfThold))) { - BadCond(Serious, "this is not between 0 and underflow\n"); - printf(" threshold = %.17e .\n", UfThold); - } - else if (! (V9 > UfThold * (One + E9))) - printf("This computed value is O.K.\n"); - else { - BadCond(Defect, "this is not between 0 and underflow\n"); - printf(" threshold = %.17e .\n", UfThold); - } - } - /*=============================================*/ - Milestone = 140; - /*=============================================*/ - printf("\n"); - /* ...calculate Exp2 == exp(2) == 7.389056099... */ - X = Zero; - I = 2; - Y = Two * Three; - Q = Zero; - N = 0; - do { - Z = X; - I = I + 1; - Y = Y / (I + I); - R = Y + Q; - X = Z + R; - Q = (Z - X) + R; - } while(X > Z); - Z = (OneAndHalf + One / Eight) + X / (OneAndHalf * ThirtyTwo); - X = Z * Z; - Exp2 = X * X; - X = F9; - Y = X - U1; - printf("X: %.30f BInverse: %.30f Radix: %.30f Exp2: %.30f F9: %.30f U1 %.30f U2 %.30f F9: %.30f\n", X, BInvrse, Radix, Exp2, F9, U1, U2, F9); - printf("Testing X^((X + 1) / (X - 1)) vs. exp(2) = %.17e as X -> 1.\n", - Exp2); - for(I = 1;;) { - Z = X - BInvrse; - Z = (X + One) / (Z - (One - BInvrse)); - Q = POW(X, Z) - Exp2; - if (FABS(Q) > TwoForty * U2) { - N = 1; - V9 = (X - BInvrse) - (One - BInvrse); - BadCond(Defect, "Calculated"); - printf(" %.17e for\n", POW(X,Z)); - printf("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z); - printf("\tdiffers from correct value by %.17e .\n", Q); - printf("\tThis much error may spoil financial\n"); - printf("\tcalculations involving tiny interest rates.\n"); - break; - } - else { - Z = (Y - X) * Two + Y; - X = Y; - Y = Z; - Z = One + (X - F9)*(X - F9); - if (Z > One && I < NoTrials) I++; - else { - if (X > One) { - if (N == 0) - printf("Accuracy seems adequate.\n"); - break; - } - else { - X = One + U2; - Y = U2 + U2; - Y += X; - I = 1; - } - } - } - } - /*=============================================*/ - Milestone = 150; - /*=============================================*/ - printf("Testing powers Z^Q at four nearly extreme values.\n"); - N = 0; - Z = A1; - Q = FLOOR(Half - LOG(C) / LOG(A1)); - Break = False; - do { - X = CInvrse; - Y = POW(Z, Q); - IsYeqX(); - Q = - Q; - X = C; - Y = POW(Z, Q); - IsYeqX(); - if (Z < One) Break = True; - else Z = AInvrse; - } while ( ! (Break)); - PrintIfNPositive(); - if (N == 0) printf(" ... no discrepancies found.\n"); - printf("\n"); - - /*=============================================*/ - Milestone = 160; - /*=============================================*/ - Pause(); - printf("Searching for Overflow threshold:\n"); - printf("This may generate an error.\n"); - Y = - CInvrse; - V9 = HInvrse * Y; - sigsave = sigfpe; - if (setjmp(ovfl_buf)) { I = 0; V9 = Y; goto overflow; } - do { - V = Y; - Y = V9; - V9 = HInvrse * Y; - } while(V9 < Y); - I = 1; -overflow: - sigsave = 0; - Z = V9; - printf("Can `Z = -Y' overflow?\n"); - printf("Trying it on Y = %.17e .\n", Y); - V9 = - Y; - V0 = V9; - if (V - Y == V + V0) printf("Seems O.K.\n"); - else { - printf("finds a "); - BadCond(Flaw, "-(-Y) differs from Y.\n"); - } - if (Z != Y) { - BadCond(Serious, ""); - printf("overflow past %.17e\n\tshrinks to %.17e .\n", Y, Z); - } - if (I) { - Y = V * (HInvrse * U2 - HInvrse); - Z = Y + ((One - HInvrse) * U2) * V; - if (Z < V0) Y = Z; - if (Y < V0) V = Y; - if (V0 - V < V0) V = V0; - } - else { - V = Y * (HInvrse * U2 - HInvrse); - V = V + ((One - HInvrse) * U2) * Y; - } - printf("Overflow threshold is V = %.17e .\n", V); - if (I) printf("Overflow saturates at V0 = %.17e .\n", V0); - else printf("There is no saturation value because \ -the system traps on overflow.\n"); - V9 = V * One; - printf("No Overflow should be signaled for V * 1 = %.17e\n", V9); - V9 = V / One; - printf(" nor for V / 1 = %.17e .\n", V9); - printf("Any overflow signal separating this * from the one\n"); - printf("above is a DEFECT.\n"); - /*=============================================*/ - Milestone = 170; - /*=============================================*/ - if (!(-V < V && -V0 < V0 && -UfThold < V && UfThold < V)) { - BadCond(Failure, "Comparisons involving "); - printf("+-%g, +-%g\nand +-%g are confused by Overflow.", - V, V0, UfThold); - } - /*=============================================*/ - Milestone = 175; - /*=============================================*/ - printf("\n"); - for(Indx = 1; Indx <= 3; ++Indx) { - switch (Indx) { - case 1: Z = UfThold; break; - case 2: Z = E0; break; - case 3: Z = PseudoZero; break; - } - if (Z != Zero) { - V9 = SQRT(Z); - Y = V9 * V9; - if (Y / (One - Radix * E9) < Z - || Y > (One + Radix * E9) * Z) { /* dgh: + E9 --> * E9 */ - if (V9 > U1) BadCond(Serious, ""); - else BadCond(Defect, ""); - printf("Comparison alleges that what prints as Z = %.17e\n", Z); - printf(" is too far from sqrt(Z) ^ 2 = %.17e .\n", Y); - } - } - } - /*=============================================*/ - Milestone = 180; - /*=============================================*/ - for(Indx = 1; Indx <= 2; ++Indx) { - if (Indx == 1) Z = V; - else Z = V0; - V9 = SQRT(Z); - X = (One - Radix * E9) * V9; - V9 = V9 * X; - if (((V9 < (One - Two * Radix * E9) * Z) || (V9 > Z))) { - Y = V9; - if (X < W) BadCond(Serious, ""); - else BadCond(Defect, ""); - printf("Comparison alleges that Z = %17e\n", Z); - printf(" is too far from sqrt(Z) ^ 2 (%.17e) .\n", Y); - } - } - /*=============================================*/ - /*SPLIT - } -#include "paranoia.h" -int part8(VOID){ -*/ - Milestone = 190; - /*=============================================*/ - Pause(); - X = UfThold * V; - Y = Radix * Radix; - if (X*Y < One || X > Y) { - if (X * Y < U1 || X > Y/U1) BadCond(Defect, "Badly"); - else BadCond(Flaw, ""); - - printf(" unbalanced range; UfThold * V = %.17e\n\t%s\n", - X, "is too far from 1.\n"); - } - /*=============================================*/ - Milestone = 200; - /*=============================================*/ - for (Indx = 1; Indx <= 5; ++Indx) { - X = F9; - switch (Indx) { - case 2: X = One + U2; break; - case 3: X = V; break; - case 4: X = UfThold; break; - case 5: X = Radix; - } - Y = X; - sigsave = sigfpe; - if (setjmp(ovfl_buf)) - printf(" X / X traps when X = %g\n", X); - else { - V9 = (Y / X - Half) - Half; - if (V9 == Zero) continue; - if (V9 == - U1 && Indx < 5) BadCond(Flaw, ""); - else BadCond(Serious, ""); - printf(" X / X differs from 1 when X = %.17e\n", X); - printf(" instead, X / X - 1/2 - 1/2 = %.17e .\n", V9); - } - sigsave = 0; - } - /*=============================================*/ - Milestone = 210; - /*=============================================*/ - MyZero = Zero; - printf("\n"); - printf("What message and/or values does Division by Zero produce?\n") ; -#ifndef NOPAUSE - printf("This can interupt your program. You can "); - printf("skip this part if you wish.\n"); - printf("Do you wish to compute 1 / 0? "); - fflush(stdout); - read (KEYBOARD, ch, 8); - if ((ch[0] == 'Y') || (ch[0] == 'y')) { -#endif - sigsave = sigfpe; - printf(" Trying to compute 1 / 0 produces ..."); - if (!setjmp(ovfl_buf)) printf(" %.7e .\n", One / MyZero); - sigsave = 0; -#ifndef NOPAUSE - } - else printf("O.K.\n"); - printf("\nDo you wish to compute 0 / 0? "); - fflush(stdout); - read (KEYBOARD, ch, 80); - if ((ch[0] == 'Y') || (ch[0] == 'y')) { -#endif - sigsave = sigfpe; - printf("\n Trying to compute 0 / 0 produces ..."); - if (!setjmp(ovfl_buf)) printf(" %.7e .\n", Zero / MyZero); - sigsave = 0; -#ifndef NOPAUSE - } - else printf("O.K.\n"); -#endif - /*=============================================*/ - Milestone = 220; - /*=============================================*/ - Pause(); - printf("\n"); - { - static char *msg[] = { - "FAILUREs encountered =", - "SERIOUS DEFECTs discovered =", - "DEFECTs discovered =", - "FLAWs discovered =" }; - int i; - for(i = 0; i < 4; i++) if (ErrCnt[i]) - printf("The number of %-29s %d.\n", - msg[i], ErrCnt[i]); - } - printf("\n"); - if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[Defect] - + ErrCnt[Flaw]) > 0) { - if ((ErrCnt[Failure] + ErrCnt[Serious] + ErrCnt[ - Defect] == 0) && (ErrCnt[Flaw] > 0)) { - printf("The arithmetic diagnosed seems "); - printf("Satisfactory though flawed.\n"); - } - if ((ErrCnt[Failure] + ErrCnt[Serious] == 0) - && ( ErrCnt[Defect] > 0)) { - printf("The arithmetic diagnosed may be Acceptable\n"); - printf("despite inconvenient Defects.\n"); - } - if ((ErrCnt[Failure] + ErrCnt[Serious]) > 0) { - printf("The arithmetic diagnosed has "); - printf("unacceptable Serious Defects.\n"); - } - if (ErrCnt[Failure] > 0) { - printf("Potentially fatal FAILURE may have spoiled this"); - printf(" program's subsequent diagnoses.\n"); - } - } - else { - printf("No failures, defects nor flaws have been discovered.\n"); - if (! ((RMult == Rounded) && (RDiv == Rounded) - && (RAddSub == Rounded) && (RSqrt == Rounded))) - printf("The arithmetic diagnosed seems Satisfactory.\n"); - else { - if (StickyBit >= One && - (Radix - Two) * (Radix - Nine - One) == Zero) { - printf("Rounding appears to conform to "); - printf("the proposed IEEE standard P"); - if ((Radix == Two) && - ((Precision - Four * Three * Two) * - ( Precision - TwentySeven - - TwentySeven + One) == Zero)) - printf("754"); - else printf("854"); - if (IEEE) printf(".\n"); - else { - printf(",\nexcept for possibly Double Rounding"); - printf(" during Gradual Underflow.\n"); - } - } - printf("The arithmetic diagnosed appears to be Excellent!\n"); - } - } - if (fpecount) - printf("\nA total of %d floating point exceptions were registered.\n", - fpecount); - printf("END OF TEST.\n"); - return 0; - } - -/*SPLIT subs.c -#include "paranoia.h" -*/ - - FLOAT -Sign (FP X) -#ifdef KR_headers -FLOAT X; -#endif -{ return X >= (FLOAT)0. ? (FLOAT)1.0 : (FLOAT)-1.0; } - - void -Pause(VOID) -{ -#ifndef NOPAUSE - char ch[8]; - - printf("\nTo continue, press RETURN"); - fflush(stdout); - read(KEYBOARD, ch, 8); -#endif - printf("\nDiagnosis resumes after milestone Number %d", Milestone); - printf(" Page: %d\n\n", PageNo); - ++Milestone; - ++PageNo; - } - - void -TstCond (INT K, INT Valid, CHARP T) -#ifdef KR_headers -int K, Valid; -char *T; -#endif -{ if (! Valid) { BadCond(K,T); printf(".\n"); } } - - void -BadCond(INT K, CHARP T) -#ifdef KR_headers -int K; -char *T; -#endif -{ - static char *msg[] = { "FAILURE", "SERIOUS DEFECT", "DEFECT", "FLAW" }; - - ErrCnt [K] = ErrCnt [K] + 1; - printf("%s: %s", msg[K], T); - } - - - FLOAT -Random(VOID) -/* Random computes - X = (Random1 + Random9)^5 - Random1 = X - FLOOR(X) + 0.000005 * X; - and returns the new value of Random1 -*/ -{ - FLOAT X, Y; - - X = Random1 + Random9; - Y = X * X; - Y = Y * Y; - X = X * Y; - Y = X - FLOOR(X); - Random1 = Y + X * (FLOAT)0.000005; - return(Random1); - } - - void -SqXMinX (INT ErrKind) -#ifdef KR_headers -int ErrKind; -#endif -{ - FLOAT XA, XB; - - XB = X * BInvrse; - XA = X - XB; - SqEr = ((SQRT(X * X) - XB) - XA) / OneUlp; - if (SqEr != Zero) { - if (SqEr < MinSqEr) MinSqEr = SqEr; - if (SqEr > MaxSqEr) MaxSqEr = SqEr; - J = J + 1.0; - BadCond(ErrKind, "\n"); - printf("sqrt( %.17e) - %.17e = %.17e\n", X * X, X, OneUlp * SqEr); - printf("\tinstead of correct value 0 .\n"); - } - } - - void -NewD(VOID) -{ - X = Z1 * Q; - X = FLOOR(Half - X / Radix) * Radix + X; - Q = (Q - X * Z) / Radix + X * X * (D / Radix); - Z = Z - Two * X * D; - if (Z <= Zero) { - Z = - Z; - Z1 = - Z1; - } - D = Radix * D; - } - - void -SR3750(VOID) -{ - if (! ((X - Radix < Z2 - Radix) || (X - Z2 > W - Z2))) { - I = I + 1; - X2 = SQRT(X * D); - Y2 = (X2 - Z2) - (Y - Z2); - X2 = X8 / (Y - Half); - X2 = X2 - Half * X2 * X2; - SqEr = (Y2 + Half) + (Half - X2); - if (SqEr < MinSqEr) MinSqEr = SqEr; - SqEr = Y2 - X2; - if (SqEr > MaxSqEr) MaxSqEr = SqEr; - } - } - - void -IsYeqX(VOID) -{ - if (Y != X) { - if (N <= 0) { - if (Z == Zero && Q <= Zero) - printf("WARNING: computing\n"); - else BadCond(Defect, "computing\n"); - printf("\t(%.17e) ^ (%.17e)\n", Z, Q); - printf("\tyielded %.17e;\n", Y); - printf("\twhich compared unequal to correct %.17e ;\n", - X); - printf("\t\tthey differ by %.17e .\n", Y - X); - } - N = N + 1; /* ... count discrepancies. */ - } - } - - void -SR3980(VOID) -{ - do { - Q = (FLOAT) I; - Y = POW(Z, Q); - IsYeqX(); - if (++I > M) break; - X = Z * X; - } while ( X < W ); - } - - void -PrintIfNPositive(VOID) -{ - if (N > 0) printf("Similar discrepancies have occurred %d times.\n", N); - } - - void -TstPtUf(VOID) -{ - N = 0; - if (Z != Zero) { - printf("Since comparison denies Z = 0, evaluating "); - printf("(Z + Z) / Z should be safe.\n"); - sigsave = sigfpe; - if (setjmp(ovfl_buf)) goto very_serious; - Q9 = (Z + Z) / Z; - printf("What the machine gets for (Z + Z) / Z is %.17e .\n", - Q9); - if (FABS(Q9 - Two) < Radix * U2) { - printf("This is O.K., provided Over/Underflow"); - printf(" has NOT just been signaled.\n"); - } - else { - if ((Q9 < One) || (Q9 > Two)) { -very_serious: - N = 1; - ErrCnt [Serious] = ErrCnt [Serious] + 1; - printf("This is a VERY SERIOUS DEFECT!\n"); - } - else { - N = 1; - ErrCnt [Defect] = ErrCnt [Defect] + 1; - printf("This is a DEFECT!\n"); - } - } - sigsave = 0; - V9 = Z * One; - Random1 = V9; - V9 = One * Z; - Random2 = V9; - V9 = Z / One; - if ((Z == Random1) && (Z == Random2) && (Z == V9)) { - if (N > 0) Pause(); - } - else { - N = 1; - BadCond(Defect, "What prints as Z = "); - printf("%.17e\n\tcompares different from ", Z); - if (Z != Random1) printf("Z * 1 = %.17e ", Random1); - if (! ((Z == Random2) - || (Random2 == Random1))) - printf("1 * Z == %g\n", Random2); - if (! (Z == V9)) printf("Z / 1 = %.17e\n", V9); - if (Random2 != Random1) { - ErrCnt [Defect] = ErrCnt [Defect] + 1; - BadCond(Defect, "Multiplication does not commute!\n"); - printf("\tComparison alleges that 1 * Z = %.17e\n", - Random2); - printf("\tdiffers from Z * 1 = %.17e\n", Random1); - } - Pause(); - } - } - } - - void -notify(CHARP s) -#ifdef KR_headers - char *s; -#endif -{ - printf("%s test appears to be inconsistent...\n", s); - printf(" PLEASE NOTIFY KARPINKSI!\n"); - } - -/*SPLIT msgs.c -#include "paranoia.h" -*/ - - void -msglist(CHARPP s) -#ifdef KR_headers -char **s; -#endif -{ while(*s) printf("%s\n", *s++); } - - void -Instructions(VOID) -{ - static char *instr[] = { - "Lest this program stop prematurely, i.e. before displaying\n", - " `END OF TEST',\n", - "try to persuade the computer NOT to terminate execution when an", - "error like Over/Underflow or Division by Zero occurs, but rather", - "to persevere with a surrogate value after, perhaps, displaying some", - "warning. If persuasion avails naught, don't despair but run this", - "program anyway to see how many milestones it passes, and then", - "amend it to make further progress.\n", - "Answer questions with Y, y, N or n (unless otherwise indicated).\n", - 0}; - - msglist(instr); - } - - void -Heading(VOID) -{ - static char *head[] = { - "Users are invited to help debug and augment this program so it will", - "cope with unanticipated and newly uncovered arithmetic pathologies.\n", - "Please send suggestions and interesting results to", - "\tRichard Karpinski", - "\tComputer Center U-76", - "\tUniversity of California", - "\tSan Francisco, CA 94143-0704, USA\n", - "In doing so, please include the following information:", -#ifdef Single - "\tPrecision:\tsingle;", -#else - "\tPrecision:\tdouble;", -#endif - "\tVersion:\t10 February 1989;", - "\tComputer:\n", - "\tCompiler:\n", - "\tOptimization level:\n", - "\tOther relevant compiler options:", - 0}; - - msglist(head); - } - - void -Characteristics(VOID) -{ - static char *chars[] = { - "Running this program should reveal these characteristics:", - " Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...", - " Precision = number of significant digits carried.", - " U2 = Radix/Radix^Precision = One Ulp", - "\t(OneUlpnit in the Last Place) of 1.000xxx .", - " U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .", - " Adequacy of guard digits for Mult., Div. and Subt.", - " Whether arithmetic is chopped, correctly rounded, or something else", - "\tfor Mult., Div., Add/Subt. and Sqrt.", - " Whether a Sticky Bit used correctly for rounding.", - " UnderflowThreshold = an underflow threshold.", - " E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.", - " V = an overflow threshold, roughly.", - " V0 tells, roughly, whether Infinity is represented.", - " Comparisions are checked for consistency with subtraction", - "\tand for contamination with pseudo-zeros.", - " Sqrt is tested. Y^X is not tested.", - " Extra-precise subexpressions are revealed but NOT YET tested.", - " Decimal-Binary conversion is NOT YET tested for accuracy.", - 0}; - - msglist(chars); - } - - void -History(VOID) -{ /* History */ - /* Converted from Brian Wichmann's Pascal version to C by Thos Sumner, - with further massaging by David M. Gay. */ - - static char *hist[] = { - "The program attempts to discriminate among", - " FLAWs, like lack of a sticky bit,", - " Serious DEFECTs, like lack of a guard digit, and", - " FAILUREs, like 2+2 == 5 .", - "Failures may confound subsequent diagnoses.\n", - "The diagnostic capabilities of this program go beyond an earlier", - "program called `MACHAR', which can be found at the end of the", - "book `Software Manual for the Elementary Functions' (1980) by", - "W. J. Cody and W. Waite. Although both programs try to discover", - "the Radix, Precision and range (over/underflow thresholds)", - "of the arithmetic, this program tries to cope with a wider variety", - "of pathologies, and to say how well the arithmetic is implemented.", - "\nThe program is based upon a conventional radix representation for", - "floating-point numbers, but also allows logarithmic encoding", - "as used by certain early WANG machines.\n", - "BASIC version of this program (C) 1983 by Prof. W. M. Kahan;", - "see source comments for more history.", - 0}; - - msglist(hist); - } diff --git a/ir/be/test/extreme/worst.c b/ir/be/test/extreme/worst.c deleted file mode 100644 index f75c77a40..000000000 --- a/ir/be/test/extreme/worst.c +++ /dev/null @@ -1,707 +0,0 @@ -/* Twofish for GPG - * Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc. - * Written by Matthew Skala , July 26, 1998 - * 256-bit key length added March 20, 1999 - * Some modifications to reduce the text size by Werner Koch, April, 1998 - * - * This file is part of Libgcrypt. - * - * Libgcrypt is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * Libgcrypt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - ******************************************************************** - * - * This code is a "clean room" implementation, written from the paper - * _Twofish: A 128-Bit Block Cipher_ by Bruce Schneier, John Kelsey, - * Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson, available - * through http://www.counterpane.com/twofish.html - * - * For background information on multiplication in finite fields, used for - * the matrix operations in the key schedule, see the book _Contemporary - * Abstract Algebra_ by Joseph A. Gallian, especially chapter 22 in the - * Third Edition. - * - * Only the 128- and 256-bit key sizes are supported. This code is intended - * for GNU C on a 32-bit system, but it should work almost anywhere. Loops - * are unrolled, precomputation tables are used, etc., for maximum speed at - * some cost in memory consumption. */ - -//#include -#include -#include -#include /* for memcmp() */ - -//#include "types.h" /* for byte and u32 typedefs */ -//#include "g10lib.h" -//#include "cipher.h" - -/* Prototype for the self-test function. */ -//static const char *selftest(void); - -typedef unsigned int u32; -typedef unsigned char byte; - -/* Structure for an expanded Twofish key. s contains the key-dependent - * S-boxes composed with the MDS matrix; w contains the eight "whitening" - * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note - * that k[i] corresponds to what the Twofish paper calls K[i+8]. */ -typedef struct { - u32 s[4][256], w[8], k[32]; -} TWOFISH_context; - -/* These two tables are the q0 and q1 permutations, exactly as described in - * the Twofish paper. */ - -static const byte q0[256] = { - 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, - 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, - 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, - 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, - 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, - 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, - 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, - 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, - 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, - 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, - 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, - 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, - 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, - 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, - 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, - 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, - 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, - 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, - 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, - 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, - 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, - 0x4A, 0x5E, 0xC1, 0xE0 -}; - -static const byte q1[256] = { - 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, - 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, - 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, - 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, - 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, - 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, - 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, - 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, - 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, - 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, - 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, - 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, - 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, - 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, - 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, - 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, - 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, - 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, - 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, - 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, - 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, - 0x55, 0x09, 0xBE, 0x91 -}; - -/* These MDS tables are actually tables of MDS composed with q0 and q1, - * because it is only ever used that way and we can save some time by - * precomputing. Of course the main saving comes from precomputing the - * GF(2^8) multiplication involved in the MDS matrix multiply; by looking - * things up in these tables we reduce the matrix multiply to four lookups - * and three XORs. Semi-formally, the definition of these tables is: - * mds[0][i] = MDS (q1[i] 0 0 0)^T mds[1][i] = MDS (0 q0[i] 0 0)^T - * mds[2][i] = MDS (0 0 q1[i] 0)^T mds[3][i] = MDS (0 0 0 q0[i])^T - * where ^T means "transpose", the matrix multiply is performed in GF(2^8) - * represented as GF(2)[x]/v(x) where v(x)=x^8+x^6+x^5+x^3+1 as described - * by Schneier et al, and I'm casually glossing over the byte/word - * conversion issues. */ - -static const u32 mds[4][256] = { - {0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B, - 0xE2E22BFB, 0x9E9EFAC8, 0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B, - 0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B, 0x3C3C57D6, 0x93938A32, - 0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1, - 0x24243C30, 0x5151E20F, 0xBABAC6F8, 0x4A4AF31B, 0xBFBF4887, 0x0D0D70FA, - 0xB0B0B306, 0x7575DE3F, 0xD2D2FD5E, 0x7D7D20BA, 0x666631AE, 0x3A3AA35B, - 0x59591C8A, 0x00000000, 0xCDCD93BC, 0x1A1AE09D, 0xAEAE2C6D, 0x7F7FABC1, - 0x2B2BC7B1, 0xBEBEB90E, 0xE0E0A080, 0x8A8A105D, 0x3B3B52D2, 0x6464BAD5, - 0xD8D888A0, 0xE7E7A584, 0x5F5FE807, 0x1B1B1114, 0x2C2CC2B5, 0xFCFCB490, - 0x3131272C, 0x808065A3, 0x73732AB2, 0x0C0C8173, 0x79795F4C, 0x6B6B4154, - 0x4B4B0292, 0x53536974, 0x94948F36, 0x83831F51, 0x2A2A3638, 0xC4C49CB0, - 0x2222C8BD, 0xD5D5F85A, 0xBDBDC3FC, 0x48487860, 0xFFFFCE62, 0x4C4C0796, - 0x4141776C, 0xC7C7E642, 0xEBEB24F7, 0x1C1C1410, 0x5D5D637C, 0x36362228, - 0x6767C027, 0xE9E9AF8C, 0x4444F913, 0x1414EA95, 0xF5F5BB9C, 0xCFCF18C7, - 0x3F3F2D24, 0xC0C0E346, 0x7272DB3B, 0x54546C70, 0x29294CCA, 0xF0F035E3, - 0x0808FE85, 0xC6C617CB, 0xF3F34F11, 0x8C8CE4D0, 0xA4A45993, 0xCACA96B8, - 0x68683BA6, 0xB8B84D83, 0x38382820, 0xE5E52EFF, 0xADAD569F, 0x0B0B8477, - 0xC8C81DC3, 0x9999FFCC, 0x5858ED03, 0x19199A6F, 0x0E0E0A08, 0x95957EBF, - 0x70705040, 0xF7F730E7, 0x6E6ECF2B, 0x1F1F6EE2, 0xB5B53D79, 0x09090F0C, - 0x616134AA, 0x57571682, 0x9F9F0B41, 0x9D9D803A, 0x111164EA, 0x2525CDB9, - 0xAFAFDDE4, 0x4545089A, 0xDFDF8DA4, 0xA3A35C97, 0xEAEAD57E, 0x353558DA, - 0xEDEDD07A, 0x4343FC17, 0xF8F8CB66, 0xFBFBB194, 0x3737D3A1, 0xFAFA401D, - 0xC2C2683D, 0xB4B4CCF0, 0x32325DDE, 0x9C9C71B3, 0x5656E70B, 0xE3E3DA72, - 0x878760A7, 0x15151B1C, 0xF9F93AEF, 0x6363BFD1, 0x3434A953, 0x9A9A853E, - 0xB1B1428F, 0x7C7CD133, 0x88889B26, 0x3D3DA65F, 0xA1A1D7EC, 0xE4E4DF76, - 0x8181942A, 0x91910149, 0x0F0FFB81, 0xEEEEAA88, 0x161661EE, 0xD7D77321, - 0x9797F5C4, 0xA5A5A81A, 0xFEFE3FEB, 0x6D6DB5D9, 0x7878AEC5, 0xC5C56D39, - 0x1D1DE599, 0x7676A4CD, 0x3E3EDCAD, 0xCBCB6731, 0xB6B6478B, 0xEFEF5B01, - 0x12121E18, 0x6060C523, 0x6A6AB0DD, 0x4D4DF61F, 0xCECEE94E, 0xDEDE7C2D, - 0x55559DF9, 0x7E7E5A48, 0x2121B24F, 0x03037AF2, 0xA0A02665, 0x5E5E198E, - 0x5A5A6678, 0x65654B5C, 0x62624E58, 0xFDFD4519, 0x0606F48D, 0x404086E5, - 0xF2F2BE98, 0x3333AC57, 0x17179067, 0x05058E7F, 0xE8E85E05, 0x4F4F7D64, - 0x89896AAF, 0x10109563, 0x74742FB6, 0x0A0A75FE, 0x5C5C92F5, 0x9B9B74B7, - 0x2D2D333C, 0x3030D6A5, 0x2E2E49CE, 0x494989E9, 0x46467268, 0x77775544, - 0xA8A8D8E0, 0x9696044D, 0x2828BD43, 0xA9A92969, 0xD9D97929, 0x8686912E, - 0xD1D187AC, 0xF4F44A15, 0x8D8D1559, 0xD6D682A8, 0xB9B9BC0A, 0x42420D9E, - 0xF6F6C16E, 0x2F2FB847, 0xDDDD06DF, 0x23233934, 0xCCCC6235, 0xF1F1C46A, - 0xC1C112CF, 0x8585EBDC, 0x8F8F9E22, 0x7171A1C9, 0x9090F0C0, 0xAAAA539B, - 0x0101F189, 0x8B8BE1D4, 0x4E4E8CED, 0x8E8E6FAB, 0xABABA212, 0x6F6F3EA2, - 0xE6E6540D, 0xDBDBF252, 0x92927BBB, 0xB7B7B602, 0x6969CA2F, 0x3939D9A9, - 0xD3D30CD7, 0xA7A72361, 0xA2A2AD1E, 0xC3C399B4, 0x6C6C4450, 0x07070504, - 0x04047FF6, 0x272746C2, 0xACACA716, 0xD0D07625, 0x50501386, 0xDCDCF756, - 0x84841A55, 0xE1E15109, 0x7A7A25BE, 0x1313EF91}, - - {0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252, - 0xA3658080, 0x76DFE4E4, 0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A, - 0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A, 0x0D54E6E6, 0xC6432020, - 0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141, - 0x43BD2828, 0x7532BCBC, 0x37D47B7B, 0x269B8888, 0xFA700D0D, 0x13F94444, - 0x94B1FBFB, 0x485A7E7E, 0xF27A0303, 0xD0E48C8C, 0x8B47B6B6, 0x303C2424, - 0x84A5E7E7, 0x54416B6B, 0xDF06DDDD, 0x23C56060, 0x1945FDFD, 0x5BA33A3A, - 0x3D68C2C2, 0x59158D8D, 0xF321ECEC, 0xAE316666, 0xA23E6F6F, 0x82165757, - 0x63951010, 0x015BEFEF, 0x834DB8B8, 0x2E918686, 0xD9B56D6D, 0x511F8383, - 0x9B53AAAA, 0x7C635D5D, 0xA63B6868, 0xEB3FFEFE, 0xA5D63030, 0xBE257A7A, - 0x16A7ACAC, 0x0C0F0909, 0xE335F0F0, 0x6123A7A7, 0xC0F09090, 0x8CAFE9E9, - 0x3A809D9D, 0xF5925C5C, 0x73810C0C, 0x2C273131, 0x2576D0D0, 0x0BE75656, - 0xBB7B9292, 0x4EE9CECE, 0x89F10101, 0x6B9F1E1E, 0x53A93434, 0x6AC4F1F1, - 0xB499C3C3, 0xF1975B5B, 0xE1834747, 0xE66B1818, 0xBDC82222, 0x450E9898, - 0xE26E1F1F, 0xF4C9B3B3, 0xB62F7474, 0x66CBF8F8, 0xCCFF9999, 0x95EA1414, - 0x03ED5858, 0x56F7DCDC, 0xD4E18B8B, 0x1C1B1515, 0x1EADA2A2, 0xD70CD3D3, - 0xFB2BE2E2, 0xC31DC8C8, 0x8E195E5E, 0xB5C22C2C, 0xE9894949, 0xCF12C1C1, - 0xBF7E9595, 0xBA207D7D, 0xEA641111, 0x77840B0B, 0x396DC5C5, 0xAF6A8989, - 0x33D17C7C, 0xC9A17171, 0x62CEFFFF, 0x7137BBBB, 0x81FB0F0F, 0x793DB5B5, - 0x0951E1E1, 0xADDC3E3E, 0x242D3F3F, 0xCDA47676, 0xF99D5555, 0xD8EE8282, - 0xE5864040, 0xC5AE7878, 0xB9CD2525, 0x4D049696, 0x44557777, 0x080A0E0E, - 0x86135050, 0xE730F7F7, 0xA1D33737, 0x1D40FAFA, 0xAA346161, 0xED8C4E4E, - 0x06B3B0B0, 0x706C5454, 0xB22A7373, 0xD2523B3B, 0x410B9F9F, 0x7B8B0202, - 0xA088D8D8, 0x114FF3F3, 0x3167CBCB, 0xC2462727, 0x27C06767, 0x90B4FCFC, - 0x20283838, 0xF67F0404, 0x60784848, 0xFF2EE5E5, 0x96074C4C, 0x5C4B6565, - 0xB1C72B2B, 0xAB6F8E8E, 0x9E0D4242, 0x9CBBF5F5, 0x52F2DBDB, 0x1BF34A4A, - 0x5FA63D3D, 0x9359A4A4, 0x0ABCB9B9, 0xEF3AF9F9, 0x91EF1313, 0x85FE0808, - 0x49019191, 0xEE611616, 0x2D7CDEDE, 0x4FB22121, 0x8F42B1B1, 0x3BDB7272, - 0x47B82F2F, 0x8748BFBF, 0x6D2CAEAE, 0x46E3C0C0, 0xD6573C3C, 0x3E859A9A, - 0x6929A9A9, 0x647D4F4F, 0x2A948181, 0xCE492E2E, 0xCB17C6C6, 0x2FCA6969, - 0xFCC3BDBD, 0x975CA3A3, 0x055EE8E8, 0x7AD0EDED, 0xAC87D1D1, 0x7F8E0505, - 0xD5BA6464, 0x1AA8A5A5, 0x4BB72626, 0x0EB9BEBE, 0xA7608787, 0x5AF8D5D5, - 0x28223636, 0x14111B1B, 0x3FDE7575, 0x2979D9D9, 0x88AAEEEE, 0x3C332D2D, - 0x4C5F7979, 0x02B6B7B7, 0xB896CACA, 0xDA583535, 0xB09CC4C4, 0x17FC4343, - 0x551A8484, 0x1FF64D4D, 0x8A1C5959, 0x7D38B2B2, 0x57AC3333, 0xC718CFCF, - 0x8DF40606, 0x74695353, 0xB7749B9B, 0xC4F59797, 0x9F56ADAD, 0x72DAE3E3, - 0x7ED5EAEA, 0x154AF4F4, 0x229E8F8F, 0x12A2ABAB, 0x584E6262, 0x07E85F5F, - 0x99E51D1D, 0x34392323, 0x6EC1F6F6, 0x50446C6C, 0xDE5D3232, 0x68724646, - 0x6526A0A0, 0xBC93CDCD, 0xDB03DADA, 0xF8C6BABA, 0xC8FA9E9E, 0xA882D6D6, - 0x2BCF6E6E, 0x40507070, 0xDCEB8585, 0xFE750A0A, 0x328A9393, 0xA48DDFDF, - 0xCA4C2929, 0x10141C1C, 0x2173D7D7, 0xF0CCB4B4, 0xD309D4D4, 0x5D108A8A, - 0x0FE25151, 0x00000000, 0x6F9A1919, 0x9DE01A1A, 0x368F9494, 0x42E6C7C7, - 0x4AECC9C9, 0x5EFDD2D2, 0xC1AB7F7F, 0xE0D8A8A8}, - - {0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B, - 0xE2FBE22B, 0x9EC89EFA, 0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F, - 0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7, 0x3CD63C57, 0x9332938A, - 0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783, - 0x2430243C, 0x510F51E2, 0xBAF8BAC6, 0x4A1B4AF3, 0xBF87BF48, 0x0DFA0D70, - 0xB006B0B3, 0x753F75DE, 0xD25ED2FD, 0x7DBA7D20, 0x66AE6631, 0x3A5B3AA3, - 0x598A591C, 0x00000000, 0xCDBCCD93, 0x1A9D1AE0, 0xAE6DAE2C, 0x7FC17FAB, - 0x2BB12BC7, 0xBE0EBEB9, 0xE080E0A0, 0x8A5D8A10, 0x3BD23B52, 0x64D564BA, - 0xD8A0D888, 0xE784E7A5, 0x5F075FE8, 0x1B141B11, 0x2CB52CC2, 0xFC90FCB4, - 0x312C3127, 0x80A38065, 0x73B2732A, 0x0C730C81, 0x794C795F, 0x6B546B41, - 0x4B924B02, 0x53745369, 0x9436948F, 0x8351831F, 0x2A382A36, 0xC4B0C49C, - 0x22BD22C8, 0xD55AD5F8, 0xBDFCBDC3, 0x48604878, 0xFF62FFCE, 0x4C964C07, - 0x416C4177, 0xC742C7E6, 0xEBF7EB24, 0x1C101C14, 0x5D7C5D63, 0x36283622, - 0x672767C0, 0xE98CE9AF, 0x441344F9, 0x149514EA, 0xF59CF5BB, 0xCFC7CF18, - 0x3F243F2D, 0xC046C0E3, 0x723B72DB, 0x5470546C, 0x29CA294C, 0xF0E3F035, - 0x088508FE, 0xC6CBC617, 0xF311F34F, 0x8CD08CE4, 0xA493A459, 0xCAB8CA96, - 0x68A6683B, 0xB883B84D, 0x38203828, 0xE5FFE52E, 0xAD9FAD56, 0x0B770B84, - 0xC8C3C81D, 0x99CC99FF, 0x580358ED, 0x196F199A, 0x0E080E0A, 0x95BF957E, - 0x70407050, 0xF7E7F730, 0x6E2B6ECF, 0x1FE21F6E, 0xB579B53D, 0x090C090F, - 0x61AA6134, 0x57825716, 0x9F419F0B, 0x9D3A9D80, 0x11EA1164, 0x25B925CD, - 0xAFE4AFDD, 0x459A4508, 0xDFA4DF8D, 0xA397A35C, 0xEA7EEAD5, 0x35DA3558, - 0xED7AEDD0, 0x431743FC, 0xF866F8CB, 0xFB94FBB1, 0x37A137D3, 0xFA1DFA40, - 0xC23DC268, 0xB4F0B4CC, 0x32DE325D, 0x9CB39C71, 0x560B56E7, 0xE372E3DA, - 0x87A78760, 0x151C151B, 0xF9EFF93A, 0x63D163BF, 0x345334A9, 0x9A3E9A85, - 0xB18FB142, 0x7C337CD1, 0x8826889B, 0x3D5F3DA6, 0xA1ECA1D7, 0xE476E4DF, - 0x812A8194, 0x91499101, 0x0F810FFB, 0xEE88EEAA, 0x16EE1661, 0xD721D773, - 0x97C497F5, 0xA51AA5A8, 0xFEEBFE3F, 0x6DD96DB5, 0x78C578AE, 0xC539C56D, - 0x1D991DE5, 0x76CD76A4, 0x3EAD3EDC, 0xCB31CB67, 0xB68BB647, 0xEF01EF5B, - 0x1218121E, 0x602360C5, 0x6ADD6AB0, 0x4D1F4DF6, 0xCE4ECEE9, 0xDE2DDE7C, - 0x55F9559D, 0x7E487E5A, 0x214F21B2, 0x03F2037A, 0xA065A026, 0x5E8E5E19, - 0x5A785A66, 0x655C654B, 0x6258624E, 0xFD19FD45, 0x068D06F4, 0x40E54086, - 0xF298F2BE, 0x335733AC, 0x17671790, 0x057F058E, 0xE805E85E, 0x4F644F7D, - 0x89AF896A, 0x10631095, 0x74B6742F, 0x0AFE0A75, 0x5CF55C92, 0x9BB79B74, - 0x2D3C2D33, 0x30A530D6, 0x2ECE2E49, 0x49E94989, 0x46684672, 0x77447755, - 0xA8E0A8D8, 0x964D9604, 0x284328BD, 0xA969A929, 0xD929D979, 0x862E8691, - 0xD1ACD187, 0xF415F44A, 0x8D598D15, 0xD6A8D682, 0xB90AB9BC, 0x429E420D, - 0xF66EF6C1, 0x2F472FB8, 0xDDDFDD06, 0x23342339, 0xCC35CC62, 0xF16AF1C4, - 0xC1CFC112, 0x85DC85EB, 0x8F228F9E, 0x71C971A1, 0x90C090F0, 0xAA9BAA53, - 0x018901F1, 0x8BD48BE1, 0x4EED4E8C, 0x8EAB8E6F, 0xAB12ABA2, 0x6FA26F3E, - 0xE60DE654, 0xDB52DBF2, 0x92BB927B, 0xB702B7B6, 0x692F69CA, 0x39A939D9, - 0xD3D7D30C, 0xA761A723, 0xA21EA2AD, 0xC3B4C399, 0x6C506C44, 0x07040705, - 0x04F6047F, 0x27C22746, 0xAC16ACA7, 0xD025D076, 0x50865013, 0xDC56DCF7, - 0x8455841A, 0xE109E151, 0x7ABE7A25, 0x139113EF}, - - {0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98, - 0x6580A365, 0xDFE476DF, 0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866, - 0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836, 0x54E60D54, 0x4320C643, - 0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77, - 0xBD2843BD, 0x32BC7532, 0xD47B37D4, 0x9B88269B, 0x700DFA70, 0xF94413F9, - 0xB1FB94B1, 0x5A7E485A, 0x7A03F27A, 0xE48CD0E4, 0x47B68B47, 0x3C24303C, - 0xA5E784A5, 0x416B5441, 0x06DDDF06, 0xC56023C5, 0x45FD1945, 0xA33A5BA3, - 0x68C23D68, 0x158D5915, 0x21ECF321, 0x3166AE31, 0x3E6FA23E, 0x16578216, - 0x95106395, 0x5BEF015B, 0x4DB8834D, 0x91862E91, 0xB56DD9B5, 0x1F83511F, - 0x53AA9B53, 0x635D7C63, 0x3B68A63B, 0x3FFEEB3F, 0xD630A5D6, 0x257ABE25, - 0xA7AC16A7, 0x0F090C0F, 0x35F0E335, 0x23A76123, 0xF090C0F0, 0xAFE98CAF, - 0x809D3A80, 0x925CF592, 0x810C7381, 0x27312C27, 0x76D02576, 0xE7560BE7, - 0x7B92BB7B, 0xE9CE4EE9, 0xF10189F1, 0x9F1E6B9F, 0xA93453A9, 0xC4F16AC4, - 0x99C3B499, 0x975BF197, 0x8347E183, 0x6B18E66B, 0xC822BDC8, 0x0E98450E, - 0x6E1FE26E, 0xC9B3F4C9, 0x2F74B62F, 0xCBF866CB, 0xFF99CCFF, 0xEA1495EA, - 0xED5803ED, 0xF7DC56F7, 0xE18BD4E1, 0x1B151C1B, 0xADA21EAD, 0x0CD3D70C, - 0x2BE2FB2B, 0x1DC8C31D, 0x195E8E19, 0xC22CB5C2, 0x8949E989, 0x12C1CF12, - 0x7E95BF7E, 0x207DBA20, 0x6411EA64, 0x840B7784, 0x6DC5396D, 0x6A89AF6A, - 0xD17C33D1, 0xA171C9A1, 0xCEFF62CE, 0x37BB7137, 0xFB0F81FB, 0x3DB5793D, - 0x51E10951, 0xDC3EADDC, 0x2D3F242D, 0xA476CDA4, 0x9D55F99D, 0xEE82D8EE, - 0x8640E586, 0xAE78C5AE, 0xCD25B9CD, 0x04964D04, 0x55774455, 0x0A0E080A, - 0x13508613, 0x30F7E730, 0xD337A1D3, 0x40FA1D40, 0x3461AA34, 0x8C4EED8C, - 0xB3B006B3, 0x6C54706C, 0x2A73B22A, 0x523BD252, 0x0B9F410B, 0x8B027B8B, - 0x88D8A088, 0x4FF3114F, 0x67CB3167, 0x4627C246, 0xC06727C0, 0xB4FC90B4, - 0x28382028, 0x7F04F67F, 0x78486078, 0x2EE5FF2E, 0x074C9607, 0x4B655C4B, - 0xC72BB1C7, 0x6F8EAB6F, 0x0D429E0D, 0xBBF59CBB, 0xF2DB52F2, 0xF34A1BF3, - 0xA63D5FA6, 0x59A49359, 0xBCB90ABC, 0x3AF9EF3A, 0xEF1391EF, 0xFE0885FE, - 0x01914901, 0x6116EE61, 0x7CDE2D7C, 0xB2214FB2, 0x42B18F42, 0xDB723BDB, - 0xB82F47B8, 0x48BF8748, 0x2CAE6D2C, 0xE3C046E3, 0x573CD657, 0x859A3E85, - 0x29A96929, 0x7D4F647D, 0x94812A94, 0x492ECE49, 0x17C6CB17, 0xCA692FCA, - 0xC3BDFCC3, 0x5CA3975C, 0x5EE8055E, 0xD0ED7AD0, 0x87D1AC87, 0x8E057F8E, - 0xBA64D5BA, 0xA8A51AA8, 0xB7264BB7, 0xB9BE0EB9, 0x6087A760, 0xF8D55AF8, - 0x22362822, 0x111B1411, 0xDE753FDE, 0x79D92979, 0xAAEE88AA, 0x332D3C33, - 0x5F794C5F, 0xB6B702B6, 0x96CAB896, 0x5835DA58, 0x9CC4B09C, 0xFC4317FC, - 0x1A84551A, 0xF64D1FF6, 0x1C598A1C, 0x38B27D38, 0xAC3357AC, 0x18CFC718, - 0xF4068DF4, 0x69537469, 0x749BB774, 0xF597C4F5, 0x56AD9F56, 0xDAE372DA, - 0xD5EA7ED5, 0x4AF4154A, 0x9E8F229E, 0xA2AB12A2, 0x4E62584E, 0xE85F07E8, - 0xE51D99E5, 0x39233439, 0xC1F66EC1, 0x446C5044, 0x5D32DE5D, 0x72466872, - 0x26A06526, 0x93CDBC93, 0x03DADB03, 0xC6BAF8C6, 0xFA9EC8FA, 0x82D6A882, - 0xCF6E2BCF, 0x50704050, 0xEB85DCEB, 0x750AFE75, 0x8A93328A, 0x8DDFA48D, - 0x4C29CA4C, 0x141C1014, 0x73D72173, 0xCCB4F0CC, 0x09D4D309, 0x108A5D10, - 0xE2510FE2, 0x00000000, 0x9A196F9A, 0xE01A9DE0, 0x8F94368F, 0xE6C742E6, - 0xECC94AEC, 0xFDD25EFD, 0xAB7FC1AB, 0xD8A8E0D8} -}; - -/* The exp_to_poly and poly_to_exp tables are used to perform efficient - * operations in GF(2^8) represented as GF(2)[x]/w(x) where - * w(x)=x^8+x^6+x^3+x^2+1. We care about doing that because it's part of the - * definition of the RS matrix in the key schedule. Elements of that field - * are polynomials of degree not greater than 7 and all coefficients 0 or 1, - * which can be represented naturally by bytes (just substitute x=2). In that - * form, GF(2^8) addition is the same as bitwise XOR, but GF(2^8) - * multiplication is inefficient without hardware support. To multiply - * faster, I make use of the fact x is a generator for the nonzero elements, - * so that every element p of GF(2)[x]/w(x) is either 0 or equal to (x)^n for - * some n in 0..254. Note that that caret is exponentiation in GF(2^8), - * *not* polynomial notation. So if I want to compute pq where p and q are - * in GF(2^8), I can just say: - * 1. if p=0 or q=0 then pq=0 - * 2. otherwise, find m and n such that p=x^m and q=x^n - * 3. pq=(x^m)(x^n)=x^(m+n), so add m and n and find pq - * The translations in steps 2 and 3 are looked up in the tables - * poly_to_exp (for step 2) and exp_to_poly (for step 3). To see this - * in action, look at the CALC_S macro. As additional wrinkles, note that - * one of my operands is always a constant, so the poly_to_exp lookup on it - * is done in advance; I included the original values in the comments so - * readers can have some chance of recognizing that this *is* the RS matrix - * from the Twofish paper. I've only included the table entries I actually - * need; I never do a lookup on a variable input of zero and the biggest - * exponents I'll ever see are 254 (variable) and 237 (constant), so they'll - * never sum to more than 491. I'm repeating part of the exp_to_poly table - * so that I don't have to do mod-255 reduction in the exponent arithmetic. - * Since I know my constant operands are never zero, I only have to worry - * about zero values in the variable operand, and I do it with a simple - * conditional branch. I know conditionals are expensive, but I couldn't - * see a non-horrible way of avoiding them, and I did manage to group the - * statements so that each if covers four group multiplications. */ - -static const byte poly_to_exp[255] = { - 0x00, 0x01, 0x17, 0x02, 0x2E, 0x18, 0x53, 0x03, 0x6A, 0x2F, 0x93, 0x19, - 0x34, 0x54, 0x45, 0x04, 0x5C, 0x6B, 0xB6, 0x30, 0xA6, 0x94, 0x4B, 0x1A, - 0x8C, 0x35, 0x81, 0x55, 0xAA, 0x46, 0x0D, 0x05, 0x24, 0x5D, 0x87, 0x6C, - 0x9B, 0xB7, 0xC1, 0x31, 0x2B, 0xA7, 0xA3, 0x95, 0x98, 0x4C, 0xCA, 0x1B, - 0xE6, 0x8D, 0x73, 0x36, 0xCD, 0x82, 0x12, 0x56, 0x62, 0xAB, 0xF0, 0x47, - 0x4F, 0x0E, 0xBD, 0x06, 0xD4, 0x25, 0xD2, 0x5E, 0x27, 0x88, 0x66, 0x6D, - 0xD6, 0x9C, 0x79, 0xB8, 0x08, 0xC2, 0xDF, 0x32, 0x68, 0x2C, 0xFD, 0xA8, - 0x8A, 0xA4, 0x5A, 0x96, 0x29, 0x99, 0x22, 0x4D, 0x60, 0xCB, 0xE4, 0x1C, - 0x7B, 0xE7, 0x3B, 0x8E, 0x9E, 0x74, 0xF4, 0x37, 0xD8, 0xCE, 0xF9, 0x83, - 0x6F, 0x13, 0xB2, 0x57, 0xE1, 0x63, 0xDC, 0xAC, 0xC4, 0xF1, 0xAF, 0x48, - 0x0A, 0x50, 0x42, 0x0F, 0xBA, 0xBE, 0xC7, 0x07, 0xDE, 0xD5, 0x78, 0x26, - 0x65, 0xD3, 0xD1, 0x5F, 0xE3, 0x28, 0x21, 0x89, 0x59, 0x67, 0xFC, 0x6E, - 0xB1, 0xD7, 0xF8, 0x9D, 0xF3, 0x7A, 0x3A, 0xB9, 0xC6, 0x09, 0x41, 0xC3, - 0xAE, 0xE0, 0xDB, 0x33, 0x44, 0x69, 0x92, 0x2D, 0x52, 0xFE, 0x16, 0xA9, - 0x0C, 0x8B, 0x80, 0xA5, 0x4A, 0x5B, 0xB5, 0x97, 0xC9, 0x2A, 0xA2, 0x9A, - 0xC0, 0x23, 0x86, 0x4E, 0xBC, 0x61, 0xEF, 0xCC, 0x11, 0xE5, 0x72, 0x1D, - 0x3D, 0x7C, 0xEB, 0xE8, 0xE9, 0x3C, 0xEA, 0x8F, 0x7D, 0x9F, 0xEC, 0x75, - 0x1E, 0xF5, 0x3E, 0x38, 0xF6, 0xD9, 0x3F, 0xCF, 0x76, 0xFA, 0x1F, 0x84, - 0xA0, 0x70, 0xED, 0x14, 0x90, 0xB3, 0x7E, 0x58, 0xFB, 0xE2, 0x20, 0x64, - 0xD0, 0xDD, 0x77, 0xAD, 0xDA, 0xC5, 0x40, 0xF2, 0x39, 0xB0, 0xF7, 0x49, - 0xB4, 0x0B, 0x7F, 0x51, 0x15, 0x43, 0x91, 0x10, 0x71, 0xBB, 0xEE, 0xBF, - 0x85, 0xC8, 0xA1 -}; - -static const byte exp_to_poly[492] = { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x4D, 0x9A, 0x79, 0xF2, - 0xA9, 0x1F, 0x3E, 0x7C, 0xF8, 0xBD, 0x37, 0x6E, 0xDC, 0xF5, 0xA7, 0x03, - 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xCD, 0xD7, 0xE3, 0x8B, 0x5B, 0xB6, - 0x21, 0x42, 0x84, 0x45, 0x8A, 0x59, 0xB2, 0x29, 0x52, 0xA4, 0x05, 0x0A, - 0x14, 0x28, 0x50, 0xA0, 0x0D, 0x1A, 0x34, 0x68, 0xD0, 0xED, 0x97, 0x63, - 0xC6, 0xC1, 0xCF, 0xD3, 0xEB, 0x9B, 0x7B, 0xF6, 0xA1, 0x0F, 0x1E, 0x3C, - 0x78, 0xF0, 0xAD, 0x17, 0x2E, 0x5C, 0xB8, 0x3D, 0x7A, 0xF4, 0xA5, 0x07, - 0x0E, 0x1C, 0x38, 0x70, 0xE0, 0x8D, 0x57, 0xAE, 0x11, 0x22, 0x44, 0x88, - 0x5D, 0xBA, 0x39, 0x72, 0xE4, 0x85, 0x47, 0x8E, 0x51, 0xA2, 0x09, 0x12, - 0x24, 0x48, 0x90, 0x6D, 0xDA, 0xF9, 0xBF, 0x33, 0x66, 0xCC, 0xD5, 0xE7, - 0x83, 0x4B, 0x96, 0x61, 0xC2, 0xC9, 0xDF, 0xF3, 0xAB, 0x1B, 0x36, 0x6C, - 0xD8, 0xFD, 0xB7, 0x23, 0x46, 0x8C, 0x55, 0xAA, 0x19, 0x32, 0x64, 0xC8, - 0xDD, 0xF7, 0xA3, 0x0B, 0x16, 0x2C, 0x58, 0xB0, 0x2D, 0x5A, 0xB4, 0x25, - 0x4A, 0x94, 0x65, 0xCA, 0xD9, 0xFF, 0xB3, 0x2B, 0x56, 0xAC, 0x15, 0x2A, - 0x54, 0xA8, 0x1D, 0x3A, 0x74, 0xE8, 0x9D, 0x77, 0xEE, 0x91, 0x6F, 0xDE, - 0xF1, 0xAF, 0x13, 0x26, 0x4C, 0x98, 0x7D, 0xFA, 0xB9, 0x3F, 0x7E, 0xFC, - 0xB5, 0x27, 0x4E, 0x9C, 0x75, 0xEA, 0x99, 0x7F, 0xFE, 0xB1, 0x2F, 0x5E, - 0xBC, 0x35, 0x6A, 0xD4, 0xE5, 0x87, 0x43, 0x86, 0x41, 0x82, 0x49, 0x92, - 0x69, 0xD2, 0xE9, 0x9F, 0x73, 0xE6, 0x81, 0x4F, 0x9E, 0x71, 0xE2, 0x89, - 0x5F, 0xBE, 0x31, 0x62, 0xC4, 0xC5, 0xC7, 0xC3, 0xCB, 0xDB, 0xFB, 0xBB, - 0x3B, 0x76, 0xEC, 0x95, 0x67, 0xCE, 0xD1, 0xEF, 0x93, 0x6B, 0xD6, 0xE1, - 0x8F, 0x53, 0xA6, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x4D, - 0x9A, 0x79, 0xF2, 0xA9, 0x1F, 0x3E, 0x7C, 0xF8, 0xBD, 0x37, 0x6E, 0xDC, - 0xF5, 0xA7, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xCD, 0xD7, 0xE3, - 0x8B, 0x5B, 0xB6, 0x21, 0x42, 0x84, 0x45, 0x8A, 0x59, 0xB2, 0x29, 0x52, - 0xA4, 0x05, 0x0A, 0x14, 0x28, 0x50, 0xA0, 0x0D, 0x1A, 0x34, 0x68, 0xD0, - 0xED, 0x97, 0x63, 0xC6, 0xC1, 0xCF, 0xD3, 0xEB, 0x9B, 0x7B, 0xF6, 0xA1, - 0x0F, 0x1E, 0x3C, 0x78, 0xF0, 0xAD, 0x17, 0x2E, 0x5C, 0xB8, 0x3D, 0x7A, - 0xF4, 0xA5, 0x07, 0x0E, 0x1C, 0x38, 0x70, 0xE0, 0x8D, 0x57, 0xAE, 0x11, - 0x22, 0x44, 0x88, 0x5D, 0xBA, 0x39, 0x72, 0xE4, 0x85, 0x47, 0x8E, 0x51, - 0xA2, 0x09, 0x12, 0x24, 0x48, 0x90, 0x6D, 0xDA, 0xF9, 0xBF, 0x33, 0x66, - 0xCC, 0xD5, 0xE7, 0x83, 0x4B, 0x96, 0x61, 0xC2, 0xC9, 0xDF, 0xF3, 0xAB, - 0x1B, 0x36, 0x6C, 0xD8, 0xFD, 0xB7, 0x23, 0x46, 0x8C, 0x55, 0xAA, 0x19, - 0x32, 0x64, 0xC8, 0xDD, 0xF7, 0xA3, 0x0B, 0x16, 0x2C, 0x58, 0xB0, 0x2D, - 0x5A, 0xB4, 0x25, 0x4A, 0x94, 0x65, 0xCA, 0xD9, 0xFF, 0xB3, 0x2B, 0x56, - 0xAC, 0x15, 0x2A, 0x54, 0xA8, 0x1D, 0x3A, 0x74, 0xE8, 0x9D, 0x77, 0xEE, - 0x91, 0x6F, 0xDE, 0xF1, 0xAF, 0x13, 0x26, 0x4C, 0x98, 0x7D, 0xFA, 0xB9, - 0x3F, 0x7E, 0xFC, 0xB5, 0x27, 0x4E, 0x9C, 0x75, 0xEA, 0x99, 0x7F, 0xFE, - 0xB1, 0x2F, 0x5E, 0xBC, 0x35, 0x6A, 0xD4, 0xE5, 0x87, 0x43, 0x86, 0x41, - 0x82, 0x49, 0x92, 0x69, 0xD2, 0xE9, 0x9F, 0x73, 0xE6, 0x81, 0x4F, 0x9E, - 0x71, 0xE2, 0x89, 0x5F, 0xBE, 0x31, 0x62, 0xC4, 0xC5, 0xC7, 0xC3, 0xCB -}; - - -/* The table constants are indices of - * S-box entries, preprocessed through q0 and q1. */ -static byte calc_sb_tbl[512] = { - 0xA9, 0x75, 0x67, 0xF3, 0xB3, 0xC6, 0xE8, 0xF4, - 0x04, 0xDB, 0xFD, 0x7B, 0xA3, 0xFB, 0x76, 0xC8, - 0x9A, 0x4A, 0x92, 0xD3, 0x80, 0xE6, 0x78, 0x6B, - 0xE4, 0x45, 0xDD, 0x7D, 0xD1, 0xE8, 0x38, 0x4B, - 0x0D, 0xD6, 0xC6, 0x32, 0x35, 0xD8, 0x98, 0xFD, - 0x18, 0x37, 0xF7, 0x71, 0xEC, 0xF1, 0x6C, 0xE1, - 0x43, 0x30, 0x75, 0x0F, 0x37, 0xF8, 0x26, 0x1B, - 0xFA, 0x87, 0x13, 0xFA, 0x94, 0x06, 0x48, 0x3F, - 0xF2, 0x5E, 0xD0, 0xBA, 0x8B, 0xAE, 0x30, 0x5B, - 0x84, 0x8A, 0x54, 0x00, 0xDF, 0xBC, 0x23, 0x9D, - 0x19, 0x6D, 0x5B, 0xC1, 0x3D, 0xB1, 0x59, 0x0E, - 0xF3, 0x80, 0xAE, 0x5D, 0xA2, 0xD2, 0x82, 0xD5, - 0x63, 0xA0, 0x01, 0x84, 0x83, 0x07, 0x2E, 0x14, - 0xD9, 0xB5, 0x51, 0x90, 0x9B, 0x2C, 0x7C, 0xA3, - 0xA6, 0xB2, 0xEB, 0x73, 0xA5, 0x4C, 0xBE, 0x54, - 0x16, 0x92, 0x0C, 0x74, 0xE3, 0x36, 0x61, 0x51, - 0xC0, 0x38, 0x8C, 0xB0, 0x3A, 0xBD, 0xF5, 0x5A, - 0x73, 0xFC, 0x2C, 0x60, 0x25, 0x62, 0x0B, 0x96, - 0xBB, 0x6C, 0x4E, 0x42, 0x89, 0xF7, 0x6B, 0x10, - 0x53, 0x7C, 0x6A, 0x28, 0xB4, 0x27, 0xF1, 0x8C, - 0xE1, 0x13, 0xE6, 0x95, 0xBD, 0x9C, 0x45, 0xC7, - 0xE2, 0x24, 0xF4, 0x46, 0xB6, 0x3B, 0x66, 0x70, - 0xCC, 0xCA, 0x95, 0xE3, 0x03, 0x85, 0x56, 0xCB, - 0xD4, 0x11, 0x1C, 0xD0, 0x1E, 0x93, 0xD7, 0xB8, - 0xFB, 0xA6, 0xC3, 0x83, 0x8E, 0x20, 0xB5, 0xFF, - 0xE9, 0x9F, 0xCF, 0x77, 0xBF, 0xC3, 0xBA, 0xCC, - 0xEA, 0x03, 0x77, 0x6F, 0x39, 0x08, 0xAF, 0xBF, - 0x33, 0x40, 0xC9, 0xE7, 0x62, 0x2B, 0x71, 0xE2, - 0x81, 0x79, 0x79, 0x0C, 0x09, 0xAA, 0xAD, 0x82, - 0x24, 0x41, 0xCD, 0x3A, 0xF9, 0xEA, 0xD8, 0xB9, - 0xE5, 0xE4, 0xC5, 0x9A, 0xB9, 0xA4, 0x4D, 0x97, - 0x44, 0x7E, 0x08, 0xDA, 0x86, 0x7A, 0xE7, 0x17, - 0xA1, 0x66, 0x1D, 0x94, 0xAA, 0xA1, 0xED, 0x1D, - 0x06, 0x3D, 0x70, 0xF0, 0xB2, 0xDE, 0xD2, 0xB3, - 0x41, 0x0B, 0x7B, 0x72, 0xA0, 0xA7, 0x11, 0x1C, - 0x31, 0xEF, 0xC2, 0xD1, 0x27, 0x53, 0x90, 0x3E, - 0x20, 0x8F, 0xF6, 0x33, 0x60, 0x26, 0xFF, 0x5F, - 0x96, 0xEC, 0x5C, 0x76, 0xB1, 0x2A, 0xAB, 0x49, - 0x9E, 0x81, 0x9C, 0x88, 0x52, 0xEE, 0x1B, 0x21, - 0x5F, 0xC4, 0x93, 0x1A, 0x0A, 0xEB, 0xEF, 0xD9, - 0x91, 0xC5, 0x85, 0x39, 0x49, 0x99, 0xEE, 0xCD, - 0x2D, 0xAD, 0x4F, 0x31, 0x8F, 0x8B, 0x3B, 0x01, - 0x47, 0x18, 0x87, 0x23, 0x6D, 0xDD, 0x46, 0x1F, - 0xD6, 0x4E, 0x3E, 0x2D, 0x69, 0xF9, 0x64, 0x48, - 0x2A, 0x4F, 0xCE, 0xF2, 0xCB, 0x65, 0x2F, 0x8E, - 0xFC, 0x78, 0x97, 0x5C, 0x05, 0x58, 0x7A, 0x19, - 0xAC, 0x8D, 0x7F, 0xE5, 0xD5, 0x98, 0x1A, 0x57, - 0x4B, 0x67, 0x0E, 0x7F, 0xA7, 0x05, 0x5A, 0x64, - 0x28, 0xAF, 0x14, 0x63, 0x3F, 0xB6, 0x29, 0xFE, - 0x88, 0xF5, 0x3C, 0xB7, 0x4C, 0x3C, 0x02, 0xA5, - 0xB8, 0xCE, 0xDA, 0xE9, 0xB0, 0x68, 0x17, 0x44, - 0x55, 0xE0, 0x1F, 0x4D, 0x8A, 0x43, 0x7D, 0x69, - 0x57, 0x29, 0xC7, 0x2E, 0x8D, 0xAC, 0x74, 0x15, - 0xB7, 0x59, 0xC4, 0xA8, 0x9F, 0x0A, 0x72, 0x9E, - 0x7E, 0x6E, 0x15, 0x47, 0x22, 0xDF, 0x12, 0x34, - 0x58, 0x35, 0x07, 0x6A, 0x99, 0xCF, 0x34, 0xDC, - 0x6E, 0x22, 0x50, 0xC9, 0xDE, 0xC0, 0x68, 0x9B, - 0x65, 0x89, 0xBC, 0xD4, 0xDB, 0xED, 0xF8, 0xAB, - 0xC8, 0x12, 0xA8, 0xA2, 0x2B, 0x0D, 0x40, 0x52, - 0xDC, 0xBB, 0xFE, 0x02, 0x32, 0x2F, 0xA4, 0xA9, - 0xCA, 0xD7, 0x10, 0x61, 0x21, 0x1E, 0xF0, 0xB4, - 0xD3, 0x50, 0x5D, 0x04, 0x0F, 0xF6, 0x00, 0xC2, - 0x6F, 0x16, 0x9D, 0x25, 0x36, 0x86, 0x42, 0x56, - 0x4A, 0x55, 0x5E, 0x09, 0xC1, 0xBE, 0xE0, 0x91 -}; -/* Macro to perform one column of the RS matrix multiplication. The - * parameters a, b, c, and d are the four bytes of output; i is the index - * of the key bytes, and w, x, y, and z, are the column of constants from - * the RS matrix, preprocessed through the poly_to_exp table. */ - -#define CALC_S(a, b, c, d, i, w, x, y, z) \ - if (key[i]) { \ - tmp = poly_to_exp[key[i] - 1]; \ - (a) ^= exp_to_poly[tmp + (w)]; \ - (b) ^= exp_to_poly[tmp + (x)]; \ - (c) ^= exp_to_poly[tmp + (y)]; \ - (d) ^= exp_to_poly[tmp + (z)]; \ - } - -/* Macros to calculate the key-dependent S-boxes for a 128-bit key using - * the S vector from CALC_S. CALC_SB_2 computes a single entry in all - * four S-boxes, where i is the index of the entry to compute, and a and b - * are the index numbers preprocessed through the q0 and q1 tables - * respectively. CALC_SB is simply a convenience to make the code shorter; - * it calls CALC_SB_2 four times with consecutive indices from i to i+3, - * using the remaining parameters two by two. */ - -#define CALC_SB_2(i, a, b) \ - ctx->s[0][i] = mds[0][q0[(a) ^ sa] ^ se]; \ - ctx->s[1][i] = mds[1][q0[(b) ^ sb] ^ sf]; \ - ctx->s[2][i] = mds[2][q1[(a) ^ sc] ^ sg]; \ - ctx->s[3][i] = mds[3][q1[(b) ^ sd] ^ sh] - -#define CALC_SB(i, a, b, c, d, e, f, g, h) \ - CALC_SB_2 (i, a, b); CALC_SB_2 ((i)+1, c, d); \ - CALC_SB_2 ((i)+2, e, f); CALC_SB_2 ((i)+3, g, h) - -/* Macros exactly like CALC_SB and CALC_SB_2, but for 256-bit keys. */ - -#define CALC_SB256_2(i, a, b) \ - ctx->s[0][i] = mds[0][q0[q0[q1[(b) ^ sa] ^ se] ^ si] ^ sm]; \ - ctx->s[1][i] = mds[1][q0[q1[q1[(a) ^ sb] ^ sf] ^ sj] ^ sn]; \ - ctx->s[2][i] = mds[2][q1[q0[q0[(a) ^ sc] ^ sg] ^ sk] ^ so]; \ - ctx->s[3][i] = mds[3][q1[q1[q0[(b) ^ sd] ^ sh] ^ sl] ^ sp]; - -#define CALC_SB256(i, a, b, c, d, e, f, g, h) \ - CALC_SB256_2 (i, a, b); CALC_SB256_2 ((i)+1, c, d); \ - CALC_SB256_2 ((i)+2, e, f); CALC_SB256_2 ((i)+3, g, h) - -/* Macros to calculate the whitening and round subkeys. CALC_K_2 computes the - * last two stages of the h() function for a given index (either 2i or 2i+1). - * a, b, c, and d are the four bytes going into the last two stages. For - * 128-bit keys, this is the entire h() function and a and c are the index - * preprocessed through q0 and q1 respectively; for longer keys they are the - * output of previous stages. j is the index of the first key byte to use. - * CALC_K computes a pair of subkeys for 128-bit Twofish, by calling CALC_K_2 - * twice, doing the Psuedo-Hadamard Transform, and doing the necessary - * rotations. Its parameters are: a, the array to write the results into, - * j, the index of the first output entry, k and l, the preprocessed indices - * for index 2i, and m and n, the preprocessed indices for index 2i+1. - * CALC_K256_2 expands CALC_K_2 to handle 256-bit keys, by doing two - * additional lookup-and-XOR stages. The parameters a and b are the index - * preprocessed through q0 and q1 respectively; j is the index of the first - * key byte to use. CALC_K256 is identical to CALC_K but for using the - * CALC_K256_2 macro instead of CALC_K_2. */ - -#define CALC_K_2(a, b, c, d, j) \ - mds[0][q0[a ^ key[(j) + 8]] ^ key[j]] \ - ^ mds[1][q0[b ^ key[(j) + 9]] ^ key[(j) + 1]] \ - ^ mds[2][q1[c ^ key[(j) + 10]] ^ key[(j) + 2]] \ - ^ mds[3][q1[d ^ key[(j) + 11]] ^ key[(j) + 3]] - -#define CALC_K(a, j, k, l, m, n) \ - x = CALC_K_2 (k, l, k, l, 0); \ - y = CALC_K_2 (m, n, m, n, 4); \ - y = (y << 8) + (y >> 24); \ - x += y; y += x; ctx->a[j] = x; \ - ctx->a[(j) + 1] = (y << 9) + (y >> 23) - -#define CALC_K256_2(a, b, j) \ - CALC_K_2 (q0[q1[b ^ key[(j) + 24]] ^ key[(j) + 16]], \ - q1[q1[a ^ key[(j) + 25]] ^ key[(j) + 17]], \ - q0[q0[a ^ key[(j) + 26]] ^ key[(j) + 18]], \ - q1[q0[b ^ key[(j) + 27]] ^ key[(j) + 19]], j) - -#define CALC_K256(a, j, k, l, m, n) \ - x = CALC_K256_2 (k, l, 0); \ - y = CALC_K256_2 (m, n, 4); \ - y = (y << 8) + (y >> 24); \ - x += y; y += x; ctx->a[j] = x; \ - ctx->a[(j) + 1] = (y << 9) + (y >> 23) - - - -/* Perform the key setup. Note that this works only with 128- and 256-bit - * keys, despite the API that looks like it might support other sizes. */ - -int -do_twofish_setkey (TWOFISH_context *ctx, const byte *key, const unsigned keylen) -{ - int i, j, k; - - /* Temporaries for CALC_K. */ - u32 x, y; - - /* The S vector used to key the S-boxes, split up into individual bytes. - * 128-bit keys use only sa through sh; 256-bit use all of them. */ - byte sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0, sg = 0, sh = 0; - byte si = 0, sj = 0, sk = 0, sl = 0, sm = 0, sn = 0, so = 0, sp = 0; - - /* Temporary for CALC_S. */ - byte tmp; - - /* Flags for self-test. */ - static int initialized = 0; - static const char *selftest_failed=0; - - /* Check key length. */ - if( ( ( keylen - 16 ) | 16 ) != 16 ) - return -1; - - /* Do self-test if necessary. */ - if (!initialized) - { - initialized = 1; - selftest_failed = selftest (); - if( selftest_failed ) - log_error("%s\n", selftest_failed ); - } - if( selftest_failed ) - return -1; - - /* Compute the first two words of the S vector. The magic numbers are - * the entries of the RS matrix, preprocessed through poly_to_exp. The - * numbers in the comments are the original (polynomial form) matrix - * entries. */ - CALC_S (sa, sb, sc, sd, 0, 0x00, 0x2D, 0x01, 0x2D); /* 01 A4 02 A4 */ - CALC_S (sa, sb, sc, sd, 1, 0x2D, 0xA4, 0x44, 0x8A); /* A4 56 A1 55 */ - CALC_S (sa, sb, sc, sd, 2, 0x8A, 0xD5, 0xBF, 0xD1); /* 55 82 FC 87 */ - CALC_S (sa, sb, sc, sd, 3, 0xD1, 0x7F, 0x3D, 0x99); /* 87 F3 C1 5A */ - CALC_S (sa, sb, sc, sd, 4, 0x99, 0x46, 0x66, 0x96); /* 5A 1E 47 58 */ - CALC_S (sa, sb, sc, sd, 5, 0x96, 0x3C, 0x5B, 0xED); /* 58 C6 AE DB */ - CALC_S (sa, sb, sc, sd, 6, 0xED, 0x37, 0x4F, 0xE0); /* DB 68 3D 9E */ - CALC_S (sa, sb, sc, sd, 7, 0xE0, 0xD0, 0x8C, 0x17); /* 9E E5 19 03 */ - CALC_S (se, sf, sg, sh, 8, 0x00, 0x2D, 0x01, 0x2D); /* 01 A4 02 A4 */ - CALC_S (se, sf, sg, sh, 9, 0x2D, 0xA4, 0x44, 0x8A); /* A4 56 A1 55 */ - CALC_S (se, sf, sg, sh, 10, 0x8A, 0xD5, 0xBF, 0xD1); /* 55 82 FC 87 */ - CALC_S (se, sf, sg, sh, 11, 0xD1, 0x7F, 0x3D, 0x99); /* 87 F3 C1 5A */ - CALC_S (se, sf, sg, sh, 12, 0x99, 0x46, 0x66, 0x96); /* 5A 1E 47 58 */ - CALC_S (se, sf, sg, sh, 13, 0x96, 0x3C, 0x5B, 0xED); /* 58 C6 AE DB */ - CALC_S (se, sf, sg, sh, 14, 0xED, 0x37, 0x4F, 0xE0); /* DB 68 3D 9E */ - CALC_S (se, sf, sg, sh, 15, 0xE0, 0xD0, 0x8C, 0x17); /* 9E E5 19 03 */ - - if (keylen == 32) /* 256-bit key */ - { - /* Calculate the remaining two words of the S vector */ - CALC_S (si, sj, sk, sl, 16, 0x00, 0x2D, 0x01, 0x2D); /* 01 A4 02 A4 */ - CALC_S (si, sj, sk, sl, 17, 0x2D, 0xA4, 0x44, 0x8A); /* A4 56 A1 55 */ - CALC_S (si, sj, sk, sl, 18, 0x8A, 0xD5, 0xBF, 0xD1); /* 55 82 FC 87 */ - CALC_S (si, sj, sk, sl, 19, 0xD1, 0x7F, 0x3D, 0x99); /* 87 F3 C1 5A */ - CALC_S (si, sj, sk, sl, 20, 0x99, 0x46, 0x66, 0x96); /* 5A 1E 47 58 */ - CALC_S (si, sj, sk, sl, 21, 0x96, 0x3C, 0x5B, 0xED); /* 58 C6 AE DB */ - CALC_S (si, sj, sk, sl, 22, 0xED, 0x37, 0x4F, 0xE0); /* DB 68 3D 9E */ - CALC_S (si, sj, sk, sl, 23, 0xE0, 0xD0, 0x8C, 0x17); /* 9E E5 19 03 */ - CALC_S (sm, sn, so, sp, 24, 0x00, 0x2D, 0x01, 0x2D); /* 01 A4 02 A4 */ - CALC_S (sm, sn, so, sp, 25, 0x2D, 0xA4, 0x44, 0x8A); /* A4 56 A1 55 */ - CALC_S (sm, sn, so, sp, 26, 0x8A, 0xD5, 0xBF, 0xD1); /* 55 82 FC 87 */ - CALC_S (sm, sn, so, sp, 27, 0xD1, 0x7F, 0x3D, 0x99); /* 87 F3 C1 5A */ - CALC_S (sm, sn, so, sp, 28, 0x99, 0x46, 0x66, 0x96); /* 5A 1E 47 58 */ - CALC_S (sm, sn, so, sp, 29, 0x96, 0x3C, 0x5B, 0xED); /* 58 C6 AE DB */ - CALC_S (sm, sn, so, sp, 30, 0xED, 0x37, 0x4F, 0xE0); /* DB 68 3D 9E */ - CALC_S (sm, sn, so, sp, 31, 0xE0, 0xD0, 0x8C, 0x17); /* 9E E5 19 03 */ - - /* Compute the S-boxes. */ - for(i=j=0,k=1; i < 256; i++, j += 2, k += 2 ) - { - CALC_SB256_2( i, calc_sb_tbl[j], calc_sb_tbl[k] ); - } - - /* Calculate whitening and round subkeys. The constants are - * indices of subkeys, preprocessed through q0 and q1. */ - CALC_K256 (w, 0, 0xA9, 0x75, 0x67, 0xF3); - CALC_K256 (w, 2, 0xB3, 0xC6, 0xE8, 0xF4); - CALC_K256 (w, 4, 0x04, 0xDB, 0xFD, 0x7B); - CALC_K256 (w, 6, 0xA3, 0xFB, 0x76, 0xC8); - CALC_K256 (k, 0, 0x9A, 0x4A, 0x92, 0xD3); - CALC_K256 (k, 2, 0x80, 0xE6, 0x78, 0x6B); - CALC_K256 (k, 4, 0xE4, 0x45, 0xDD, 0x7D); - CALC_K256 (k, 6, 0xD1, 0xE8, 0x38, 0x4B); - CALC_K256 (k, 8, 0x0D, 0xD6, 0xC6, 0x32); - CALC_K256 (k, 10, 0x35, 0xD8, 0x98, 0xFD); - CALC_K256 (k, 12, 0x18, 0x37, 0xF7, 0x71); - CALC_K256 (k, 14, 0xEC, 0xF1, 0x6C, 0xE1); - CALC_K256 (k, 16, 0x43, 0x30, 0x75, 0x0F); - CALC_K256 (k, 18, 0x37, 0xF8, 0x26, 0x1B); - CALC_K256 (k, 20, 0xFA, 0x87, 0x13, 0xFA); - CALC_K256 (k, 22, 0x94, 0x06, 0x48, 0x3F); - CALC_K256 (k, 24, 0xF2, 0x5E, 0xD0, 0xBA); - CALC_K256 (k, 26, 0x8B, 0xAE, 0x30, 0x5B); - CALC_K256 (k, 28, 0x84, 0x8A, 0x54, 0x00); - CALC_K256 (k, 30, 0xDF, 0xBC, 0x23, 0x9D); - } - else - { - /* Compute the S-boxes. */ - for(i=j=0,k=1; i < 256; i++, j += 2, k += 2 ) - { - CALC_SB_2( i, calc_sb_tbl[j], calc_sb_tbl[k] ); - } - - /* Calculate whitening and round subkeys. The constants are - * indices of subkeys, preprocessed through q0 and q1. */ - CALC_K (w, 0, 0xA9, 0x75, 0x67, 0xF3); - CALC_K (w, 2, 0xB3, 0xC6, 0xE8, 0xF4); - CALC_K (w, 4, 0x04, 0xDB, 0xFD, 0x7B); - CALC_K (w, 6, 0xA3, 0xFB, 0x76, 0xC8); - CALC_K (k, 0, 0x9A, 0x4A, 0x92, 0xD3); - CALC_K (k, 2, 0x80, 0xE6, 0x78, 0x6B); - CALC_K (k, 4, 0xE4, 0x45, 0xDD, 0x7D); - CALC_K (k, 6, 0xD1, 0xE8, 0x38, 0x4B); - CALC_K (k, 8, 0x0D, 0xD6, 0xC6, 0x32); - CALC_K (k, 10, 0x35, 0xD8, 0x98, 0xFD); - CALC_K (k, 12, 0x18, 0x37, 0xF7, 0x71); - CALC_K (k, 14, 0xEC, 0xF1, 0x6C, 0xE1); - CALC_K (k, 16, 0x43, 0x30, 0x75, 0x0F); - CALC_K (k, 18, 0x37, 0xF8, 0x26, 0x1B); - CALC_K (k, 20, 0xFA, 0x87, 0x13, 0xFA); - CALC_K (k, 22, 0x94, 0x06, 0x48, 0x3F); - CALC_K (k, 24, 0xF2, 0x5E, 0xD0, 0xBA); - CALC_K (k, 26, 0x8B, 0xAE, 0x30, 0x5B); - CALC_K (k, 28, 0x84, 0x8A, 0x54, 0x00); - CALC_K (k, 30, 0xDF, 0xBC, 0x23, 0x9D); - } - - return 0; -} diff --git a/ir/be/test/fak.c b/ir/be/test/fak.c deleted file mode 100644 index fb6a9e16e..000000000 --- a/ir/be/test/fak.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int factorial(int x) { - if (x == 0) - return 1; - - return x * factorial(x-1); -} - -int main(int argc, char **argv) { - int val = 7; - if(argc>1) - val = atoi(argv[1]); - printf("%d\n", factorial(val)); -} diff --git a/ir/be/test/fastcall.c b/ir/be/test/fastcall.c deleted file mode 100644 index 1a5d9f87b..000000000 --- a/ir/be/test/fastcall.c +++ /dev/null @@ -1,9 +0,0 @@ -/*$ -fno-inline $*/ - -int __attribute__((fastcall)) test(int a, int b, int c) { - return a+b - c; -} - -int main() { - return test(4, -4, 0); -} diff --git a/ir/be/test/fbench.c b/ir/be/test/fbench.c deleted file mode 100644 index 04463857e..000000000 --- a/ir/be/test/fbench.c +++ /dev/null @@ -1,847 +0,0 @@ -/* - - John Walker's Floating Point Benchmark, derived from... - - Marinchip Interactive Lens Design System - - John Walker December 1980 - - By John Walker - http://www.fourmilab.ch/ - - This program may be used, distributed, and modified freely as - long as the origin information is preserved. - - This is a complete optical design raytracing algorithm, - stripped of its user interface and recast into portable C. It - not only determines execution speed on an extremely floating - point (including trig function) intensive real-world - application, it checks accuracy on an algorithm that is - exquisitely sensitive to errors. The performance of this - program is typically far more sensitive to changes in the - efficiency of the trigonometric library routines than the - average floating point program. - - The benchmark may be compiled in two modes. If the symbol - INTRIG is defined, built-in trigonometric and square root - routines will be used for all calculations. Timings made with - INTRIG defined reflect the machine's basic floating point - performance for the arithmetic operators. If INTRIG is not - defined, the system library functions are used. - Results with INTRIG not defined reflect the system's library - performance and/or floating point hardware support for trig - functions and square root. Results with INTRIG defined are a - good guide to general floating point performance, while - results with INTRIG undefined indicate the performance of an - application which is math function intensive. - - Special note regarding errors in accuracy: this program has - generated numbers identical to the last digit it formats and - checks on the following machines, floating point - architectures, and languages: - - Marinchip 9900 QBASIC IBM 370 double-precision (REAL * 8) format - - IBM PC / XT / AT Lattice C IEEE 64 bit, 80 bit temporaries - High C same, in line 80x87 code - BASICA "Double precision" - Quick BASIC IEEE double precision, software routines - - Sun 3 C IEEE 64 bit, 80 bit temporaries, - in-line 68881 code, in-line FPA code. - - MicroVAX II C Vax "G" format floating point - - Macintosh Plus MPW C SANE floating point, IEEE 64 bit format - implemented in ROM. - - Inaccuracies reported by this program should be taken VERY - SERIOUSLY INDEED, as the program has been demonstrated to be - invariant under changes in floating point format, as long as - the format is a recognised double precision format. If you - encounter errors, please remember that they are just as likely - to be in the floating point editing library or the - trigonometric libraries as in the low level operator code. - - The benchmark assumes that results are basically reliable, and - only tests the last result computed against the reference. If - you're running on a suspect system you can compile this - program with ACCURACY defined. This will generate a version - which executes as an infinite loop, performing the ray trace - and checking the results on every pass. All incorrect results - will be reported. - - Representative timings are given below. All have been - normalised as if run for 1000 iterations. - - Time in seconds Computer, Compiler, and notes - Normal INTRIG - - 3466.00 4031.00 Commodore 128, 2 Mhz 8510 with software floating - point. Abacus Software/Data-Becker Super-C 128, - version 3.00, run in fast (2 Mhz) mode. Note: - the results generated by this system differed - from the reference results in the 8th to 10th - decimal place. - - 3290.00 IBM PC/AT 6 Mhz, Microsoft/IBM BASICA version A3.00. - Run with the "/d" switch, software floating point. - - 2131.50 IBM PC/AT 6 Mhz, Lattice C version 2.14, small model. - This version of Lattice compiles subroutine - calls which either do software floating point - or use the 80x87. The machine on which I ran - this had an 80287, but the results were so bad - I wonder if it was being used. - - 1598.00 Macintosh Plus, MPW C, SANE Software floating point. - - 1582.13 Marinchip 9900 2 Mhz, QBASIC compiler with software - floating point. This was a QBASIC version of the - program which contained the identical algorithm. - - 404.00 IBM PC/AT 6 Mhz, Microsoft QuickBASIC version 2.0. - Software floating point. - - 165.15 IBM PC/AT 6 Mhz, Metaware High C version 1.3, small - model. This was compiled to call subroutines for - floating point, and the machine contained an 80287 - which was used by the subroutines. - - 143.20 Macintosh II, MPW C, SANE calls. I was unable to - determine whether SANE was using the 68881 chip or - not. - - 121.80 Sun 3/160 16 Mhz, Sun C. Compiled with -fsoft switch - which executes floating point in software. - - 78.78 110.11 IBM RT PC (Model 6150). IBM AIX 1.0 C compiler - with -O switch. - - 75.2 254.0 Microsoft Quick C 1.0, in-line 8087 instructions, - compiled with 80286 optimisation on. (Switches - were -Ol -FPi87-G2 -AS). Small memory model. - - 69.50 IBM PC/AT 6Mhz, Borland Turbo BASIC 1.0. Compiled - in "8087 required" mode to generate in-line - code for the math coprocessor. - - 66.96 IBM PC/AT 6Mhz, Microsoft QuickBASIC 4.0. This - release of QuickBASIC compiles code for the - 80287 math coprocessor. - - 66.36 206.35 IBM PC/AT 6Mhz, Metaware High C version 1.3, small - model. This was compiled with in-line code for the - 80287 math coprocessor. Trig functions still call - library routines. - - 63.07 220.43 IBM PC/AT, 6Mhz, Borland Turbo C, in-line 8087 code, - small model, word alignment, no stack checking, - 8086 code mode. - - 17.18 Apollo DN-3000, 12 Mhz 68020 with 68881, compiled - with in-line code for the 68881 coprocessor. - According to Apollo, the library routines are chosen - at runtime based on coprocessor presence. Since the - coprocessor was present, the library is supposed to - use in-line floating point code. - - 15.55 27.56 VAXstation II GPX. Compiled and executed under - VAX/VMS C. - - 15.14 37.93 Macintosh II, Unix system V. Green Hills 68020 - Unix compiler with in-line code for the 68881 - coprocessor (-O -ZI switches). - - 12.69 Sun 3/160 16 Mhz, Sun C. Compiled with -fswitch, - which calls a subroutine to select the fastest - floating point processor. This was using the 68881. - - 11.74 26.73 Compaq Deskpro 386, 16 Mhz 80386 with 16 Mhz 80387. - Metaware High C version 1.3, compiled with in-line - for the math coprocessor (but not optimised for the - 80386/80387). Trig functions still call library - routines. - - 8.43 30.49 Sun 3/160 16 Mhz, Sun C. Compiled with -f68881, - generating in-line MC68881 instructions. Trig - functions still call library routines. - - 6.29 25.17 Sun 3/260 25 Mhz, Sun C. Compiled with -f68881, - generating in-line MC68881 instructions. Trig - functions still call library routines. - - 4.57 Sun 3/260 25 Mhz, Sun FORTRAN 77. Compiled with - -O -f68881, generating in-line MC68881 instructions. - Trig functions are compiled in-line. This used - the FORTRAN 77 version of the program, FBFORT77.F. - - 4.00 14.20 Sun386i/25 Mhz model 250, Sun C compiler. - - 4.00 14.00 Sun386i/25 Mhz model 250, Metaware C. - - 3.10 12.00 Compaq 386/387 25 Mhz running SCO Xenix 2. - Compiled with Metaware HighC 386, optimized - for 386. - - 3.00 12.00 Compaq 386/387 25MHZ optimized for 386/387. - - 2.96 5.17 Sun 4/260, Sparc RISC processor. Sun C, - compiled with the -O2 switch for global - optimisation. - - 2.47 COMPAQ 486/25, secondary cache disabled, High C, - 486/387, inline f.p., small memory model. - - 2.20 3.40 Data General Motorola 88000, 16 Mhz, Gnu C. - - 1.56 COMPAQ 486/25, 128K secondary cache, High C, 486/387, - inline f.p., small memory model. - - 0.66 1.50 DEC Pmax, Mips processor. - - 0.63 0.91 Sun SparcStation 2, Sun C (SunOS 4.1.1) with - -O4 optimisation and "/usr/lib/libm.il" inline - floating point. - - 0.60 1.07 Intel 860 RISC processor, 33 Mhz, Greenhills - C compiler. - - 0.40 0.90 Dec 3MAX, MIPS 3000 processor, -O4. - - 0.31 0.90 IBM RS/6000, -O. - - 0.1129 0.2119 Dell Dimension XPS P133c, Pentium 133 MHz, - Windows 95, Microsoft Visual C 5.0. - - 0.0883 0.2166 Silicon Graphics Indigo², MIPS R4400, - 175 Mhz, "-O3". - - 0.0351 0.0561 Dell Dimension XPS R100, Pentium II 400 MHz, - Windows 98, Microsoft Visual C 5.0. - - 0.0312 0.0542 Sun Ultra 2, UltraSPARC V9, 300 MHz, Solaris - 2.5.1. - - 0.00862 0.01074 Dell Inspiron 9100, Pentium 4, 3.4 GHz, gcc -O3. - -*/ - -#include -#include -#include -#ifndef INTRIG -#include -#endif - -#define cot(x) (1.0 / tan(x)) - -#undef ACCURACY - -#define TRUE 1 -#define FALSE 0 - -#define max_surfaces 10 - -/* Local variables */ - -static char tbfr[132]; - -static short current_surfaces; -static short paraxial; - -static double clear_aperture; - -static double aberr_lspher; -static double aberr_osc; -static double aberr_lchrom; - -static double max_lspher; -static double max_osc; -static double max_lchrom; - -static double radius_of_curvature; -static double object_distance; -static double ray_height; -static double axis_slope_angle; -static double from_index; -static double to_index; - -static double spectral_line[9]; -static double s[max_surfaces][5]; -static double od_sa[2][2]; - -static char outarr[8][80]; /* Computed output of program goes here */ - -int itercount; /* The iteration counter for the main loop - in the program is made global so that - the compiler should not be allowed to - optimise out the loop over the ray - tracing code. */ - -#ifndef ITERATIONS -#define ITERATIONS 1000 -#endif -int niter = ITERATIONS; /* Iteration counter */ - -static char *refarr[] = { /* Reference results. These happen to - be derived from a run on Microsoft - Quick BASIC on the IBM PC/AT. */ - - " Marginal ray 47.09479120920 0.04178472683", - " Paraxial ray 47.08372160249 0.04177864821", - "Longitudinal spherical aberration: -0.01106960671", - " (Maximum permissible): 0.05306749907", - "Offense against sine condition (coma): 0.00008954761", - " (Maximum permissible): 0.00250000000", - "Axial chromatic aberration: 0.00448229032", - " (Maximum permissible): 0.05306749907" -}; - -/* The test case used in this program is the design for a 4 inch - achromatic telescope objective used as the example in Wyld's - classic work on ray tracing by hand, given in Amateur Telescope - Making, Volume 3. */ - -static double testcase[4][4] = { - {27.05, 1.5137, 63.6, 0.52}, - {-16.68, 1, 0, 0.138}, - {-16.68, 1.6164, 36.7, 0.38}, - {-78.1, 1, 0, 0} -}; - -/* Internal trig functions (used only if INTRIG is defined). These - standard functions may be enabled to obtain timings that reflect - the machine's floating point performance rather than the speed of - its trig function evaluation. */ - -#ifdef INTRIG - -/* The following definitions should keep you from getting intro trouble - with compilers which don't let you redefine intrinsic functions. */ - -#define sin I_sin -#define cos I_cos -#define tan I_tan -#define sqrt I_sqrt -#define atan I_atan -#define atan2 I_atan2 -#define asin I_asin - -#define fabs(x) ((x < 0.0) ? -x : x) - -#define pic 3.1415926535897932 - -/* Commonly used constants */ - -static double pi = pic, - twopi =pic * 2.0, - piover4 = pic / 4.0, - fouroverpi = 4.0 / pic, - piover2 = pic / 2.0; - -/* Coefficients for ATAN evaluation */ - -static double atanc[] = { - 0.0, - 0.4636476090008061165, - 0.7853981633974483094, - 0.98279372324732906714, - 1.1071487177940905022, - 1.1902899496825317322, - 1.2490457723982544262, - 1.2924966677897852673, - 1.3258176636680324644 -}; - -/* aint(x) Return integer part of number. Truncates towards 0 */ - -double aint(x) -double x; -{ - long l; - - /* Note that this routine cannot handle the full floating point - number range. This function should be in the machine-dependent - floating point library! */ - - l = x; - if ((int)(-0.5) != 0 && l < 0 ) - l++; - x = l; - return x; -} - -/* sin(x) Return sine, x in radians */ - -static double sin(x) -double x; -{ - int sign; - double y, r, z; - - x = (((sign= (x < 0.0)) != 0) ? -x: x); - - if (x > twopi) - x -= (aint(x / twopi) * twopi); - - if (x > pi) { - x -= pi; - sign = !sign; - } - - if (x > piover2) - x = pi - x; - - if (x < piover4) { - y = x * fouroverpi; - z = y * y; - r = y * (((((((-0.202253129293E-13 * z + 0.69481520350522E-11) * z - - 0.17572474176170806E-8) * z + 0.313361688917325348E-6) * z - - 0.365762041821464001E-4) * z + 0.249039457019271628E-2) * z - - 0.0807455121882807815) * z + 0.785398163397448310); - } else { - y = (piover2 - x) * fouroverpi; - z = y * y; - r = ((((((-0.38577620372E-12 * z + 0.11500497024263E-9) * z - - 0.2461136382637005E-7) * z + 0.359086044588581953E-5) * z - - 0.325991886926687550E-3) * z + 0.0158543442438154109) * z - - 0.308425137534042452) * z + 1.0; - } - return sign ? -r : r; -} - -/* cos(x) Return cosine, x in radians, by identity */ - -static double cos(x) -double x; -{ - x = (x < 0.0) ? -x : x; - if (x > twopi) /* Do range reduction here to limit */ - x = x - (aint(x / twopi) * twopi); /* roundoff on add of PI/2 */ - return sin(x + piover2); -} - -/* tan(x) Return tangent, x in radians, by identity */ - -static double tan(x) -double x; -{ - return sin(x) / cos(x); -} - -/* sqrt(x) Return square root. Initial guess, then Newton- - Raphson refinement */ - -double sqrt(x) -double x; -{ - double c, cl, y; - int n; - - if (x == 0.0) - return 0.0; - - if (x < 0.0) { - fprintf(stderr, - "\nGood work! You tried to take the square root of %g", - x); - fprintf(stderr, - "\nunfortunately, that is too complex for me to handle.\n"); - exit(1); - } - - y = (0.154116 + 1.893872 * x) / (1.0 + 1.047988 * x); - - c = (y - x / y) / 2.0; - cl = 0.0; - for (n = 50; c != cl && n--;) { - y = y - c; - cl = c; - c = (y - x / y) / 2.0; - } - return y; -} - -/* atan(x) Return arctangent in radians, - range -pi/2 to pi/2 */ - -static double atan(x) -double x; -{ - int sign, l, y; - double a, b, z; - - x = (((sign = (x < 0.0)) != 0) ? -x : x); - l = 0; - - if (x >= 4.0) { - l = -1; - x = 1.0 / x; - y = 0; - goto atl; - } else { - if (x < 0.25) { - y = 0; - goto atl; - } - } - - y = aint(x / 0.5); - z = y * 0.5; - x = (x - z) / (x * z + 1); - -atl: - z = x * x; - b = ((((893025.0 * z + 49116375.0) * z + 425675250.0) * z + - 1277025750.0) * z + 1550674125.0) * z + 654729075.0; - a = (((13852575.0 * z + 216602100.0) * z + 891080190.0) * z + - 1332431100.0) * z + 654729075.0; - a = (a / b) * x + atanc[y]; - if (l) - a=piover2 - a; - return sign ? -a : a; -} - -/* atan2(y,x) Return arctangent in radians of y/x, - range -pi to pi */ - -static double atan2(y, x) -double y, x; -{ - double temp; - - if (x == 0.0) { - if (y == 0.0) /* Special case: atan2(0,0) = 0 */ - return 0.0; - else if (y > 0) - return piover2; - else - return -piover2; - } - temp = atan(y / x); - if (x < 0.0) { - if (y >= 0.0) - temp += pic; - else - temp -= pic; - } - return temp; -} - -/* asin(x) Return arcsine in radians of x */ - -static double asin(x) -double x; -{ - if (fabs(x)>1.0) { - fprintf(stderr, - "\nInverse trig functions lose much of their gloss when"); - fprintf(stderr, - "\ntheir arguments are greater than 1, such as the"); - fprintf(stderr, - "\nvalue %g you passed.\n", x); - exit(1); - } - return atan2(x, sqrt(1 - x * x)); -} -#endif - -/* Calculate passage through surface - - If the variable PARAXIAL is true, the trace through the - surface will be done using the paraxial approximations. - Otherwise, the normal trigonometric trace will be done. - - This routine takes the following inputs: - - RADIUS_OF_CURVATURE Radius of curvature of surface - being crossed. If 0, surface is - plane. - - OBJECT_DISTANCE Distance of object focus from - lens vertex. If 0, incoming - rays are parallel and - the following must be specified: - - RAY_HEIGHT Height of ray from axis. Only - relevant if OBJECT.DISTANCE == 0 - - AXIS_SLOPE_ANGLE Angle incoming ray makes with axis - at intercept - - FROM_INDEX Refractive index of medium being left - - TO_INDEX Refractive index of medium being - entered. - - The outputs are the following variables: - - OBJECT_DISTANCE Distance from vertex to object focus - after refraction. - - AXIS_SLOPE_ANGLE Angle incoming ray makes with axis - at intercept after refraction. - -*/ - -static void transit_surface() { - double iang, /* Incidence angle */ - rang, /* Refraction angle */ - iang_sin, /* Incidence angle sin */ - rang_sin, /* Refraction angle sin */ - old_axis_slope_angle, sagitta; - - if (paraxial) { - if (radius_of_curvature != 0.0) { - if (object_distance == 0.0) { - axis_slope_angle = 0.0; - iang_sin = ray_height / radius_of_curvature; - } else - iang_sin = ((object_distance - - radius_of_curvature) / radius_of_curvature) * - axis_slope_angle; - - rang_sin = (from_index / to_index) * - iang_sin; - old_axis_slope_angle = axis_slope_angle; - axis_slope_angle = axis_slope_angle + - iang_sin - rang_sin; - if (object_distance != 0.0) - ray_height = object_distance * old_axis_slope_angle; - object_distance = ray_height / axis_slope_angle; - return; - } - object_distance = object_distance * (to_index / from_index); - axis_slope_angle = axis_slope_angle * (from_index / to_index); - return; - } - - if (radius_of_curvature != 0.0) { - if (object_distance == 0.0) { - axis_slope_angle = 0.0; - iang_sin = ray_height / radius_of_curvature; - } else { - iang_sin = ((object_distance - - radius_of_curvature) / radius_of_curvature) * - sin(axis_slope_angle); - } - iang = asin(iang_sin); - rang_sin = (from_index / to_index) * - iang_sin; - old_axis_slope_angle = axis_slope_angle; - axis_slope_angle = axis_slope_angle + - iang - asin(rang_sin); - sagitta = sin((old_axis_slope_angle + iang) / 2.0); - sagitta = 2.0 * radius_of_curvature*sagitta*sagitta; - object_distance = ((radius_of_curvature * sin( - old_axis_slope_angle + iang)) * - cot(axis_slope_angle)) + sagitta; - return; - } - - rang = -asin((from_index / to_index) * - sin(axis_slope_angle)); - object_distance = object_distance * ((to_index * - cos(-rang)) / (from_index * - cos(axis_slope_angle))); - axis_slope_angle = -rang; -} - -/* Perform ray trace in specific spectral line */ - -static void trace_line(line, ray_h) -int line; -double ray_h; -{ - int i; - - object_distance = 0.0; - ray_height = ray_h; - from_index = 1.0; - - for (i = 1; i <= current_surfaces; i++) { - radius_of_curvature = s[i][1]; - to_index = s[i][2]; - if (to_index > 1.0) - to_index = to_index + ((spectral_line[4] - - spectral_line[line]) / - (spectral_line[3] - spectral_line[6])) * ((s[i][2] - 1.0) / - s[i][3]); - transit_surface(); - from_index = to_index; - if (i < current_surfaces) - object_distance = object_distance - s[i][4]; - } -} - -/* Initialise when called the first time */ - -int main(argc, argv) -int argc; -char *argv[]; -{ - int i, j, k, errors; - double od_fline, od_cline; -#ifdef ACCURACY - long passes; -#endif - - spectral_line[1] = 7621.0; /* A */ - spectral_line[2] = 6869.955; /* B */ - spectral_line[3] = 6562.816; /* C */ - spectral_line[4] = 5895.944; /* D */ - spectral_line[5] = 5269.557; /* E */ - spectral_line[6] = 4861.344; /* F */ - spectral_line[7] = 4340.477; /* G'*/ - spectral_line[8] = 3968.494; /* H */ - - /* Process the number of iterations argument, if one is supplied. */ - - if (argc > 1) { - niter = atoi(argv[1]); - if (*argv[1] == '-' || niter < 1) { - printf("This is John Walker's floating point accuracy and\n"); - printf("performance benchmark program. You call it with\n"); - printf("\nfbench \n\n"); - printf("where is the number of iterations\n"); - printf("to be executed. Archival timings should be made\n"); - printf("with the iteration count set so that roughly five\n"); - printf("minutes of execution is timed.\n"); - exit(0); - } - } - - /* Load test case into working array */ - - clear_aperture = 4.0; - current_surfaces = 4; - for (i = 0; i < current_surfaces; i++) - for (j = 0; j < 4; j++) - s[i + 1][j + 1] = testcase[i][j]; - -#ifdef ACCURACY - printf("Beginning execution of floating point accuracy test...\n"); - passes = 0; -#else - printf("Ready to begin John Walker's floating point accuracy\n"); - printf("and performance benchmark. %d iterations will be made.\n\n", - niter); - - printf("\nMeasured run time in seconds should be divided by %.f\n", niter / 1000.0); - printf("to normalise for reporting results. For archival results,\n"); - printf("adjust iteration count so the benchmark runs about five minutes.\n\n"); - -#endif - - /* Perform ray trace the specified number of times. */ - -#ifdef ACCURACY - while (TRUE) { - passes++; - if ((passes % 100L) == 0) { - printf("Pass %ld.\n", passes); - } -#else - for (itercount = 0; itercount < niter; itercount++) { -#endif - - for (paraxial = 0; paraxial <= 1; paraxial++) { - - /* Do main trace in D light */ - - trace_line(4, clear_aperture / 2.0); - od_sa[paraxial][0] = object_distance; - od_sa[paraxial][1] = axis_slope_angle; - } - paraxial = FALSE; - - /* Trace marginal ray in C */ - - trace_line(3, clear_aperture / 2.0); - od_cline = object_distance; - - /* Trace marginal ray in F */ - - trace_line(6, clear_aperture / 2.0); - od_fline = object_distance; - - aberr_lspher = od_sa[1][0] - od_sa[0][0]; - aberr_osc = 1.0 - (od_sa[1][0] * od_sa[1][1]) / - (sin(od_sa[0][1]) * od_sa[0][0]); - aberr_lchrom = od_fline - od_cline; - max_lspher = sin(od_sa[0][1]); - - /* D light */ - - max_lspher = 0.0000926 / (max_lspher * max_lspher); - max_osc = 0.0025; - max_lchrom = max_lspher; -#ifndef ACCURACY - } - - printf("Stop the timer:\007"); - //gets(tbfr); -#endif - - /* Now evaluate the accuracy of the results from the last ray trace */ - - sprintf(outarr[0], "%15s %21.11f %14.11f", - "Marginal ray", od_sa[0][0], od_sa[0][1]); - sprintf(outarr[1], "%15s %21.11f %14.11f", - "Paraxial ray", od_sa[1][0], od_sa[1][1]); - sprintf(outarr[2], - "Longitudinal spherical aberration: %16.11f", - aberr_lspher); - sprintf(outarr[3], - " (Maximum permissible): %16.11f", - max_lspher); - sprintf(outarr[4], - "Offense against sine condition (coma): %16.11f", - aberr_osc); - sprintf(outarr[5], - " (Maximum permissible): %16.11f", - max_osc); - sprintf(outarr[6], - "Axial chromatic aberration: %16.11f", - aberr_lchrom); - sprintf(outarr[7], - " (Maximum permissible): %16.11f", - max_lchrom); - - /* Now compare the edited results with the master values from - reference executions of this program. */ - - errors = 0; - for (i = 0; i < 8; i++) { - if (strcmp(outarr[i], refarr[i]) != 0) { -#ifdef ACCURACY - printf("\nError in pass %ld for results on line %d...\n", - passes, i + 1); -#else - printf("\nError in results on line %d...\n", i + 1); -#endif - printf("Expected: \"%s\"\n", refarr[i]); - printf("Received: \"%s\"\n", outarr[i]); - printf("(Errors) "); - k = strlen(refarr[i]); - for (j = 0; j < k; j++) { - printf("%c", refarr[i][j] == outarr[i][j] ? ' ' : '^'); - if (refarr[i][j] != outarr[i][j]) - errors++; - } - printf("\n"); - } - } -#ifdef ACCURACY - } -#else - if (errors > 0) { - printf("\n%d error%s in results. This is VERY SERIOUS.\n", - errors, errors > 1 ? "s" : ""); - } else - printf("\nNo errors in results.\n"); -#endif - - return 0; -} diff --git a/ir/be/test/fcall.c b/ir/be/test/fcall.c deleted file mode 100644 index 16576734e..000000000 --- a/ir/be/test/fcall.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -float a; - -int main() -{ - /* tests for problems in x87 simulator when results of a call are not - * used */ - float b = a; - sqrt(a); - printf("%f\n", b); - return 0; -} diff --git a/ir/be/test/fe_bug.c b/ir/be/test/fe_bug.c deleted file mode 100644 index 1b7582698..000000000 --- a/ir/be/test/fe_bug.c +++ /dev/null @@ -1,17 +0,0 @@ -int a_number() -{ - return 7; -} - -void a_m_serial() -{ - int n, a_number(); - n= a_number(); -} - -int main() -{ - a_m_serial(); - printf("Result: %d\n", a_number()); - return 0; -} diff --git a/ir/be/test/fehler001.c b/ir/be/test/fehler001.c deleted file mode 100644 index c11179217..000000000 --- a/ir/be/test/fehler001.c +++ /dev/null @@ -1,13 +0,0 @@ -int f(void) -{ -label: - printf("bla\n"); - goto label; - - return 0; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler002.c b/ir/be/test/fehler002.c deleted file mode 100644 index 4003d97cb..000000000 --- a/ir/be/test/fehler002.c +++ /dev/null @@ -1,25 +0,0 @@ -/*$ -fno-inline $*/ -/* codeselector produces invalid AM for cmov */ - -#include - -int k = 20; - -int func(void) -{ - k = 42; - return 1; -} - -int main(int argc, char **argv) -{ - int val = k; - int res; - if(func()) { - res = val; - } else { - res = 20; - } - printf("Res: %d (should be 20)\n", res); - return 0; -} diff --git a/ir/be/test/fehler003.c b/ir/be/test/fehler003.c deleted file mode 100644 index 26aa438d4..000000000 --- a/ir/be/test/fehler003.c +++ /dev/null @@ -1,19 +0,0 @@ - - -int main(void) { - - - int i = 100; - int j = 99; - - int **zeiger; - int *p[2]; - - p[0] = &i; - p[1] = &j; - zeiger = &p[0]; - - printf("%d %d \n",**zeiger, **(zeiger+1)); - - return 0; -} diff --git a/ir/be/test/fehler004.c b/ir/be/test/fehler004.c deleted file mode 100644 index 91f9a340c..000000000 --- a/ir/be/test/fehler004.c +++ /dev/null @@ -1,12 +0,0 @@ - - -int main(void) { - - int zahl = 100; - float f = 3.14; - - zahl = (int)f; - printf("%d \n", zahl ); - - return 0; -} diff --git a/ir/be/test/fehler005.c b/ir/be/test/fehler005.c deleted file mode 100644 index 4f1b7ba87..000000000 --- a/ir/be/test/fehler005.c +++ /dev/null @@ -1,9 +0,0 @@ - -int main(void) -{ - int g = 0; - int h = !g; - printf("%d %d\n", g, h); - - return 0; -} diff --git a/ir/be/test/fehler006.c b/ir/be/test/fehler006.c deleted file mode 100644 index a3e6312ab..000000000 --- a/ir/be/test/fehler006.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int main() -{ - int i, n=3 , v, dig, set; - - //printf ("Enter n: "); - //scanf ("%d", &n); - - v = 1 << n; - - for (i=0; i < v; i++) { - set = i ^ (i>>1); - - printf(" i: %d set: %d \n",i,set); - for (dig=1 << (n-1); dig; dig >>= 1) - { - printf("\ni: %d v: %d dig: %d set:%d\n",i,v,dig, set); - printf (" %d", ((set & dig) ? 1 : 0)); - printf("\ni: %d v: %d dig: %d set:%d\n",i,v,dig, set); - } - printf ("\n"); - } - - return 0; -} diff --git a/ir/be/test/fehler007.c b/ir/be/test/fehler007.c deleted file mode 100644 index 868e9916a..000000000 --- a/ir/be/test/fehler007.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() /* prints all subsets of bit vector v in numerical order */ -{ - int u=0, v = 5; - - //printf( "Enter bit vector v: "); - //scanf( "%d", &v ); - - do - printf("%d\n",u); - while(u=(u-v)&v); - - return 0; -} diff --git a/ir/be/test/fehler008.c b/ir/be/test/fehler008.c deleted file mode 100644 index 24e6ac760..000000000 --- a/ir/be/test/fehler008.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main(void) { - - float a; - float c; - - for (a=0; a<7; a++) { - c = a; - } - - printf("%f %f\n", a, c); - - return 0; -} diff --git a/ir/be/test/fehler009.c b/ir/be/test/fehler009.c deleted file mode 100644 index dee08afe7..000000000 --- a/ir/be/test/fehler009.c +++ /dev/null @@ -1,25 +0,0 @@ -struct x { - int a; - int b; -} ; - -typedef struct x X; - -X test(void); - - -int main(void) { - - X y; - y = test(); - printf("%d %d\n", y.a, y.b); - - return 0; -} - -X test(void) { - X a; - a.a = 2; - a.b = 3; - return(a); -} diff --git a/ir/be/test/fehler010.c b/ir/be/test/fehler010.c deleted file mode 100644 index fc39453f7..000000000 --- a/ir/be/test/fehler010.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -void a(void); -void b(void); - -int main(void) { - a(); - printf("\n"); - return 0; -} - -void a(void) { - goto a; - -a: - printf("x"); - b(); - return; - -b: - printf("y"); - b(); - return; -} - -void b(void) { - goto b; - -a: - printf("k"); - return; - -b: - printf("l"); - return; -} diff --git a/ir/be/test/fehler011.c b/ir/be/test/fehler011.c deleted file mode 100644 index ab7b91d40..000000000 --- a/ir/be/test/fehler011.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main(void) { - - long long a = 0x0123456789012345; - int b = 23; - int c; - - c = a % b; - - printf("%d\n", c); - - return 0; -} diff --git a/ir/be/test/fehler012.c b/ir/be/test/fehler012.c deleted file mode 100644 index ce29df78a..000000000 --- a/ir/be/test/fehler012.c +++ /dev/null @@ -1,16 +0,0 @@ -void xyz (void); - -int t = -1; - -int main(void) { - printf("%d\n", t); - xyz(); - printf("%d\n", t); - - return 0; -} - - -void xyz (void) { - t++; -} diff --git a/ir/be/test/fehler013.c b/ir/be/test/fehler013.c deleted file mode 100644 index f27d0cd2f..000000000 --- a/ir/be/test/fehler013.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int main() -{ - const char *s = "no compiler is perfect"; - const char *t = s; - char c = *t; - - for( ; !((c == ' ') && (c != '\"')); t++) { - c = *t; - } - - printf("Res: %s\n", t); - - return 0; -} diff --git a/ir/be/test/fehler014.c b/ir/be/test/fehler014.c deleted file mode 100644 index 97be59b75..000000000 --- a/ir/be/test/fehler014.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -unsigned int c = 0xffffffff; -unsigned short b; - -int main() -{ - b = c; - printf("%x\n", b); - return 0; -} diff --git a/ir/be/test/fehler015.c b/ir/be/test/fehler015.c deleted file mode 100644 index c0237ec3e..000000000 --- a/ir/be/test/fehler015.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int i = 0; -int *p1 = &i; - -int main() -{ - *p1 = 1066; - if(p1 != &i) - abort(); - - return 0; -} diff --git a/ir/be/test/fehler016.c b/ir/be/test/fehler016.c deleted file mode 100644 index 4b8a64dea..000000000 --- a/ir/be/test/fehler016.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -static char string[2048] = ""; -static char string2[2048] = "It's indeed okay"; - -int main() -{ - sprintf(string, "This is a very long sentence to test, whether the compiler crashs because of obscure bugs... If you can read it all until the exclamation mark, then your compiler is probably okay!"); - - puts(string); - puts(string2); - return 0; -} diff --git a/ir/be/test/fehler017.c b/ir/be/test/fehler017.c deleted file mode 100644 index 770477754..000000000 --- a/ir/be/test/fehler017.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -char *p = "\xFF"; - -int main() { - printf("Result: %d (should be 255)\n", (unsigned char) (*p++)); - return 0; -} diff --git a/ir/be/test/fehler018.c b/ir/be/test/fehler018.c deleted file mode 100644 index 3ee23665b..000000000 --- a/ir/be/test/fehler018.c +++ /dev/null @@ -1,27 +0,0 @@ -#define MIN_MATCH 3 -#define HASH_BITS 15 -#define HASH_SIZE (unsigned)(1< - -#ifdef __GNUC__ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE __declspec(noinline) -#endif - -static NO_INLINE void func(float a, float b, float *c, float *d); - -static void func(float a, float b, float *c, float *d) { - *c = a; - *d = b; -} - -int main(int argc, char *argv[]) { - float a, b; - - func(3.0f, 4.0f, &a, &b); - - printf("a = %f (should be 3.0)\n", a); - printf("b = %f (should be 4.0)\n", b); - - return 0; -} diff --git a/ir/be/test/fehler020.c b/ir/be/test/fehler020.c deleted file mode 100644 index b79a46329..000000000 --- a/ir/be/test/fehler020.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -int end = 4; -float k[] = { 2.8, 2.8, 2.8, 2.8, 2.8 }; - -void print_fpcw() -{ -#ifdef __i386__ - int val = 0; - __asm__ ( - "subl $4, %%esp\n" - "fnstcw (%%esp)\n" - "movzwl (%%esp), %0\n" - "addl $4, %%esp\n" : "=r"(val)); - - printf("%x\n", val); -#else - printf("%d\n", (int) k[0]); -#endif -} - -int main() -{ - int i; - int res = 0; - - for(i = 0; i < end; ++i) { - print_fpcw(); - res = (int) k[i]; - } - print_fpcw(); - printf("%d\n", res); - - return 0; -} diff --git a/ir/be/test/fehler021.c b/ir/be/test/fehler021.c deleted file mode 100644 index 212aa8c1b..000000000 --- a/ir/be/test/fehler021.c +++ /dev/null @@ -1,12 +0,0 @@ -struct blup { - char str[16]; - int dummy; -}; - -struct blup dumm[] = { { "Hallo" }, { "Welt" } }; - -int main() { - puts(dumm[0].str); - puts(dumm[1].str); - return 0; -} diff --git a/ir/be/test/fehler022.c b/ir/be/test/fehler022.c deleted file mode 100644 index 370edf237..000000000 --- a/ir/be/test/fehler022.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -const wchar_t AmmoCaliber[][20] = -{ - L"BlupBlupBlupBlupBlup", - L".38 Kal", -}; - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler023.c b/ir/be/test/fehler023.c deleted file mode 100644 index 28ff4050e..000000000 --- a/ir/be/test/fehler023.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int main(int argc, char ** argv) { - float a = 0; - - while(argc--) { - a += 1; - } - - printf("%f\n", a); - - return 0; -} diff --git a/ir/be/test/fehler024.c b/ir/be/test/fehler024.c deleted file mode 100644 index b95fde2bb..000000000 --- a/ir/be/test/fehler024.c +++ /dev/null @@ -1,15 +0,0 @@ -/* The tarval module fails to negate the constant and returns TV_OVERFLOW_BAD - * when optimising the comparison (-x < 0 -> x > 0). It is not expected that - * the negation fails and an assertion while constructing the negated constant - * is triggered */ - -int f(double x) -{ - return -x < 0; -} - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler025.c b/ir/be/test/fehler025.c deleted file mode 100644 index eadc34d78..000000000 --- a/ir/be/test/fehler025.c +++ /dev/null @@ -1,21 +0,0 @@ -/* The compound initialisation code asserts when a wide char array in a struct - * gets initialised with a wide string literal which is - not counting the \0 - - * as long as the array */ - -#include - -struct s { - wchar_t x[30]; - short y; -}; - - -struct s x[][21] = { - { L"Exactly 30 chars long", 1 } -}; - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler026.c b/ir/be/test/fehler026.c deleted file mode 100644 index 03bb2b558..000000000 --- a/ir/be/test/fehler026.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include - -#define SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS 0x00100000 //Temp File starts with sm_ -#define SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS 0x00200000 //Temp File starts with l_ - -#define SF_REVEALED_STATUS_TEMP_FILE_EXISTS 0x01000000 //Temp File starts with v_ -#define SF_DOOR_STATUS_TEMP_FILE_EXISTS 0x02000000 //Temp File starts with ds_ -#define SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS 0x04000000 //Temp File starts with e_ -#define SF_CIV_PRESERVED_TEMP_FILE_EXISTS 0x08000000 //Temp File starts with c_ -#define SF_ITEM_TEMP_FILE_EXISTS 0x10000000 //Temp File starts with i_ -#define SF_ROTTING_CORPSE_TEMP_FILE_EXISTS 0x20000000 //Temp File starts with r_ -#define SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS 0x40000000 //Temp File starts with m_ -#define SF_DOOR_TABLE_TEMP_FILES_EXISTS 0x80000000 //Temp File starts with d_ - -#define MAPS_DIR "maps" - -void f(unsigned int uiType) -{ - //Convert the current sector location into a file name - const char* zTempName = "blub"; - char pMapName[512]; - - switch (uiType) - { - case SF_ITEM_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/i_%s", MAPS_DIR, zTempName); - break; - - case SF_ROTTING_CORPSE_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/r_%s", MAPS_DIR, zTempName); - break; - - case SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/m_%s", MAPS_DIR, zTempName); - break; - - case SF_DOOR_TABLE_TEMP_FILES_EXISTS: - sprintf( pMapName, "%s/d_%s", MAPS_DIR, zTempName); - break; - - case SF_REVEALED_STATUS_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/v_%s", MAPS_DIR, zTempName); - break; - - case SF_DOOR_STATUS_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/ds_%s", MAPS_DIR, zTempName); - break; - - case SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/e_%s", MAPS_DIR, zTempName); - break; - - case SF_CIV_PRESERVED_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/cc_%s", MAPS_DIR, zTempName); - break; - - case SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/sm_%s", MAPS_DIR, zTempName); - break; - - case SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS: - sprintf( pMapName, "%s/l_%s", MAPS_DIR, zTempName); - break; - - default: - assert(0); - break; - } -} - -int main() -{ - return 0; -} diff --git a/ir/be/test/fehler027.c b/ir/be/test/fehler027.c deleted file mode 100644 index bef57d294..000000000 --- a/ir/be/test/fehler027.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Wrong stabs */ - -#define MAX_FILENAME_LEN 48 - -typedef unsigned char BOOLEAN; -typedef unsigned int UINT32; -typedef unsigned char UINT8; -typedef void* HVOBJECT; - - -typedef struct -{ - char ubFilename[MAX_FILENAME_LEN]; - BOOLEAN fLoaded; - UINT32 uiIndex; - UINT8 ubFlags; - UINT8 ubNumberOfFrames; - HVOBJECT hVObject; -} CursorFileData; - - -CursorFileData blub; - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler028.c b/ir/be/test/fehler028.c deleted file mode 100644 index 5ebd0903f..000000000 --- a/ir/be/test/fehler028.c +++ /dev/null @@ -1,18 +0,0 @@ -/* fmt and all further parameters must be passed on the stack even for regparams */ -#include -#include - -static void f(const char* fmt, ...) -{ - va_list va; - va_start(va, fmt); - vprintf(fmt, va); - va_end(va); -} - - -int main(void) -{ - f("Hallo, %s!\n", "Welt"); - return 0; -} diff --git a/ir/be/test/fehler029.c b/ir/be/test/fehler029.c deleted file mode 100644 index c678562d0..000000000 --- a/ir/be/test/fehler029.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Crash in ia32 floating point code emitter */ - -int f(float x) -{ - return x != -1; -} - - -int main(void) -{ - return f(-1); -} diff --git a/ir/be/test/fehler030.c b/ir/be/test/fehler030.c deleted file mode 100644 index 605241641..000000000 --- a/ir/be/test/fehler030.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int k = 123; - -int main() -{ - if(k & 16) { - puts("correct"); - return 0; - } - return 1; -} diff --git a/ir/be/test/fehler031.c b/ir/be/test/fehler031.c deleted file mode 100644 index ea42722fc..000000000 --- a/ir/be/test/fehler031.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -static unsigned hash_ptr(const void *ptr) -{ - unsigned ptr_int = ((const char*) ptr - (const char*) NULL); - return ptr_int >> 3; -} - -void *p = (void*) 0xdeadbeef; - -int main() -{ - printf("0x%x (shoulde be 0x1bd5b7dd)\n", hash_ptr(p)); - - return 0; -} diff --git a/ir/be/test/fehler032.c b/ir/be/test/fehler032.c deleted file mode 100644 index 3c859db0b..000000000 --- a/ir/be/test/fehler032.c +++ /dev/null @@ -1,20 +0,0 @@ -/* testjmp optimizer invalid */ - -#include - -void *p = (void*) 0x12345; -void *p2 = 0; - -int main() -{ - void *mp = p; - void *mp2 = p2; - if(mp && mp2) { - printf("1\n"); - } else if (mp) { - printf("2\n"); - } else { - printf("3\n"); - } - return 0; -} diff --git a/ir/be/test/fehler033.c b/ir/be/test/fehler033.c deleted file mode 100644 index 4d67d6c16..000000000 --- a/ir/be/test/fehler033.c +++ /dev/null @@ -1,15 +0,0 @@ -/* tailrec optimisation failing on struct parameters */ - -typedef struct { - int a, b, c; -} stru; - -void f(int a, const stru x) { - if(a == 100) - return; - f(a+1, x); -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler034.c b/ir/be/test/fehler034.c deleted file mode 100644 index ef9992df5..000000000 --- a/ir/be/test/fehler034.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Very subtle if conversion bug: print is correct, return value is incorrect */ - -#ifdef __GNUC__ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE __declspec(noinline) -#endif - -static inline int f(unsigned int x) -{ - if (x == 0xFFFFFFFF) - return 0; - else - return x; -} - - -unsigned int q = 89497; - - -int NO_INLINE main2(void) -{ - printf("%d = 1\n", f(q) != 0); - return f(q) != 0; -} - - -int main(void) -{ - return !main2(); -} diff --git a/ir/be/test/fehler035.c b/ir/be/test/fehler035.c deleted file mode 100644 index 3801ef354..000000000 --- a/ir/be/test/fehler035.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include - -unsigned int p0 = 0; -unsigned int p1 = 42; - -int simpler(void) -{ - if (p0 != p1) - if (p0 == 0) - return -1; - else - return 1; - return 0; -} - -int compare_string(char *CompValue, char *ValuePtr) -{ - int i = 0; - unsigned char *p0 = (unsigned char *)CompValue; - unsigned char *p1 = (unsigned char *)ValuePtr; - - for (i = 0; i == 0 && *p0 != '\0' && *p1 != '\0'; p0++, p1++) - { - if (*p0 != *p1) - if (*p0 < *p1) - i = -1; - else - i = 1; - } - - if (i == 0) - if (*p0 != *p1) - if (*p0 == '\0') - i = -1; - else - i = 1; - - return(i); -} - -int main() -{ -#define test(a,b,shouldbe) { int res = compare_string(a, b); printf("Compare %s, %s -> %d (should be %d)\n", a, b, res, shouldbe); assert(res == shouldbe); } - test("a", "b", -1); - test("", "", 0); - test("Rothe", "Rother", -1); - test("hallo", "hallo", 0); - test("hallo", "welt", -1); - test("welt", "hallo", 1); - - printf("Simpler: %d\n", simpler()); - return 0; -} diff --git a/ir/be/test/fehler036.c b/ir/be/test/fehler036.c deleted file mode 100644 index ec2204296..000000000 --- a/ir/be/test/fehler036.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -#ifdef __GNUC__ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE __declspec(noinline) -#endif - -float NO_INLINE t2() -{ - float a; - return a + 12.54f; -} - -float NO_INLINE t() -{ - exit(0); -} - -int main() -{ - t(); - t2(); - return 0; -} diff --git a/ir/be/test/fehler037.c b/ir/be/test/fehler037.c deleted file mode 100644 index 03da0262c..000000000 --- a/ir/be/test/fehler037.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int a[10]; - -int main() { - int *p = &a[0]; - int *q = &a[9]; - - printf("%d\n", p - q); - return 0; -} diff --git a/ir/be/test/fehler038.c b/ir/be/test/fehler038.c deleted file mode 100644 index 4686d4cf6..000000000 --- a/ir/be/test/fehler038.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef __GNUC__ -#define NO_INLINE __attribute__((noinline)) -#else -#define NO_INLINE __declspec(noinline) -#endif - - -int NO_INLINE f(int y, int z) -{ - int x = 0; - if (y) x++; - if (z) x++; - return x; -} - - -int main(void) -{ - printf("%d (0)\n", f(0, 0)); - printf("%d (1)\n", f(0, 1)); - printf("%d (1)\n", f(1, 0)); - printf("%d (2)\n", f(1, 1)); - return 0; -} diff --git a/ir/be/test/fehler039.c b/ir/be/test/fehler039.c deleted file mode 100644 index c3bbaa967..000000000 --- a/ir/be/test/fehler039.c +++ /dev/null @@ -1,33 +0,0 @@ -/* register allocator fails to resolve IMul Constraints correctly */ -#include -#include - -typedef struct -{ - short sX; - short sY; - int iLightID; -} EXPLOSIONTYPE; - -static void GenerateExplosionFromExplosionPointer(EXPLOSIONTYPE* pExplosion) -{ - short sX = pExplosion->sX; - short sY = pExplosion->sY; - - if (pExplosion->iLightID = rand()) - { - printf("Blup: %d %d %d\n", pExplosion->iLightID, sX / 10, sY / 10); - } -} - - -void f(void) -{ - GenerateExplosionFromExplosionPointer(0); -} - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler040.c b/ir/be/test/fehler040.c deleted file mode 100644 index 16b72d32b..000000000 --- a/ir/be/test/fehler040.c +++ /dev/null @@ -1,23 +0,0 @@ - -#define FABS(x) fabs(x) -#define FLOOR(x) floor(x) - -double One = 1.0; -double C, Y, Z; - -int main() -{ - Y = One; - Z = 0.00000000000000011102; - printf("Y: %20.20f Z: %20.20f\n", Y, Z); - /* ... D is power of 1/Radix < 1. */ - do { - C = Y; - Y = Z; - Z = Y * Y; - //printf("Y: %30.30f Z:%30.30f\n", Y, Z); - } while ((Y > Z) && (Z + Z > Z)); - - printf("Res. %20.20f - %20.20f\n", Z, Y); - return 0; -} diff --git a/ir/be/test/fehler041.c b/ir/be/test/fehler041.c deleted file mode 100644 index 9e2627a57..000000000 --- a/ir/be/test/fehler041.c +++ /dev/null @@ -1,14 +0,0 @@ -/* different interpretation of strict conv */ - -float C1 = 15; -float C2 = 1; -float C3 = 0.0099999997764825821; -//double C4 = 0.12999999523162842; - -int main() -{ - float C4 = 0.12999999523162842; - C4 += C1 * C2 * C3; - printf("%.30f\n", C4); - return 0; -} diff --git a/ir/be/test/fehler042.c b/ir/be/test/fehler042.c deleted file mode 100644 index 2443a4237..000000000 --- a/ir/be/test/fehler042.c +++ /dev/null @@ -1,26 +0,0 @@ -/* float problems */ -#include - -double Radix = 2.0; -double One = 1.0; -double Zero = 0.0; -double U1; -double W; -double Y; -double Precision; - -int main() { - W = One; - Precision = Zero; - do { - Precision = Precision + One; - W = W * Radix; - Y = W + One; - } while((Y - W) == One); - - U1 = One / W; - printf("BLa. %.30e\n", U1); - - - return 0; -} diff --git a/ir/be/test/fehler043.c b/ir/be/test/fehler043.c deleted file mode 100644 index 78e04f21d..000000000 --- a/ir/be/test/fehler043.c +++ /dev/null @@ -1,10 +0,0 @@ -//double C2 = 74.739288330078125; - -int main() -{ - float cost = 74.739288330078125; - double square = cost * cost; - //C2 = square; - printf("Res: %.20f\n", square); - return 0; -} diff --git a/ir/be/test/fehler044.c b/ir/be/test/fehler044.c deleted file mode 100644 index 9eca75d8c..000000000 --- a/ir/be/test/fehler044.c +++ /dev/null @@ -1,19 +0,0 @@ -#define IM 2147483648u - -unsigned int current_random1 = 1892341778; -int imax1 = 403; -unsigned int current_random2 = 4247132568; -int imax2 = 403; - -int main() -{ - int ival1 = current_random1 & (IM - 1); - ival1 = (int) ((float) ival1 * (float) (imax1 + 0.999) / (float) IM); - int ival2 = current_random2 & (IM - 1); - ival2 = (int) ((float) ival2 * (float) (imax2 + 0.999) / (float) IM); - - printf("Res1: %d\n", ival1); - printf("Res2: %d\n", ival2); - - return 0; -} diff --git a/ir/be/test/fehler044b.c b/ir/be/test/fehler044b.c deleted file mode 100644 index 7badaf2b3..000000000 --- a/ir/be/test/fehler044b.c +++ /dev/null @@ -1,13 +0,0 @@ -#define IM 2147483648u - -unsigned int current_random2 = 4247132568; -int imax2 = 403; - -int main() -{ - int ival2 = current_random2 & (IM - 1); - double intermediate = ((float) ival2 * (float)(imax2 + 0.999)); - printf("%3.15e => %u\n", intermediate, (unsigned int) intermediate); - - return 0; -} diff --git a/ir/be/test/fehler045.c b/ir/be/test/fehler045.c deleted file mode 100644 index 8819f7bba..000000000 --- a/ir/be/test/fehler045.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -struct bitfield { - unsigned int code : 8; - unsigned int bit1 : 1; - unsigned int bit2 : 1; - unsigned int bit3 : 1; -} bf = {7, 1, 0, 1 }; - -int main() -{ - printf("Res: %d (should be 7)\n", bf.code); - return 0; -} diff --git a/ir/be/test/fehler046.c b/ir/be/test/fehler046.c deleted file mode 100644 index f9d3eb2c8..000000000 --- a/ir/be/test/fehler046.c +++ /dev/null @@ -1,11 +0,0 @@ -/* tarval rounding wrong with fp-strict */ - -int main() -{ - float cost = 74.739288330078125; - double square = cost * cost; - //C2 = square; - printf("cost: %.20f\n", cost); - printf("square: %.20f\n", square); - return 0; -} diff --git a/ir/be/test/fehler047.c b/ir/be/test/fehler047.c deleted file mode 100644 index 7be490eca..000000000 --- a/ir/be/test/fehler047.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Incorrect values when using C99 style initialisation */ - -int tab[] = { - [5] = 23 -}; - - -int main(void) -{ - int i = tab[5]; - printf("%d (23)\n", i); - return i != 23; -} diff --git a/ir/be/test/fehler048.c b/ir/be/test/fehler048.c deleted file mode 100644 index 47ceece27..000000000 --- a/ir/be/test/fehler048.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Frontend assert while building initialisers */ - -union { - int i; - char a[4]; -} blub = { - .a[2] = 9, - .i = 23 -}; - -int main() -{ - return 0; -} diff --git a/ir/be/test/fehler049.c b/ir/be/test/fehler049.c deleted file mode 100644 index a401b7d4a..000000000 --- a/ir/be/test/fehler049.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Emitter dies while emitting initialisers */ - -union { - int i; - char a[4]; -} blub = { - .i = 23, - .a[2] = 9 -}; - -int main() -{ - return 0; -} diff --git a/ir/be/test/fehler050.c b/ir/be/test/fehler050.c deleted file mode 100644 index 922e38de2..000000000 --- a/ir/be/test/fehler050.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -void te(int *bla) { - int *blup = bla; - - while(blup) { - switch(*blup) { - case 20: - printf("Joa: %d\n", *(blup+1)); - blup = 0; - break; - } - } -} - -int main() -{ - int arr[] = { 20, 2, 4, 5, 6, 8 }; - - te(arr); - - return 0; -} diff --git a/ir/be/test/fehler051.c b/ir/be/test/fehler051.c deleted file mode 100644 index 983f9903a..000000000 --- a/ir/be/test/fehler051.c +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************ -* Program: maxps.c -* Function: Add 2 vectors (lying in memory) and store the result in -* a another vector in memory. -* Used as a test for the simd optimization. -* Author: Andreas Schoesser -* Date: 2007-02-13 -************************************************************************/ - -#include -#include -#include - -float maxps(); -float ueberlappung(); -//void vadd_loop(); -//void array_test(int *a[]); - -int main() -{ - int a[5][5]; - - a[1][1] = 20; - - srand(12345); - - printf("1. vload -> vadd -> vstore\n===================\n\n"); - ueberlappung(); - - printf("2. vload -> vadd -> vstore, multi dimensional array, in loop\n==========================================\n\n"); - // vadd_loop(); - - // array_test(a); - - return 0; -} - -float ueberlappung() -{ - float a[4], b[4], c[4], d[4]; - float a0, a1, a2, a3; - float b0, b1, b2, b3; - float c0, c1, c2, c3; - float sp1, sp2; - int i; - - for(i = 0; i < 4; i++) - { - a[i] = rand() % 10; - b[i] = rand() % 10; - c[i] = rand() % 10; - d[i] = rand() % 10; - } - - - - // find vload 2x - sp1 = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; - - // find vmul - sp2 = b[0] * d[0] + b[1] * d[1] + b[2] * d[2] + b[3] * d[3]; - - // Usage to prevent optimizations other than SIMD opt - for(i = 0; i < 4; i++) - printf("%f %f %f %f\n", a[i], b[i], c[i], d[i]); - printf("\n"); - return(sp1 + sp2); -} diff --git a/ir/be/test/fehler052.c b/ir/be/test/fehler052.c deleted file mode 100644 index 1708d5ce9..000000000 --- a/ir/be/test/fehler052.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include - -union foo { - float blop; - int bla; - struct { - int a, b, c; - } jup; - const char *str; -}; - -typedef union foo *tree; - -enum bla { - BLA_1, - BLA_2, - BLA_3, - BLA_4 -}; - -const char* foo(enum bla type, tree dummy, ...) { - va_list ap; - const char *s1; - - va_start(ap, dummy); - s1 = va_arg(ap, const char*); - va_end(ap); - - return s1; -} - -union foo bla = { .str = "bla" }; - -int main() -{ - const char *res = foo(BLA_2, &bla, "everything ok"); - puts(res); - return 0; -} diff --git a/ir/be/test/fehler053.c b/ir/be/test/fehler053.c deleted file mode 100644 index 0c0600f71..000000000 --- a/ir/be/test/fehler053.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -struct bitfield { - unsigned int code : 8; - unsigned int bit1 : 1; - unsigned int bit2 : 1; - unsigned int bit3 : 1; -} bf = {7, 1, 0, 1 }; - -int main() -{ - bf.code = 0xffffffff; - printf("Res: %d (should be 255)\n", bf.code); - printf("R2: %d %d %d (should be 1 0 1)\n", bf.bit1, bf.bit2, bf.bit3); - bf.code += 1; - printf("Res: %d (should be 0)\n", bf.code); - return 0; -} diff --git a/ir/be/test/fehler054.c b/ir/be/test/fehler054.c deleted file mode 100644 index 99a051821..000000000 --- a/ir/be/test/fehler054.c +++ /dev/null @@ -1,23 +0,0 @@ -/*$ -fno-inline $*/ -/* 64 bit problems in beabi (should be worked around by now) */ -#include - -extern int func1(int version, const char *path, unsigned long long *ptr) -{ - (void) version; - (void) path; - (void) ptr; - return 42; -} - -extern inline int func2(const char *path, unsigned long long dev) -{ - return func1(1, path, &dev); -} - -int main() -{ - int res = func2("bla", 1); - assert(res == 42); - return 0; -} diff --git a/ir/be/test/fehler055.c b/ir/be/test/fehler055.c deleted file mode 100644 index 18d779f03..000000000 --- a/ir/be/test/fehler055.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -typedef struct sv { -}SV ; - -typedef struct hek HEK; -struct hek { - char hek_key[4]; -}; - -HEK hekimek; - -int main() { - (*(SV**) hekimek.hek_key) = (SV*) -2; - printf("Result: %d (expected -2)\n", (int) (*(SV**) hekimek.hek_key)); - return 0; -} diff --git a/ir/be/test/fehler056.c b/ir/be/test/fehler056.c deleted file mode 100644 index 87af0920c..000000000 --- a/ir/be/test/fehler056.c +++ /dev/null @@ -1,28 +0,0 @@ -typedef struct rtx_def -{ - unsigned short code; - int mode : 8; - int rtint; -} *rtx; - -struct rtx_def bla; - -void t(int num_eliminable, int n_reloads) { - register rtx insn = &bla; - int did_elimination = 0; - - if(num_eliminable) - did_elimination = rand(); - - insn->mode = did_elimination ? 42 : insn->mode == 6 ? 6 : 0; -} - -int main() -{ - bla.rtint = 8; - bla.mode = 6; - printf("Before: %d %d\n", bla.mode, bla.rtint); - t(0, 1); - printf("After: %d %d\n", bla.mode, bla.rtint); - return 0; -} diff --git a/ir/be/test/fehler057.c b/ir/be/test/fehler057.c deleted file mode 100644 index 9dc2acaa2..000000000 --- a/ir/be/test/fehler057.c +++ /dev/null @@ -1,24 +0,0 @@ -int floor_log2_wide (unsigned int x) -{ - x >>= 1; - return x; -} - -unsigned test_div(int x) { - x /= -1; - return x; -} - -int X; - -int main() -{ - printf("Res: %d\n", floor_log2_wide(4294967251)); - printf("Res: %d\n", test_div(-5)); - printf("Res: %d\n", -5%-1); - printf("Res: %d\n", +5%-1); - printf("Res: %d\n", -5%+1); - printf("Res: %d\n", +5%+1); - printf("Res: %d\n", X % -1); - return 0; -} diff --git a/ir/be/test/fehler058.c b/ir/be/test/fehler058.c deleted file mode 100644 index dacbd3498..000000000 --- a/ir/be/test/fehler058.c +++ /dev/null @@ -1,7 +0,0 @@ -short ii = 230; - -int main() { - short i = ii & 255; - printf("res = %d (should be 230)\n", i); - return 0; -} diff --git a/ir/be/test/fehler059.c b/ir/be/test/fehler059.c deleted file mode 100644 index b6e240bd4..000000000 --- a/ir/be/test/fehler059.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -int main() -{ - char *b1 = alloca(13); - int i; - int lastoffs = 0; - - for(i = 0; i < 5; ++i) { - char *bfs = alloca(24); - int offset = b1 - bfs; - memset(bfs, 0, 24); - assert(offset > lastoffs); - lastoffs = offset; - } - - return 0; -} diff --git a/ir/be/test/fehler060.c b/ir/be/test/fehler060.c deleted file mode 100644 index 2bb1373dc..000000000 --- a/ir/be/test/fehler060.c +++ /dev/null @@ -1,10 +0,0 @@ -float f(float x) -{ - return x * 2.0f; -} - - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler061.c b/ir/be/test/fehler061.c deleted file mode 100644 index d720c2c22..000000000 --- a/ir/be/test/fehler061.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -static void f(int i) -{ - printf("%d (should be 42)\n", i); -} - -void (*x)(int) = f; - -int main(void) -{ - x(42); - return 0; -} diff --git a/ir/be/test/fehler062.c b/ir/be/test/fehler062.c deleted file mode 100644 index 7998c6bc1..000000000 --- a/ir/be/test/fehler062.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -typedef struct linked { - struct linked *next; -} linked; - -linked* t(linked *val) { - printf("start\n"); - - if(val == NULL) - return NULL; - - void *res = t(val->next); - if(res) - return res; - return val; -} - -int main() -{ - linked a, b, c; - a.next = &b; - b.next = &c; - c.next = NULL; - t(&a); - return 0; -} diff --git a/ir/be/test/fehler063.c b/ir/be/test/fehler063.c deleted file mode 100644 index f5075a38c..000000000 --- a/ir/be/test/fehler063.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -#define ZONEID 0x1d4a11 - -typedef struct memblock_s { - int size; // including the header and possibly tiny fragments - int tag; // a tag of 0 is a free block - struct memblock_s *next, *prev; - int id; // should be ZONEID -#ifdef ZONE_DEBUG - zonedebug_t d; -#endif -} memblock_t; - -typedef struct { - int size; // total bytes malloced, including header - int used; // total bytes used - memblock_t blocklist; // start / end cap for linked list - memblock_t *rover; -} memzone_t; - -typedef char byte; - -static void Z_ClearZone( memzone_t *zone, int size ) { - memblock_t *block; - - // set the entire zone to one free block - - zone->blocklist.next = zone->blocklist.prev = block = - (memblock_t *)( (byte *)zone + sizeof(memzone_t) ); -#if 0 - zone->blocklist.tag = 1; // in use block - zone->blocklist.id = 0; - zone->blocklist.size = 0; - zone->rover = block; - zone->size = size; - zone->used = 0; -#endif - - block->prev = block->next = &zone->blocklist; - block->tag = 0; // free block - block->id = ZONEID; - block->size = size - sizeof(memzone_t); -} - -void Com_InitSmallZoneMemory( void ) { - int s_smallZoneTotal = 512 * 1024; - // bk001205 - was malloc - memzone_t *smallzone = calloc( s_smallZoneTotal, 1 ); - if ( !smallzone ) { - abort(); - } - Z_ClearZone( smallzone, s_smallZoneTotal ); - - return; -} - -int main(void) -{ - Com_InitSmallZoneMemory(); - return 0; -} diff --git a/ir/be/test/fehler064.c b/ir/be/test/fehler064.c deleted file mode 100644 index b512a0dba..000000000 --- a/ir/be/test/fehler064.c +++ /dev/null @@ -1,11 +0,0 @@ -static void crashme(void) -{ - * ( int * ) 0 = 0x12345678; -} - -int main(int argc) -{ - if(argc > 1) - crashme(); - return 0; -} diff --git a/ir/be/test/fehler065.c b/ir/be/test/fehler065.c deleted file mode 100644 index 36ae7f195..000000000 --- a/ir/be/test/fehler065.c +++ /dev/null @@ -1,8 +0,0 @@ -int randn = -1271796327; -double value = 4294967295; - -int main(void) { - double res = (double) (randn % (unsigned int) value); - printf("Res: %f\n", res); - return 0; -} diff --git a/ir/be/test/fehler066.c b/ir/be/test/fehler066.c deleted file mode 100644 index 9c90b2f31..000000000 --- a/ir/be/test/fehler066.c +++ /dev/null @@ -1,15 +0,0 @@ -double a[1000000]; -unsigned int b[1000000]; -double a2[1000000]; -unsigned int b2[1000000]; - -int main() { - int i; - - for(i = 0; i < 123; ++i) { - a[i] = b[i]; - a2[i] = b2[i]; - } - - return 0; -} diff --git a/ir/be/test/fehler067.c b/ir/be/test/fehler067.c deleted file mode 100644 index b9ac8a13a..000000000 --- a/ir/be/test/fehler067.c +++ /dev/null @@ -1,102 +0,0 @@ -/***************************************************************************** - * Program: sad.c - * Function: New implementation of the intel application note - * AP-940: "Block matching in Motion estimation Algorithms - * using Streaming SIMD Extensions 3" - * We changed: - * - We used local arrays instead of pointer arithmetic - * because of the limited capability of the memory disambiguator - * - Used if/else instead of abs function since we can't - * use function calls in specification - * - Unrolled the inner loop manually since our loop - * unroller does not work so well. - * Used as a test for the simd optimization. - * TODO: - Maybe use the "restrict" keyword to implement pointer - * arithmetic - * Author: Andreas Schoesser - * Date: 2007-08-06 - *****************************************************************************/ - -#include -#include -#include -#include - -unsigned int sad(int test_blockx, int test_blocky, int *best_block_x, int *best_block_y, int iterations); - -main() -{ - int best_block_x, best_block_y; - unsigned int min_diff; - int iterations = 2; - - printf("PSADBW Example\n--------------\n\n"); - - printf("Executing 'motion estimation' %d times...\n\n", iterations); - min_diff = sad(0, 0, &best_block_x, &best_block_y, iterations); - - printf("MinDiff: %u\nBest X: %d\nBest Y: %d\n", min_diff, best_block_x, best_block_y); -} - -unsigned int sad(int test_blockx, int test_blocky, int *best_block_x, int *best_block_y, int iterations) -{ - unsigned char b[256][256]; - - unsigned char a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15; - unsigned char b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15; - - int i, x, y, blocky; - unsigned tmp_diff, min_diff = 0xFFFFFFFF; // MAX_UINT - - // Fill in some random values to compare - for(x = 0; x < 256; x++) - for(y = 0; y < 256; y++) - b[y][x] = (unsigned char) rand() % 255; - - // Execute Block matching 100 times - for(i = 0; i < iterations; i++) - { - // Iterate over whole frame, x,y=coords of current block - for(x = 1; x < 256 - 16; x++) - for(y = 0; y < 256 - 16; y++) - { - tmp_diff = 0; - - // Compare current Block with reference block - for(blocky = 0; blocky < 16; blocky++) - { - // Vektor Loads - a0 = b[blocky][0]; a1 = b[blocky][1]; a2 = b[blocky][2]; a3 = b[blocky][3]; a4 = b[blocky][4]; a5 = b[blocky][5]; a6 = b[blocky][6]; a7 = b[blocky][7]; a8 = b[blocky][8]; a9 = b[blocky][9]; a10 = b[blocky][10]; a11 = b[blocky][11]; a12 = b[blocky][12]; a13 = b[blocky][13]; a14 = b[blocky][14]; a15 = b[blocky][15]; - b0 = b[blocky + y][x + 0]; b1 = b[blocky + y][x + 1]; b2 = b[blocky + y][x + 2]; b3 = b[blocky + y][x + 3]; b4 = b[blocky + y][x + 4]; b5 = b[blocky + y][x + 5]; b6 = b[blocky + y][x + 6]; b7 = b[blocky + y][x + 7]; b8 = b[blocky + y][x + 8]; b9 = b[blocky + y][x + 9]; b10 = b[blocky + y][x + 10]; b11 = b[blocky + y][x + 11]; b12 = b[blocky + y][x + 12]; b13 = b[blocky + y][x + 13]; b14 = b[blocky + y][x + 14]; b15 = b[blocky + y][x + 15]; - - // psadpw, would be nice if this could be done by loop unrolling - tmp_diff += ((a0 > b0) ? (a0 - b0) : (b0 - a0)) + - ((a1 > b1) ? (a1 - b1) : (b1 - a1)) + - ((a2 > b2) ? (a2 - b2) : (b2 - a2)) + - ((a3 > b3) ? (a3 - b3) : (b3 - a3)) + - ((a4 > b4) ? (a4 - b4) : (b4 - a4)) + - ((a5 > b5) ? (a5 - b5) : (b5 - a5)) + - ((a6 > b6) ? (a6 - b6) : (b6 - a6)) + - ((a7 > b7) ? (a7 - b7) : (b7 - a7)) + - ((a8 > b8) ? (a8 - b8) : (b8 - a8)) + - ((a9 > b9) ? (a9 - b9) : (b9 - a9)) + - ((a10 > b10) ? (a10 - b10) : (b10 - a10)) + - ((a11 > b11) ? (a11 - b11) : (b11 - a11)) + - ((a12 > b12) ? (a12 - b12) : (b12 - a12)) + - ((a13 > b13) ? (a13 - b13) : (b13 - a13)) + - ((a14 > b14) ? (a14 - b14) : (b14 - a14)) + - ((a15 > b15) ? (a15 - b15) : (b15 - a15)); - } - - // Check if the current block is least different - if(min_diff > tmp_diff) - { - min_diff = tmp_diff; - *best_block_x = x; - *best_block_y = y; - } - } - } - - return(min_diff); -} diff --git a/ir/be/test/fehler068.c b/ir/be/test/fehler068.c deleted file mode 100644 index 5757e0bbb..000000000 --- a/ir/be/test/fehler068.c +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************ - * Program: scalar_product.c - * Function: Calculates the scalar product of vector lying in memory - * Used as a test for the simd optimization. - * Author: Andreas Schoesser - * Date: 2007-06-13 - ************************************************************************/ - -#include -#include -#include -#include - -float scalar_product(float *a, float *b, unsigned int max_elements); - -main() -{ - float res; - int i, max_elements = 100; - double d_zeitdauer; - - // Allocate memory and make sure pointers are aligned to 16 byte addresses - char *a = malloc(16 + max_elements * sizeof(float)); - char *b = malloc(16 + max_elements * sizeof(float)); - float c; - char *ca = &a[0] + 16 - (unsigned int) ((unsigned int) &a[0] % 16); - char *cb = &b[0] + 16 - (unsigned int) ((unsigned int) &b[0] % 16); - - float *aa = (float *) ca; - float *ab = (float *) cb; - - srand(0); - - printf("Scalar product\n==============\n\n"); - - //printf("Array Position: %u, %u, %u, %u\n", a, b, aa, ba/*(unsigned int) &aa[0] % 16, (unsigned int) &ba[0] % 16*/); - - // Fill both arrays with random values - for(i = 0; i < max_elements; i++) - { - aa[i] = (float) (rand() % 10); - ab[i] = (float) (rand() % 10); - - //printf("(%g * %g) + ", a[i], b[i]); - } - - res = scalar_product(aa, ab, max_elements); - - printf("\nResult: %g\n", res); -} - - -float scalar_product(float * a, float * b, unsigned int max_elements) -{ - float res = 0; - int i; - - for(i = 0; i < max_elements; i += 4) { - res += a[i] * b[i]; - res += a[i + 1] * b[i + 1]; - res += a[i + 2] * b[i + 2]; - res += a[i + 3] * b[i + 3]; - } - - return res; -} diff --git a/ir/be/test/fehler069.c b/ir/be/test/fehler069.c deleted file mode 100644 index 23091e9b9..000000000 --- a/ir/be/test/fehler069.c +++ /dev/null @@ -1,64 +0,0 @@ -typedef unsigned char UINT8; -typedef signed short INT16; -typedef unsigned short UINT16; -typedef unsigned int UINT32; - -#define FROMRGB(r, g ,b) ((UINT32) (((UINT8) (r) | ((UINT16) (g) << 8)) | (((UINT32) (UINT8) (b)) << 16))) -#define SGPGetRValue(rgb) ((UINT8) (rgb)) -#define SGPGetBValue(rgb) ((UINT8) ((rgb) >> 16)) -#define SGPGetGValue(rgb) ((UINT8) (((UINT16) (rgb)) >> 8)) -#define BLACK_SUBSTITUTE 0x0001 - - -float guiShadePercent; -INT16 gusRedShift; -INT16 gusGreenShift; -INT16 gusBlueShift; -INT16 gusRedMask; -INT16 gusGreenMask; -INT16 gusBlueMask; - - -UINT16 Get16BPPColor(UINT32 RGBValue) -{ - UINT8 r = SGPGetRValue(RGBValue); - UINT8 g = SGPGetGValue(RGBValue); - UINT8 b = SGPGetBValue(RGBValue); - - UINT16 r16 = (gusRedShift < 0 ? r >> -gusRedShift : r << gusRedShift); - UINT16 g16 = (gusGreenShift < 0 ? g >> -gusGreenShift : g << gusGreenShift); - UINT16 b16 = (gusBlueShift < 0 ? b >> -gusBlueShift : b << gusBlueShift); - - UINT16 usColor = (r16 & gusRedMask) | (g16 & gusGreenMask) | (b16 & gusBlueMask); - - if (usColor == 0 && RGBValue != 0) usColor = BLACK_SUBSTITUTE; - - return usColor; -} - - -void BuildShadeTable(void) -{ - UINT16 red; - UINT16 green; - UINT16 blue; - - for (red = 0; red < 256; red += 4) - { - for (green = 0; green < 256; green += 4) - { - for (blue = 0; blue < 256; blue += 4) - { - Get16BPPColor(42); - Get16BPPColor(FROMRGB(red * guiShadePercent, green * guiShadePercent, blue * guiShadePercent)); - } - } - } -} - - -int main(void) -{ - BuildShadeTable(); - return 0; -} diff --git a/ir/be/test/fehler070.c b/ir/be/test/fehler070.c deleted file mode 100644 index ecc6ac5fe..000000000 --- a/ir/be/test/fehler070.c +++ /dev/null @@ -1,20 +0,0 @@ -typedef struct s { - char a; - char b; -} s; - -s a[129]; -s* b = a; - -void f(unsigned char i) -{ - printf("%d %d (should be 23 42)\n", b[i].a, b[i].b); -} - - -int main(void) -{ - b[128].a = 23; - b[128].b = 42; - f(128); -} diff --git a/ir/be/test/fehler071.c b/ir/be/test/fehler071.c deleted file mode 100644 index 020fa96fc..000000000 --- a/ir/be/test/fehler071.c +++ /dev/null @@ -1,43 +0,0 @@ -/*$ -fno-if-conv -fno-inline $*/ - -#include -#include - -int a = 42; - -int changea(void) { - a = 13; - return 1; -} - -int f2(void) { - int t = a; - int t2 = changea(); - int t3 = t + t2; - return t3; -} - -int f3(int arg) { - int t = a + arg; - changea(); - return t; -} - -int f(int f) { - int t = a; - changea(); - - /* must not use source address mode (loading from a) for t+1 */ - if(f > 10000) { - return t + 1; - } - return f + 2; -} - -int main(void) { - srand(0); - printf("Res: %d (should be 43)\n", f(1000000)); - a = 42; - printf("Res2: %d (should be 43)\n", f2()); - return 0; -} diff --git a/ir/be/test/fehler072.c b/ir/be/test/fehler072.c deleted file mode 100644 index 363c8dc23..000000000 --- a/ir/be/test/fehler072.c +++ /dev/null @@ -1,14 +0,0 @@ -/*$ -fno-inline $*/ -#include - -unsigned f(unsigned a, unsigned b) -{ - return (long long)a * b >> 16; -} - - -int main(void) -{ - printf("%X\n", f(0xFFFFFFFF, 1)); - return 0; -} diff --git a/ir/be/test/fehler073.c b/ir/be/test/fehler073.c deleted file mode 100644 index 92bae3764..000000000 --- a/ir/be/test/fehler073.c +++ /dev/null @@ -1,17 +0,0 @@ - -float f(float a, float b) { - return a*a + b*b; -} - -int fi(int a, int b) { - return a*a + b*b; -} - -int main(void) { - float a = 3; - float b = 4; - float c = 5; - printf("%.30f %.30f %.30f %.30f %.30f\n", a, b, c, f(a, b), c*c); - printf("%d\n", fi(3, 4)); - return 0; -} diff --git a/ir/be/test/fehler074.c b/ir/be/test/fehler074.c deleted file mode 100644 index b70246d31..000000000 --- a/ir/be/test/fehler074.c +++ /dev/null @@ -1,12 +0,0 @@ -/*$ -std=c99 $*/ - -#include -#include - -int main() { - float x = NAN; - double y = x; - - printf("%f\n", y); - return 0; -} diff --git a/ir/be/test/fehler075.c b/ir/be/test/fehler075.c deleted file mode 100644 index 9a1db835f..000000000 --- a/ir/be/test/fehler075.c +++ /dev/null @@ -1,12 +0,0 @@ -/*$ -fno-inline -fno-if-conv $*/ - -long long k(long long a) -{ - return a < 0 ? -a : a; -} - -int main(void) -{ - printf("%lld\n", k(0x80000000LL)); - return 0; -} diff --git a/ir/be/test/fehler076.c b/ir/be/test/fehler076.c deleted file mode 100644 index 4d58c5fff..000000000 --- a/ir/be/test/fehler076.c +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - float f = 1223432e3; - long l = f; - printf("long %ld float %f\n", l, f); - return 0; -} diff --git a/ir/be/test/fehler077.c b/ir/be/test/fehler077.c deleted file mode 100644 index 7ff8a3a18..000000000 --- a/ir/be/test/fehler077.c +++ /dev/null @@ -1,7 +0,0 @@ -unsigned char k; - -int main(void) { - /* should result in a decb k x86 instruction */ - --k; - return 0; -} diff --git a/ir/be/test/fehler078.c b/ir/be/test/fehler078.c deleted file mode 100644 index 2a1bc6ab7..000000000 --- a/ir/be/test/fehler078.c +++ /dev/null @@ -1,21 +0,0 @@ -/*$ -fno-inline $*/ -#include - -int k; - -int f(int a) -{ - if(k < 20) { - rand(); - return a < 5 ? 10 : 20; - } else { - return a < 5 ? 20 : 0; - } -} - -int main(void) -{ - k = 21; - printf("Res: %d should be 0\n", f(20)); - return 0; -} diff --git a/ir/be/test/fehler079.c b/ir/be/test/fehler079.c deleted file mode 100644 index b3ab817e8..000000000 --- a/ir/be/test/fehler079.c +++ /dev/null @@ -1,27 +0,0 @@ -/*$ -fno-inline -fno-cond-eval $*/ - -int x; - -int destroy_flags(void) { - rand(); - return 0; -} - -int f(void) { - int a = (x < 5); - int t = 1; - destroy_flags(); - if(a) { - t = 42; - } - return t; -} - -int main(void) { - x = 2; - printf("Res: %d (expected 42)\n", f()); - x = 10; - printf("Res: %d (expected 1)\n", f()); - - return 0; -} diff --git a/ir/be/test/fehler080.c b/ir/be/test/fehler080.c deleted file mode 100644 index 2e55429a2..000000000 --- a/ir/be/test/fehler080.c +++ /dev/null @@ -1,13 +0,0 @@ -/*$ -fno-inline $*/ - -#include -#include - -int f(unsigned x) { - return x < 10; -} - -int main(void) { - printf("Res: %d (should be 0)\n", f(INT_MIN)); - return 0; -} diff --git a/ir/be/test/fehler081.c b/ir/be/test/fehler081.c deleted file mode 100644 index b267ee80c..000000000 --- a/ir/be/test/fehler081.c +++ /dev/null @@ -1,27 +0,0 @@ -/*$ -fno-inline */ -#include - -void test1(int a) { - switch (a) { - case 1: - goto label; - default: - printf("default\n"); - break; - label: - printf("case 1\n"); - } -} - -void test2(int a) { - switch (a) case 1: printf("case 1\n"); - printf("end\n"); -} - -int main() { - test1(1); - test1(2); - test2(1); - test2(2); - return 0; -} diff --git a/ir/be/test/fehler082.c b/ir/be/test/fehler082.c deleted file mode 100644 index f64e8ee95..000000000 --- a/ir/be/test/fehler082.c +++ /dev/null @@ -1,20 +0,0 @@ -/*$ -fno-inline -bra-chordal-co-algo=heur4 -blistsched-select=heur */ - -/* demonstrates copyheur4 violating register constraints of FucomFnstsw */ -#include - -void f(float g, float g2) { - if(g < 1.23) { - if(g2 < 20) - printf("good"); - } else { - if(g2 < 20) - printf("bad"); - } -} - -int main(void) -{ - f(0.5, 10); - return 0; -} diff --git a/ir/be/test/fehler083.c b/ir/be/test/fehler083.c deleted file mode 100644 index b7eda5f87..000000000 --- a/ir/be/test/fehler083.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -/* produces a graph with wrong modes */ - -static char parens[] = "=!<,>"; -static char *p = & parens[2]; - -int f(void) -{ - return (p - parens) % 2 ? 42 : 13; -} - -int main(void) -{ - printf("Res: %d (should be 13)\n", f()); - return 0; -} diff --git a/ir/be/test/fehler084.c b/ir/be/test/fehler084.c deleted file mode 100644 index 4c240e7c4..000000000 --- a/ir/be/test/fehler084.c +++ /dev/null @@ -1,8 +0,0 @@ -/* frontend fails with empty switch */ - -int main(int argc, char **argv) -{ - switch(argc) { - } - return 0; -} diff --git a/ir/be/test/fehler085.c b/ir/be/test/fehler085.c deleted file mode 100644 index 4d24cbfb0..000000000 --- a/ir/be/test/fehler085.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef struct TypeToken { - unsigned int handle; - unsigned short DbId; - unsigned short CoreDbId; -} TokenType; - -extern TokenType NullToken; -TokenType NullToken = {0, 0, 0}; - -int main(int argc, char **argv) -{ - TokenType t = NullToken; - - return t.handle; -} diff --git a/ir/be/test/fehler086.c b/ir/be/test/fehler086.c deleted file mode 100644 index fd2e92b3d..000000000 --- a/ir/be/test/fehler086.c +++ /dev/null @@ -1,13 +0,0 @@ -int w[] = { 1, 2, 3 }; -int *x = w; - -int f(long long a) -{ - return x[a]; -} - -int main(void) -{ - printf("%d (should be 2)\n", f(1)); - return 0; -} diff --git a/ir/be/test/fehler087.c b/ir/be/test/fehler087.c deleted file mode 100644 index af7365268..000000000 --- a/ir/be/test/fehler087.c +++ /dev/null @@ -1,12 +0,0 @@ -/* there's no 64bit fst without pop */ - -double z = 0.0; -unsigned int x; -double y; - -int main(void) { - x = z; - y = z; - - return x; -} diff --git a/ir/be/test/fehler088.c b/ir/be/test/fehler088.c deleted file mode 100644 index 460e17b59..000000000 --- a/ir/be/test/fehler088.c +++ /dev/null @@ -1,12 +0,0 @@ -/*$ -fno-inline $*/ - -int test(unsigned int a) -{ - return a > 0; -} - -int main(void) -{ - printf("0xFFFFFFFFU > 0 is %d (should be 1)\n", test(0xFFFFFFFFU)); - return 0; -} diff --git a/ir/be/test/fehler089.c b/ir/be/test/fehler089.c deleted file mode 100644 index 4202a2428..000000000 --- a/ir/be/test/fehler089.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -unsigned long long x = 43; - -int main(void) { - printf("Res: %lld (should be 42)\n", x - 1); - return 0; -} diff --git a/ir/be/test/fehler090.c b/ir/be/test/fehler090.c deleted file mode 100644 index 468d50689..000000000 --- a/ir/be/test/fehler090.c +++ /dev/null @@ -1,11 +0,0 @@ -unsigned int x = 12345; - -int main(int argc, char **argv) -{ - unsigned short k = ~x; - char b1 = k & 0xff; - char b2 = k >> 8; - - printf("%d %d\n", b1, b2); - return 0; -} diff --git a/ir/be/test/fehler091.c b/ir/be/test/fehler091.c deleted file mode 100644 index d44c95fc7..000000000 --- a/ir/be/test/fehler091.c +++ /dev/null @@ -1,22 +0,0 @@ -/*$ -fdeconv $*/ -/* frontend sometimes produces 16bit operations which the backend can't handle - * correctly (yet) - */ -#include - -unsigned int k = 1; - -int main(void) -{ - unsigned short x = k; - - x += 0xffff; - x >>= 15; - if(x == 0) { - printf("ok\n"); - return 0; - } else { - printf("bad\n"); - return 1; - } -} diff --git a/ir/be/test/fehler092.c b/ir/be/test/fehler092.c deleted file mode 100644 index e2c2d7465..000000000 --- a/ir/be/test/fehler092.c +++ /dev/null @@ -1,19 +0,0 @@ -/* fehler92: localopt messing up const/tarval modes */ -#include - -int main(int argc, char **argv) -{ - unsigned int x; - int y = 3; - - if(argc > 1) { - rand(); - x = 20; - } else { - x = 10; - } - y <<= x; - - printf("Res: %d\n", y); - return 0; -} diff --git a/ir/be/test/fehler093.c b/ir/be/test/fehler093.c deleted file mode 100644 index a31ac7c44..000000000 --- a/ir/be/test/fehler093.c +++ /dev/null @@ -1,29 +0,0 @@ -typedef struct K K; -struct K { - int dummy; - int high; - int low; -}; - -K v = { 0, 0, -1 }; -K c = { 0, 0, 4 }; - -#define H(A) (A)->high -#define L(A) (A)->low - -#define LTU(A, B) \ - (((unsigned) H(A) < (unsigned) H(B)) || (((unsigned) H(A) == (unsigned) (H(B))) && ((unsigned) L(A) < (unsigned) L(B)))) - -K *p_v = &v; -K *p_c = &c; - -int main(void) { - K* pv = p_v; - K* pc = p_c; - int res; - - res = LTU(pv,pc); - - printf("Res: %d (should be 0)\n", res); - return 0; -} diff --git a/ir/be/test/fehler094.c b/ir/be/test/fehler094.c deleted file mode 100644 index 3bf2c0fae..000000000 --- a/ir/be/test/fehler094.c +++ /dev/null @@ -1,25 +0,0 @@ -/*$ -fno-inline $*/ -#include - -struct decompostition { - int a, b; -}; - -static struct decompostition do_something(void) -{ - struct decompostition c; - rand(); - return c; -} - -int main(void) { - int arr[5]; - struct decompostition dc; - - arr[0] = 123; - arr[1] = 245; - dc = do_something(); - printf("%d %d\n", arr[0], arr[1]); - - return 0; -} diff --git a/ir/be/test/fehler095.c b/ir/be/test/fehler095.c deleted file mode 100644 index 112c9c532..000000000 --- a/ir/be/test/fehler095.c +++ /dev/null @@ -1,8 +0,0 @@ -#define SIZE 268435456 -char too_long_for_firm[SIZE]; - -int main(int argc, char **argv) -{ - too_long_for_firm[SIZE-1] = '\0'; - return 0; -} diff --git a/ir/be/test/fehler096.c b/ir/be/test/fehler096.c deleted file mode 100644 index 11fb15129..000000000 --- a/ir/be/test/fehler096.c +++ /dev/null @@ -1,16 +0,0 @@ -int shrs1(unsigned x) { - return -(x >> 31); -} - -int shr1(int x) { - return -(x >> 31); -} - -int main(void) -{ - printf("%d (should be -1)\n", shrs1(-3)); - printf("%d (should be 1)\n", shr1(-3)); - printf("%d (should be 0)\n", shrs1(3)); - printf("%d (should be 0)\n", shr1(3)); - return 0; -} diff --git a/ir/be/test/fehler097.c b/ir/be/test/fehler097.c deleted file mode 100644 index b2526db6b..000000000 --- a/ir/be/test/fehler097.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -unsigned MediumSize = 4096; -unsigned ObjSize = 136; -unsigned RgnEntrys = 30; -unsigned AllocEntrys = 26000; -//unsigned RgnEntrys = 30; -//unsigned AllocRgns = 866; - -int main(void) -{ - unsigned RgnEntrys = MediumSize / ObjSize; - unsigned AllocRgns = AllocEntrys / RgnEntrys; - - printf("Red. %u %u\n", RgnEntrys, AllocRgns); - return 0; -} diff --git a/ir/be/test/fehler098.c b/ir/be/test/fehler098.c deleted file mode 100644 index 3d2225c4e..000000000 --- a/ir/be/test/fehler098.c +++ /dev/null @@ -1,12 +0,0 @@ -char str[42]; - -int test(void) -{ - return str != 0; -} - -int main(void) -{ - printf("%d (should be 1)\n", test()); - return 0; -} diff --git a/ir/be/test/fehler099.c b/ir/be/test/fehler099.c deleted file mode 100644 index 9b79f76be..000000000 --- a/ir/be/test/fehler099.c +++ /dev/null @@ -1,12 +0,0 @@ -int c = 16; - -unsigned long long test(int c) -{ - return 0xFFFFFFFFFFFFFFFFULL >> c; -} - -int main(void) -{ - printf("0x%016llX (should be 0x0000FFFFFFFFFFFF)\n", test(c)); - return 0; -} diff --git a/ir/be/test/fehler100.c b/ir/be/test/fehler100.c deleted file mode 100644 index f8d1037b3..000000000 --- a/ir/be/test/fehler100.c +++ /dev/null @@ -1,27 +0,0 @@ -/* test for the spiller */ -int incs[14]; - -void simpleSort ( int lo, int hi, int d ) -{ - int i, j, h, bigN, hp; - int v; - - for (; hp >= 0; hp--) { - h = incs[hp]; - if (hp >= 5) - putchar(lo); - - i = lo + h; - while (1) { - if (i > hi) break; - j = i; - while (putchar(d)) { - j = j - h; - } - } - } -} - -int main(void) { - return 0; -} diff --git a/ir/be/test/fehler101.c b/ir/be/test/fehler101.c deleted file mode 100644 index 08027a0e0..000000000 --- a/ir/be/test/fehler101.c +++ /dev/null @@ -1,7 +0,0 @@ -long double l; - -int main(void) { - l = l + 1.0; - printf("%llf\n", l); - return 0; -} diff --git a/ir/be/test/fehler102.c b/ir/be/test/fehler102.c deleted file mode 100644 index 5d7b52db5..000000000 --- a/ir/be/test/fehler102.c +++ /dev/null @@ -1,14 +0,0 @@ -/*$ -fdeconv -fif-conv $*/ - -char abs_Bs(char x) -{ - if (x < 0) x *= -1; - return x; -} - -char c = -23; - -int main(void) -{ - printf("%d\n", abs_Bs(c)); -} diff --git a/ir/be/test/fehler103.c b/ir/be/test/fehler103.c deleted file mode 100644 index 122e9747e..000000000 --- a/ir/be/test/fehler103.c +++ /dev/null @@ -1,9 +0,0 @@ -unsigned long long test_shld(unsigned x) -{ - return ((unsigned long long)x << 32 | x) << x; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler104.c b/ir/be/test/fehler104.c deleted file mode 100644 index 69d0ad26f..000000000 --- a/ir/be/test/fehler104.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "dumpmem.h" - -struct Bla { - char a : 2; - short b : 15; - int c : 1; -}; - -struct Bla b = { 0, -1, 0 }; - -int main(void) -{ - dumpMem(&b, sizeof(struct Bla)); - printf("Sizeof %d\n", sizeof(struct Bla)); - printf("Vals: %d %d %d\n", b.a, b.b, b.c); - return 0; -} diff --git a/ir/be/test/fehler105.c b/ir/be/test/fehler105.c deleted file mode 100644 index c09bb42ce..000000000 --- a/ir/be/test/fehler105.c +++ /dev/null @@ -1,13 +0,0 @@ -/* frontend crashs on missing return in compound returning function */ -struct A { - int a, b; -}; - -struct A func(void) -{ -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler106.c b/ir/be/test/fehler106.c deleted file mode 100644 index cedcab752..000000000 --- a/ir/be/test/fehler106.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -long long k = 0x100000000LL; - -double f(void) { - return k; -} - -int main(void) { - printf("Res: %f\n", f()); - return 0; -} diff --git a/ir/be/test/fehler107.c b/ir/be/test/fehler107.c deleted file mode 100644 index 9ba67b538..000000000 --- a/ir/be/test/fehler107.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -double k = 4294967296.000000; - -long long f(void) { - return k; -} - -int main(void) { - printf("Res: %llx\n", f()); - return 0; -} diff --git a/ir/be/test/fehler108.c b/ir/be/test/fehler108.c deleted file mode 100644 index 091a80d99..000000000 --- a/ir/be/test/fehler108.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int f(void) { - return 42; -} - -int (*f_ptr) (void) = &f; - -int main(void) { - (**printf)("Res: %d (should be 42)\n", (********f_ptr)()); - return 0; -} diff --git a/ir/be/test/fehler109.c b/ir/be/test/fehler109.c deleted file mode 100644 index ea0779ad0..000000000 --- a/ir/be/test/fehler109.c +++ /dev/null @@ -1,34 +0,0 @@ -int puts(const char *str); - -void p(void) -{ - puts("p"); -} - -void q(void) -{ - puts("q"); -} - -void f(int x, long long y) { - if (x) { - if (y) - p(); - if(!y) - q(); - } else { - if (y) - q(); - if(!y) - p(); - } -} - -int main(void) -{ - f(40, 4); - f(0, 1); - f(0, 0); - f(41, 0); - return 0; -} diff --git a/ir/be/test/fehler110.c b/ir/be/test/fehler110.c deleted file mode 100644 index 9c919f54c..000000000 --- a/ir/be/test/fehler110.c +++ /dev/null @@ -1,35 +0,0 @@ -struct A { - int a, b, c; -}; - -struct A globa = { 1, 2, 3 }; - -struct A funk(void) { - struct A res; - - res.a = globa.c + 20; - res.b = globa.b + 20; - res.c = globa.a + 20; - - return res; -} - -struct A funk2(void) { - struct A res; - - memcpy(&res, &globa, sizeof(res)); - - res.a -= 20; - res.b -= 20; - res.c -= 20; - - return res; -} - -int main(void) { - globa = funk(); - printf("%d %d %d\n", globa.a, globa.b, globa.c); - globa = funk2(); - printf("%d %d %d\n", globa.a, globa.b, globa.c); - return 0; -} diff --git a/ir/be/test/fehler111.c b/ir/be/test/fehler111.c deleted file mode 100644 index d698c236a..000000000 --- a/ir/be/test/fehler111.c +++ /dev/null @@ -1,11 +0,0 @@ -int x = 0; - -int main(int argc, char *argv[]) { - int y; - char *p = &x; - - *p = 23; - y = x; - x = 35; - return y != 23; -} diff --git a/ir/be/test/fehler112.c b/ir/be/test/fehler112.c deleted file mode 100644 index 28689a91a..000000000 --- a/ir/be/test/fehler112.c +++ /dev/null @@ -1,16 +0,0 @@ -int FirstOne(long long arg1) -{ - union doub { - unsigned short i[4]; - long long d; - }; - - union doub x; - x.d = arg1; - return x.i[2]; -} - -int main(void) -{ - return FirstOne(0); -} diff --git a/ir/be/test/fehler113.c b/ir/be/test/fehler113.c deleted file mode 100644 index 82d21490a..000000000 --- a/ir/be/test/fehler113.c +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef CHAR_BIT -#define CHAR_BIT 8 -#endif - -#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) -#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) - -/* This is NOT folded into a ROL, but demonstrates an error in old lowering */ -long long testLL(long long a) { - return ROL(a,3); -} - -int main() { - int printf(const char *fmt, ...); - - printf("%lld\n", testLL(1)); - return 0; -} diff --git a/ir/be/test/fehler114.c b/ir/be/test/fehler114.c deleted file mode 100644 index 26c4fc08b..000000000 --- a/ir/be/test/fehler114.c +++ /dev/null @@ -1,11 +0,0 @@ -unsigned x = 0xAABBCCDD; -unsigned y = 15; -unsigned z = 12; - -int main(void) { - unsigned t = x; - unsigned t2 = y; - unsigned l = z; - printf("%X\n", (t << t2) | (t >> (32 - l))); - return 0; -} diff --git a/ir/be/test/fehler115.c b/ir/be/test/fehler115.c deleted file mode 100644 index fe574ff5a..000000000 --- a/ir/be/test/fehler115.c +++ /dev/null @@ -1,8 +0,0 @@ -int test(float x, double y) { - return x + y; -} - -int main() { - printf("%d (expected 15)\n", test(7.753f, 8.222)); - return 0; -} diff --git a/ir/be/test/fehler116.c b/ir/be/test/fehler116.c deleted file mode 100644 index da65a4c83..000000000 --- a/ir/be/test/fehler116.c +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) { - float fy=3; - int c = 7 * fy; - - printf("21 == %d \n", c); - return 0; -} diff --git a/ir/be/test/fehler117.c b/ir/be/test/fehler117.c deleted file mode 100644 index ec7b0d4e5..000000000 --- a/ir/be/test/fehler117.c +++ /dev/null @@ -1,6 +0,0 @@ -double x = 4294967295.0; - -int main(void) { - printf("%u (should be 4294967295)\n", (unsigned int)x); - return 0; -} diff --git a/ir/be/test/fehler118.c b/ir/be/test/fehler118.c deleted file mode 100644 index 26d3432cc..000000000 --- a/ir/be/test/fehler118.c +++ /dev/null @@ -1,21 +0,0 @@ -/*$ -fcombo $*/ -#include - -char *test(char *name) { - char *p, *trunc = NULL; - int plen; - int min_part = 3; - do { - p = name; - while (*p) { - plen = 3; - p += plen; - if (plen > min_part) trunc = p-1; - } - } while (trunc == NULL && --min_part != 0); - return p; -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler119.c b/ir/be/test/fehler119.c deleted file mode 100644 index 622eee96f..000000000 --- a/ir/be/test/fehler119.c +++ /dev/null @@ -1,10 +0,0 @@ -/*$ -std=c99 $*/ -int f(int x) -{ - return sizeof(char*[x]); -} - -int main(void) -{ - return f(23) != sizeof(char*) * 23; -} diff --git a/ir/be/test/fehler120.c b/ir/be/test/fehler120.c deleted file mode 100644 index 8b8fd1d7f..000000000 --- a/ir/be/test/fehler120.c +++ /dev/null @@ -1,11 +0,0 @@ -/*$ -fno-inline $*/ - -int f(float x) -{ - return 1 << (int)x; -} - -int main(void) -{ - return f(3.0) != 8; -} diff --git a/ir/be/test/fehler121.c b/ir/be/test/fehler121.c deleted file mode 100644 index 2c65fe6b9..000000000 --- a/ir/be/test/fehler121.c +++ /dev/null @@ -1,13 +0,0 @@ -int main(int argc, char *argv[]) -{ - switch(argc) - { - case 0x666d7420: // 'fmt ' - return 1; - case 0x4c495354: // 'LIST' - return 2; - default: - break; - } - return 0; -} diff --git a/ir/be/test/fehler122.c b/ir/be/test/fehler122.c deleted file mode 100644 index 259a6d966..000000000 --- a/ir/be/test/fehler122.c +++ /dev/null @@ -1,17 +0,0 @@ -/*$ -fcombo $*/ -int *zptr; - -#define swap(lv1, lv2) \ - { int tmp = lv1; lv1 = lv2; lv2 = tmp; } - -void vswap ( int p1, int p2, int n ) -{ - while (n > 0) { - swap(zptr[p1], zptr[p2]); - p1++; p2++; n--; - } -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler123.c b/ir/be/test/fehler123.c deleted file mode 100644 index 5a5df2c8e..000000000 --- a/ir/be/test/fehler123.c +++ /dev/null @@ -1,10 +0,0 @@ -int x = 23; - -int main(void) -{ - int a = x + 19; - double b = a; - x = b; - printf("%d\n", x); - return 0; -} diff --git a/ir/be/test/fehler124.c b/ir/be/test/fehler124.c deleted file mode 100644 index 675cb8181..000000000 --- a/ir/be/test/fehler124.c +++ /dev/null @@ -1,11 +0,0 @@ -int x = 0x5FFFFFFF; - -int main(void) -{ - double a = x; - float b = a; - double c = b; - x = c; - printf("%f %f %f %d\n", a, b, c, x); - return 0; -} diff --git a/ir/be/test/fehler125.c b/ir/be/test/fehler125.c deleted file mode 100644 index fda7aa876..000000000 --- a/ir/be/test/fehler125.c +++ /dev/null @@ -1,9 +0,0 @@ -asm( - "bla:\n" - ".long 0" -); -extern int bla; -int main() -{ - return bla; -} diff --git a/ir/be/test/fehler126.c b/ir/be/test/fehler126.c deleted file mode 100644 index 6561cb488..000000000 --- a/ir/be/test/fehler126.c +++ /dev/null @@ -1,12 +0,0 @@ -int x; - -int -main () -{ - if (x) { - struct s { int j; }; - struct s *b; b->j = 5; - } - - return 0; -} diff --git a/ir/be/test/fehler127.c b/ir/be/test/fehler127.c deleted file mode 100644 index a759de7b3..000000000 --- a/ir/be/test/fehler127.c +++ /dev/null @@ -1,7 +0,0 @@ -int main() -{ - if (0) { - long (*foo) (long, long) = __builtin_expect; - } - return 0; -} diff --git a/ir/be/test/fehler128.c b/ir/be/test/fehler128.c deleted file mode 100644 index 5f60a6d68..000000000 --- a/ir/be/test/fehler128.c +++ /dev/null @@ -1,22 +0,0 @@ -/*$ -march=i686 $*/ - -double __attribute__((__cdecl__)) atof (const char *__nptr); - -int a; -char *str; - -void GIB_Range_f (void) -{ - double i, inc = 9, limit = 42; - if (a == 4) { - inc = atof(str); - if(inc == 0) return; - } - for (i = atof (str); inc < 0 ? i >= limit : i <= limit; i += inc) { - } -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler129.c b/ir/be/test/fehler129.c deleted file mode 100644 index d221a5b0a..000000000 --- a/ir/be/test/fehler129.c +++ /dev/null @@ -1,7 +0,0 @@ -char x; -char *p = &x; -int y = 0; - -int main(void) { - return (&x) - (p - y); -} diff --git a/ir/be/test/fehler130.c b/ir/be/test/fehler130.c deleted file mode 100644 index 049cbbbe7..000000000 --- a/ir/be/test/fehler130.c +++ /dev/null @@ -1,29 +0,0 @@ -/*$ -fcombo $*/ -static int bi_valid; -static int bi_buf = 0; - -int outbuf; - -#define Buf_size (8 * 2*sizeof(char)) - -#define put_byte(c) {outbuf=(unsigned char)(c); } - -#define put_short(w) \ -{ if (outcnt > 0) { \ - outbuf = (unsigned char) (w); \ - }\ -} - -void send_bits(int value) { - if (bi_valid > 0) { - bi_buf |= bi_valid; - if (outbuf > 0) { - outbuf = bi_buf; - } - bi_buf = value; - } -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler131.c b/ir/be/test/fehler131.c deleted file mode 100644 index 9cf14b9f9..000000000 --- a/ir/be/test/fehler131.c +++ /dev/null @@ -1,6 +0,0 @@ -void* p; - -int main(void) -{ - return p + 1 == p; -} diff --git a/ir/be/test/fehler132.c b/ir/be/test/fehler132.c deleted file mode 100644 index bdf6084b0..000000000 --- a/ir/be/test/fehler132.c +++ /dev/null @@ -1,16 +0,0 @@ -unsigned long long f(void) -{ - unsigned long long res; - asm( - "mul %2\n\t" - : "=A" (res) - : "a" (0x10000), "r" (0x10000) - ); - return res; -} - -int main(void) -{ - printf("0x%llX\n", f()); - return 0; -} diff --git a/ir/be/test/fehler133.c b/ir/be/test/fehler133.c deleted file mode 100644 index e1663f9ef..000000000 --- a/ir/be/test/fehler133.c +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - int x = 19; - asm("addl $23, %0" : "+r" (x)); - printf("%d\n", x); - return x != 42; -} diff --git a/ir/be/test/fehler134.c b/ir/be/test/fehler134.c deleted file mode 100644 index c97443ca5..000000000 --- a/ir/be/test/fehler134.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int x = 1; - asm("movl $0, %0" : "=m" (x)); - return x; -} diff --git a/ir/be/test/fehler135.c b/ir/be/test/fehler135.c deleted file mode 100644 index 3c890f2c2..000000000 --- a/ir/be/test/fehler135.c +++ /dev/null @@ -1,16 +0,0 @@ -/*$ -fcombo $*/ - -int test() { - int i, j; - - for (i = 0, j = 0; i < 5; ++i, ++j); - - while (i == j) { - /* endless */ - } - return i; -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler136.c b/ir/be/test/fehler136.c deleted file mode 100644 index b0c162404..000000000 --- a/ir/be/test/fehler136.c +++ /dev/null @@ -1,15 +0,0 @@ -struct X -{ - int x; -}; - -extern const struct X bla; - -struct X const* const blub[] = { &bla }; - -struct X const bla = { 23 }; - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler137.c b/ir/be/test/fehler137.c deleted file mode 100644 index 170dd1618..000000000 --- a/ir/be/test/fehler137.c +++ /dev/null @@ -1,7 +0,0 @@ -long double ld = 1; - -int main(void) -{ - printf("%Lf (1.000000)\n", ld); - return 0; -} diff --git a/ir/be/test/fehler138.c b/ir/be/test/fehler138.c deleted file mode 100644 index 4578c05e6..000000000 --- a/ir/be/test/fehler138.c +++ /dev/null @@ -1,12 +0,0 @@ -long long a; -long long b; - -long long f(void) -{ - return a - b; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler139.c b/ir/be/test/fehler139.c deleted file mode 100644 index d644aef04..000000000 --- a/ir/be/test/fehler139.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -long long test(long long *i, int *p) { - long long v = *i + (*p != 0); - return v; -} - -int main() { - long long x = 0xFFFFFFFF; - int i = 5; - printf("%llx\n", test(&x, &i)); - return 0; -} diff --git a/ir/be/test/fehler140.c b/ir/be/test/fehler140.c deleted file mode 100644 index c3c181c3d..000000000 --- a/ir/be/test/fehler140.c +++ /dev/null @@ -1,18 +0,0 @@ -/*$ -fgvn-pre -fno-gcse $*/ -char arr[256]; -char X; - -int test(int x, int p) { - int y = 0; - if (x) { - y = 1; - } - do { - ++y; - X = arr[y]; - } while (p); -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler141.c b/ir/be/test/fehler141.c deleted file mode 100644 index 68599d4e8..000000000 --- a/ir/be/test/fehler141.c +++ /dev/null @@ -1,18 +0,0 @@ -/*$ -fgvn-pre -fno-gcse $*/ -int bl_count[256]; - -int test(int max_length, int overflow) { - int bits; - - do { - bits = max_length-1; - while (bl_count[bits] == 0) bits--; - bl_count[bits]--; /* move one leaf down the tree */ - bl_count[bits+1] += 2; /* move one overflow item as its brother */ - } while (overflow > 0); - return 0; -} - -int main() { - return 0; -} diff --git a/ir/be/test/fehler142.c b/ir/be/test/fehler142.c deleted file mode 100644 index 095399ba9..000000000 --- a/ir/be/test/fehler142.c +++ /dev/null @@ -1,10 +0,0 @@ -float foo(float zNear, float zFar) -{ - float depth = zFar - zNear; - - return -2 * zFar * zNear / depth; -} - -int main(void) { - return foo(4, 2048) >= 0; -} diff --git a/ir/be/test/fehler143.c b/ir/be/test/fehler143.c deleted file mode 100644 index 56e211dfc..000000000 --- a/ir/be/test/fehler143.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -void f(int x) -{ - assert(x < 0); -} - -void handler(int sig) -{ - (void)sig; - _exit(0); -} - -int main(void) -{ - signal(SIGABRT, handler); - f(1); - return 1; -} diff --git a/ir/be/test/fehler144.c b/ir/be/test/fehler144.c deleted file mode 100644 index c12d08b22..000000000 --- a/ir/be/test/fehler144.c +++ /dev/null @@ -1,7 +0,0 @@ -int x=42,y=42; - -int main(void) { - int ret = x & y ? 0:1; - printf("%d\n", ret); - return ret; -} diff --git a/ir/be/test/fehler145.c b/ir/be/test/fehler145.c deleted file mode 100644 index 5e8f8cc91..000000000 --- a/ir/be/test/fehler145.c +++ /dev/null @@ -1,15 +0,0 @@ -#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) - -float A, B, C; - -void f(float r, float g, float b) { - A = r; B = g; C = b; -} - -void bla(int r, int g, int b) { - f(INT_TO_FLOAT(r), INT_TO_FLOAT(g), INT_TO_FLOAT(b)); -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/ir/be/test/fehler146.c b/ir/be/test/fehler146.c deleted file mode 100644 index ef73d92cd..000000000 --- a/ir/be/test/fehler146.c +++ /dev/null @@ -1,9 +0,0 @@ -int *p; - -int main(int argc, char **argv) { - return 0; -} - -int f(int a) { - return p[a]; -} diff --git a/ir/be/test/fehler147.c b/ir/be/test/fehler147.c deleted file mode 100644 index de69b5f65..000000000 --- a/ir/be/test/fehler147.c +++ /dev/null @@ -1,18 +0,0 @@ -float g = 0.098; - -#define myftol(x) ((int)(x)) - -void foo(unsigned char *colors) { - int v; - float glow = g; - - v = myftol(255*glow); - colors[0] = colors[1] = colors[2] = v; -} - -int main(void) { - unsigned char colors[3]; - foo(colors); - printf("%d %d %d\n", colors[0], colors[1], colors[2]); - return 0; -} diff --git a/ir/be/test/fehler148.c b/ir/be/test/fehler148.c deleted file mode 100644 index 1dcdf106d..000000000 --- a/ir/be/test/fehler148.c +++ /dev/null @@ -1,48 +0,0 @@ -#define NE 6 - -/* Number of 16 bit words in internal format */ -#define NI (NE+3) - -/* Array offset to exponent */ -#define E 1 - -/* Array offset to high guard word */ -#define M 2 - - -static void -eshdn1 (x) - register unsigned short *x; -{ - register unsigned short bits; - int i; - - x += M; /* point to significand area */ - - bits = 0; - for (i = M; i < NI; i++) - { - if (*x & 1) - bits |= 1; - *x >>= 1; - if (bits & 2) - *x |= 0x8000; - bits <<= 1; - ++x; - } - -} - -static int -edivm (den, num) - unsigned short den[], num[]; -{ - eshdn1 (num); -} - -int main(int argc, char *argv[]) { - unsigned short den[NI], num[NI]; - - edivm(den, num); - return 0; -} diff --git a/ir/be/test/fehler149.c b/ir/be/test/fehler149.c deleted file mode 100644 index 0c8bb8de5..000000000 --- a/ir/be/test/fehler149.c +++ /dev/null @@ -1,16 +0,0 @@ -unsigned short tdenm = 0xff; -unsigned int ui = 0xffffffff; - -int test(void) { - - unsigned int tnum = ui; - - /* Do not execute the divide instruction if it will overflow. */ - if ((tdenm * 0xffffL) < tnum) - return 0; - return 1; -} - -int main(int argc, char *argv[]) { - return test(); -} diff --git a/ir/be/test/fehler150.c b/ir/be/test/fehler150.c deleted file mode 100644 index 70212b031..000000000 --- a/ir/be/test/fehler150.c +++ /dev/null @@ -1,23 +0,0 @@ -/*$ -fgvn-pre -fno-gcse $*/ - -#define MAX_SPEC_FD 3 -struct spec_fd_t { - int limit; - int len; - int pos; - unsigned char *buf; -} spec_fd[MAX_SPEC_FD]; - -int spec_load (int num, int size) { - spec_fd[num].len = 0; - while (spec_fd[num].len < size) { - int tmp = size - spec_fd[num].len; - if (tmp > spec_fd[num].len) tmp = spec_fd[num].len; - spec_fd[num].len += tmp; - } - return 0; -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/ir/be/test/fehler151.c b/ir/be/test/fehler151.c deleted file mode 100644 index 5da058f89..000000000 --- a/ir/be/test/fehler151.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int test(void) { - abort(); - - for(;;); -} - -void handler(int sig) -{ - printf(sig == SIGABRT ? "ok\n" : "fail"); - fflush(stdout); - exit(sig != SIGABRT); -} - -int main(int argc, char *argv[]) { - alarm(1); - signal(SIGABRT, handler); - signal(SIGALRM, handler); - test(); - return 1; -} diff --git a/ir/be/test/fehler152.c b/ir/be/test/fehler152.c deleted file mode 100644 index 4f5e9917a..000000000 --- a/ir/be/test/fehler152.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -volatile int x = 2; - -int test(void) { - - x = 3; - - for(;;); -} - -void handler(int sig) -{ - printf(x == 3 ? "ok\n" : "fail"); - fflush(stdout); - exit(x != 3); -} - -int main(int argc, char *argv[]) { - signal(SIGALRM, handler); - alarm(1); - test(); - printf("FAIL ENDLESS LOOP\n"); - return 1; -} diff --git a/ir/be/test/fehler153.c b/ir/be/test/fehler153.c deleted file mode 100644 index 4879e0c70..000000000 --- a/ir/be/test/fehler153.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include - -volatile int x = 2; -volatile int y; - -int test(void) { - - x = 3; - y = 4; - - for(;;) { - x = y; - } -} - -void handler(int sig) -{ - printf(x == 4 ? "ok\n" : "fail"); - fflush(stdout); - exit(x != 4); -} - -int main(int argc, char *argv[]) { - alarm(1); - signal(SIGALRM, handler); - test(); - printf("FAIL ENDLESS LOOP\n"); - return 1; -} diff --git a/ir/be/test/fehler154.c b/ir/be/test/fehler154.c deleted file mode 100644 index f0cc09be7..000000000 --- a/ir/be/test/fehler154.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include - -int foo(int x) -{ - while(x == 0) - ; - - return x; -} - -int k; - -void handler(int sig) -{ - printf("ok\n"); - _exit(0); -} - -int main(void) { - signal(SIGALRM, handler); - alarm(1); - - foo(0); - - printf("endless loop returned!\n"); - return 1; -} diff --git a/ir/be/test/fehler155.c b/ir/be/test/fehler155.c deleted file mode 100644 index 7d572e12d..000000000 --- a/ir/be/test/fehler155.c +++ /dev/null @@ -1,11 +0,0 @@ -struct { - int x; - int lets[3008]; -} glob; - -int x = 42; - -int main(void) { - int y = glob.lets[5] + glob.lets[x * 3]; - return y; -} diff --git a/ir/be/test/fehler156.c b/ir/be/test/fehler156.c deleted file mode 100644 index fe030aa00..000000000 --- a/ir/be/test/fehler156.c +++ /dev/null @@ -1,24 +0,0 @@ -/*$ -fomit-frame-pointer $*/ - -#include - - -unsigned __attribute__((noinline)) get_sp(void) -{ - unsigned esp; - asm("mov %%esp, %0": "=r" (esp)); - return esp; -} - - -int main(void) -{ -#ifndef __INTEL_COMPILER // ICC does not align the stack - unsigned sp = get_sp(); - if (sp % 16 != 12) { - printf("stack is unaligned after call: 0x%X\n", sp); - return 1; - } -#endif - return 0; -} diff --git a/ir/be/test/fehler157.c b/ir/be/test/fehler157.c deleted file mode 100644 index 0c4eb1369..000000000 --- a/ir/be/test/fehler157.c +++ /dev/null @@ -1,9 +0,0 @@ -long long f(unsigned x, unsigned y) -{ - return (long long)x * y >> 32; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler158.c b/ir/be/test/fehler158.c deleted file mode 100644 index 28bf61277..000000000 --- a/ir/be/test/fehler158.c +++ /dev/null @@ -1,23 +0,0 @@ -/*$ -fconfirm -fcond-eval $*/ - -int test(int lnWrd, int *ptExp) { - int idx = 0; - - while ( lnWrd > 0 ) { - if ( *ptExp ) { - *ptExp = 0; - lnWrd--; - } - idx++; - ptExp++; - } - return idx; -} - -int arr[] = { 1, 0, 0, 0, 2, 3, 4}; - -int main(int argc, char *argv[]) { - int x = test(3, arr); - printf("%d\n", x); - return 0; -} diff --git a/ir/be/test/fehler159.c b/ir/be/test/fehler159.c deleted file mode 100644 index d25376a24..000000000 --- a/ir/be/test/fehler159.c +++ /dev/null @@ -1,22 +0,0 @@ -/*$ -fgvn-pre -fno-gcse $*/ - -int test() { - int i; - char inUse16[16]; - - i = 0; - do { - if (rand() == 1) - inUse16[i] = 1; - else - inUse16[i] = 0; - ++i; - } while (i < 16); - - return inUse16[0]; -} - -int main(void) -{ - return 0; -} diff --git a/ir/be/test/fehler161.c b/ir/be/test/fehler161.c deleted file mode 100644 index 6e4bbdd3d..000000000 --- a/ir/be/test/fehler161.c +++ /dev/null @@ -1,14 +0,0 @@ -/*$ -O4 -march=core2 $*/ -#include - -extern void puts(const char *text); - -void test (void) -{ - char *temp = (char *) alloca (16); - puts(temp); -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/ir/be/test/fib.c b/ir/be/test/fib.c deleted file mode 100644 index 6b5e48040..000000000 --- a/ir/be/test/fib.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -unsigned fib(unsigned n) -{ - if(n == 0) { - return 0; - } - if(n == 1) { - return 1; - } - - return fib(n-1) + fib(n-2); -} - -int main(int argc, char** argv) { - unsigned n = 8; - if(argc > 1) - n = (unsigned) atoi(argv[1]); - -#ifdef COUNT_BRANCHES - b1 = b2 = b3 = 0; -#endif - printf("Fib %u: %u\n", n, fib(n)); -#ifdef COUNT_BRANCHES - printf("Branches: 1:%d 2:%d 3:%d\n", b1, b2, b3); -#endif - - return 0; -} diff --git a/ir/be/test/fib_iter.c b/ir/be/test/fib_iter.c deleted file mode 100644 index 7c600f027..000000000 --- a/ir/be/test/fib_iter.c +++ /dev/null @@ -1,27 +0,0 @@ -unsigned long fib_iter(int n) { - unsigned long a = 1, b = 1, c = 0, i; - - if (n < 2) - return 1; - - for (i = 1; i < n; i++) { - c = a + b; - a = b; - b = c; - } - - return c; -} - -int main(int argc, char *argv[]) { - int i, n = 10; - - if (argc > 1) { - n = atoi(argv[1]); - } - - for (i = 0; i <= n; i++) - printf("fib(%d) = %lu\n", i, fib_iter(i)); - - return 0; -} diff --git a/ir/be/test/fisttp.c b/ir/be/test/fisttp.c deleted file mode 100644 index 4fb9729b0..000000000 --- a/ir/be/test/fisttp.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -int test(double f) { - return f; -} - -int arraycopy(double *p, int *q) { - double sum = 0.0; - int i; - - for (i = 0; i < 10; ++i) { - double v = p[i]; - q[i] = v; - sum += v; - } - return sum; -} - -static double data[10] = { - -1.0, +1.0, 1/100.0, -1/100.0, 439023402304342343.0, 30303.0, 0.0 -}; - -int main() { - int res[10], i; - - arraycopy(data, res); - for (i = 0; i < 10; ++i) { - printf("%f -> %d\n", data[i], res[i]); - } - - printf("%d\n", test(45.0)); - return 0; -} diff --git a/ir/be/test/floatcmp.c b/ir/be/test/floatcmp.c deleted file mode 100644 index 93e44984f..000000000 --- a/ir/be/test/floatcmp.c +++ /dev/null @@ -1,152 +0,0 @@ -/*$ -std=c99 $*/ - -#include -#include - -#define test(type, name, op) \ -static void test_##type##_##name(type a, type b) { \ - if (a op b) \ - printf("%f " #op " %f = true\n", a, b); \ - else \ - printf("%f " #op " %f = false\n", a, b); \ -} - -#define testu(type, op) \ -static void test_##type##_##op(type a, type b) { \ - if (op(a,b)) \ - printf(#op "(%f, %f) = true\n", a, b); \ - else \ - printf(#op "(%f, %f) = false\n", a, b); \ -} - -#define testnu(type, op) \ -static void test_##type##_not##op(type a, type b) { \ - if (!op(a,b)) \ - printf("!" #op "(%f, %f) = true\n", a, b); \ - else \ - printf("!" #op "(%f, %f) = false\n", a, b); \ -} - -test(float, l, <) -test(float, le, <=) -test(float, eq, ==) -test(float, ge, >=) -test(float, g, >) -test(float, lg, !=) - -testu(float, isgreater) -testu(float, isgreaterequal) -testu(float, isless) -testu(float, islessequal) -testu(float, islessgreater) -testu(float, isunordered) - -testnu(float, isgreater) -testnu(float, isgreaterequal) -testnu(float, isless) -testnu(float, islessequal) -testnu(float, islessgreater) -testnu(float, isunordered) - -/*-------------------------- */ -test(double, l, <) -test(double, le, <=) -test(double, eq, ==) -test(double, ge, >=) -test(double, g, >) -test(double, lg, !=) - -testu(double, isgreater) -testu(double, isgreaterequal) -testu(double, isless) -testu(double, islessequal) -testu(double, islessgreater) -testu(double, isunordered) - -testnu(double, isgreater) -testnu(double, isgreaterequal) -testnu(double, isless) -testnu(double, islessequal) -testnu(double, islessgreater) -testnu(double, isunordered) - -#undef test - -double dA = 3.0, dB = 4.0, dNan = NAN; -float fA = 3.0, fB = 4.0, fNan = NAN; - -int main() { -#define test(type, name, a, b) test_##type##_##name(a,b) - - test(float, l, fA, fB); - test(float, le, fA, fB); - test(float, eq, fA, fB); - test(float, ge, fA, fB); - test(float, g, fA, fB); - test(float, lg, fA, fB); - test(float, l, fA, fNan); - test(float, le, fA, fNan); - test(float, eq, fA, fNan); - test(float, ge, fA, fNan); - test(float, g, fA, fNan); - test(float, lg, fA, fNan); - test(float, lg, fNan, fNan); - - test(float, isgreater, fA, fB); - test(float, isgreaterequal, fA, fB); - test(float, isless, fA, fB); - test(float, islessequal, fA, fB); - test(float, islessgreater, fA, fB); - test(float, isunordered, fA, fB); - test(float, isgreater, fA, fNan); - test(float, isgreaterequal, fA, fNan); - test(float, isless, fA, fNan); - test(float, islessequal, fA, fNan); - test(float, islessgreater, fA, fNan); - test(float, isunordered, fA, fNan); - test(double, islessgreater, fA, fB); - test(float, islessgreater, fNan, fNan); - - test(float, notisgreater, fA, fNan); - test(float, notisgreaterequal, fA, fNan); - test(float, notisless, fA, fNan); - test(float, notislessequal, fA, fNan); - test(float, notislessgreater, fA, fNan); - test(float, notisunordered, fA, fNan); - - test(double, l, dA, dB); - test(double, le, dA, dB); - test(double, eq, dA, dB); - test(double, ge, dA, dB); - test(double, g, dA, dB); - test(double, lg, dA, dB); - test(double, l, dA, dNan); - test(double, le, dA, dNan); - test(double, eq, dA, dNan); - test(double, ge, dA, dNan); - test(double, g, dA, dNan); - test(double, lg, dA, dNan); - test(double, lg, dNan, dNan); - - test(double, isgreater, dA, dB); - test(double, isgreaterequal, dA, dB); - test(double, isless, dA, dB); - test(double, islessequal, dA, dB); - test(double, islessgreater, dA, dB); - test(double, isunordered, dA, dB); - test(double, isgreater, dA, dNan); - test(double, isgreaterequal, dA, dNan); - test(double, isless, dA, dNan); - test(double, islessequal, dA, dNan); - test(double, islessgreater, dA, dNan); - test(double, isunordered, dA, dNan); - test(double, islessgreater, dA, dB); - test(double, islessgreater, dNan, dNan); - - test(double, notisgreater, dA, dNan); - test(double, notisgreaterequal, dA, dNan); - test(double, notisless, dA, dNan); - test(double, notislessequal, dA, dNan); - test(double, notislessgreater, dA, dNan); - test(double, notisunordered, dA, dNan); -} diff --git a/ir/be/test/func_arg.c b/ir/be/test/func_arg.c deleted file mode 100644 index ab180a500..000000000 --- a/ir/be/test/func_arg.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -void mymain(int argc, const char * const*argv) { - printf("A0: %s AC: %d\n", argv[0], argc); -} - -int main(argc, argv) - int argc; - char **argv; -{ - const char *args[] = { "blup", "bla" }; - - mymain(2, args); - return 0; -} diff --git a/ir/be/test/functest.c b/ir/be/test/functest.c deleted file mode 100644 index c302a71d0..000000000 --- a/ir/be/test/functest.c +++ /dev/null @@ -1,6 +0,0 @@ -int main() { - printf("My __func__ name is %s\n", __func__); - printf("My __FUNCTION__name is %s\n", __FUNCTION__); - printf("My __PRETTY_FUNCTION__name is %s\n", __PRETTY_FUNCTION__); - return 0; -} diff --git a/ir/be/test/gcd.c b/ir/be/test/gcd.c deleted file mode 100644 index 00d764563..000000000 --- a/ir/be/test/gcd.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -int gcd(int a, int b) -{ - int i = 0; - - while(a != b) - { - if(a > b) { - a = a - b; - } - else { - b = b - a; - } - ++i; - } - return a; -} - -int main(int argc, char** argv) -{ - int a = 49, b = 35, i, g = 0; - - if(argc > 2) { - a = atoi(argv[1]); - b = atoi(argv[2]); - } - - printf("gcd.c\n"); - - for (i = 0; i < 100000; i++) { - g = gcd(a, b); - } - - printf(" GCD of %d and %d is %d\n", a, b, g); - - return 0; -} diff --git a/ir/be/test/gcd_bench.c b/ir/be/test/gcd_bench.c deleted file mode 100644 index a88f8e007..000000000 --- a/ir/be/test/gcd_bench.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include - -int gcd(int a, int b) -{ - int i = 0; - - while(a != b) - { - if(a > b) { - a = a - b; - } - else { - b = b - a; - } - ++i; - } - return a; -} - -void gcd_no_out(int numruns) { - int i, j; - - for (i = 1; i < numruns; i++) { - for (j = 1; j < numruns; j++) { - gcd(i, j); - } - } -} - -void gcd_out(int numruns) { - int i, j; - - for (i = 1; i < numruns; i++) { - for (j = 1; j < numruns; j++) { - printf("gcd(%d, %d) = %d\n", i, j, gcd(i, j)); - } - } -} - -int main(int argc, char **argv) -{ - printf("gcd.c\n"); - - if (argc == 1) { - gcd_out(10); - } - else { - int numruns = 1000; - numruns = atoi(argv[1]); - gcd_out(numruns); - } - - return 0; -} diff --git a/ir/be/test/global_null_test.c b/ir/be/test/global_null_test.c deleted file mode 100644 index 4e28c5a02..000000000 --- a/ir/be/test/global_null_test.c +++ /dev/null @@ -1,24 +0,0 @@ -static void f1(void) { - printf("f1\n"); -} - -static void f2(void) { - printf("f2\n"); -} - -int test(char *x) -{ - char ret = *x; - - if (x) - f1(); - else - f2(); - return ret; -} - -int main(int argc, char *argv[]) { - char x = '\0'; - - return test(&x); -} diff --git a/ir/be/test/globalrefs.c b/ir/be/test/globalrefs.c deleted file mode 100644 index e4247a93f..000000000 --- a/ir/be/test/globalrefs.c +++ /dev/null @@ -1,64 +0,0 @@ -/* globalrefs.c - Test symbolic constant expressions constructed from - * global addresses and index expressions into global addresses. - * Do this both with global constants and with inline constant. - * Instead of printing absolute addresses, print out the differences in - * memory addresses to get output that matches that of the native compiler. - */ - -#include - -#define __STDC_LIMIT_MACROS 1 -#include - -struct test { - long A; - struct { unsigned X; unsigned Y; } S; - struct test* next; -}; - -struct test TestArray[10]; -struct test Test1; - -/* Create global symbolic constants from the addresses of the above globals */ - -struct test* TestArrayPtr = &TestArray[3]; -long* Aptr = &Test1.A; -unsigned* Yptr = &Test1.S.Y; -struct test** NextPtr = &Test1.next; - -void -printdiff(void* p1, void* p2) -{ - printf(" %d", (int)((unsigned long) p1 - (unsigned long) p2)); -} - -int -main(int argc, char** argv) -{ - unsigned long diff1, diff2, diff3, diff4; - - printf("sizeof(struct Test) = %d\n\n", (int)sizeof(struct test)); - - printdiff(&TestArray[3], TestArray); - printdiff(&Test1.S.Y, &Test1.A); - printdiff(&Test1.next, &Test1.S.Y); - printf("\n"); - - diff1 = (unsigned long) &TestArray[3] - (unsigned long) TestArray; - diff3 = (unsigned long) &Test1.S.Y - (unsigned long) &Test1.A; - diff4 = (unsigned long) &Test1.next - (unsigned long) &Test1.S.Y; - - printf("&TestArray[3] - TestArray = 0x%lx\n", diff1); - printf("Xptr - Aptr = 0x%lx\n", diff3); - printf("NextPtr - Xptr = 0x%lx\n\n", diff4); - - diff1 = (unsigned long) TestArrayPtr - (unsigned long) TestArray; - diff3 = (unsigned long) Yptr - (unsigned long) Aptr; - diff4 = (unsigned long) NextPtr - (unsigned long) Yptr; - - printf("&TestArray[3] - TestArray = 0x%lx\n", diff1); - printf("Xptr - Aptr = 0x%lx\n", diff3); - printf("NextPtr - Xptr = 0x%lx\n\n", diff4); - - return 0; -} diff --git a/ir/be/test/gnu_def.c b/ir/be/test/gnu_def.c deleted file mode 100644 index 1a50b5b3e..000000000 --- a/ir/be/test/gnu_def.c +++ /dev/null @@ -1,23 +0,0 @@ -#ifdef __GNUC__ -unsigned int gnu_dev_major (unsigned long long int __dev) -{ - return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); -} - -unsigned int gnu_dev_minor (unsigned long long int __dev) -{ - return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); -} - -unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) -{ - return ((__minor & 0xff) | ((__major & 0xfff) << 8) - | (((unsigned long long int) (__minor & ~0xff)) << 12) - | (((unsigned long long int) (__major & ~0xfff)) << 32)); -} -#endif - -int main() -{ - return 0; -} diff --git a/ir/be/test/harness.c b/ir/be/test/harness.c deleted file mode 100644 index 64f2ae7e9..000000000 --- a/ir/be/test/harness.c +++ /dev/null @@ -1,255 +0,0 @@ -#include -#define MAXPRINTABLE 128 -#include "rantext.h" -#if ULTRIX || _AIX || _WIN32 -#include -#else -#include -#endif - -double ran(); -double ran2(); -char getranchar(); -#define BUFFERSIZE 14500000 -long int seedi; -#define COMPRESS 0 -#define UNCOMPRESS 1 - -double prob_tab[MAXPRINTABLE][MAXPRINTABLE]; - -int -add_line(char* buf, int count, int num_letters, char letter) -{ -int i; - for (i = count; i < (count + num_letters); i ++) - { - buf[i]=letter; - } - count=i; - buf[count]='\n'; - count=count+1; - return(count); -} - -fill_text_buffer(int count, char start_char, char* text_buffer) -{ - long int total; /* normalization */ - int i,j; /* array indexers */ - char c1,c2; /* character holders for level-three search */ - int bufindex; - - /* - * For each ith, jth element in the frequency table, set the - * ith, jth, element of the probability table to the frequency - * table entry divided by the total. - */ - - for (i=0;i<128;i++) - { - total = 0.0; - for (j=0;j<128;j++) - { - total += freq_tab[i][j]; - } - if (total<1) - total=1; - for (j=0;j<128;j++) - { - prob_tab[i][j] = (double)freq_tab[i][j]/(double)total; - } - } - /* - * For each ith element in the probability table, make the - * jth elements cumulative in order to simplify 'getranchar'. - */ - - for (i=0;i<128;i++) - { - for (j=1;j<128;j++) - { - prob_tab[i][j]+=prob_tab[i][j-1]; - } - } - -#if SDEBUG - fprintf(stderr, - "Probability table built, about to open file \n"); - fflush(stderr) ; -#endif /* SDEBUG */ - - /* - * Start off the simulation with seed letter. - */ - - c1=start_char; - - /* - * Get "count" characters and spit 'em out. - */ - - count-- ; /* pre-decrement for the final new line */ - - bufindex = 0 ; - while (count>0) - { - c2=getranchar(c1,ran2()); - text_buffer[bufindex++]=c2 ; -#if SDEBUG>2 - fprintf(stderr,"Character number %d is %c\n", - bufindex,c2) ; - fflush(stderr) ; -#endif /* SDEBUG */ - c1=c2; - count--; - } - /* - * Complete the last line - */ - - c2 = '\n' ; - text_buffer[bufindex++]=c2 ; -} - -/* Routine For dumping contents of a buffer to the output - Jeff Reilly, 1/15/95 */ -print_buffer(int count, char* text_buffer) - -{ -int i; - -for (i=0;i prob_tab[c][127]) - return ('e'); - - for (k=0;k<7;k++) - { - mid = (low+high)>>1; - if (rnno < prob_tab[c][mid]) - high = mid; - else if (rnno > prob_tab[c][mid]) - low = mid + 1; - else /* exact match found -unlikely */ - return ((char)mid); - } - return ((char)low); -} - -double ran2() -{ - seedi=((314157*seedi)+19)&0xffffff; - return ( (double) seedi/(double)0xffffff); -} - -double ran() -/* See "Random Number Generators: Good Ones Are Hard To Find", */ -/* Park & Miller, CACM 31#10 October 1988 pages 1192-1201. */ -/***********************************************************/ -/* THIS IMPLEMENTATION REQUIRES AT LEAST 32 BIT INTEGERS ! */ -/***********************************************************/ -#define _A_MULTIPLIER 16807L -#define _M_MODULUS 2147483647L /* (2**31)-1 */ -#define _Q_QUOTIENT 127773L /* 2147483647 / 16807 */ -#define _R_REMAINDER 2836L /* 2147483647 % 16807 */ -{ - long lo; - long hi; - long test; - - hi = seedi / _Q_QUOTIENT; - lo = seedi % _Q_QUOTIENT; - test = _A_MULTIPLIER * lo - _R_REMAINDER * hi; - if (test > 0) { - seedi = test; - } else { - seedi = test + _M_MODULUS; - } - return ( (float) seedi / _M_MODULUS); -} - -compare_buffer(char* buf1, int count1, char* buf2, int count2) -{ -if (count1 == count2) -{ - printf("Files both have length %d\n", count1); - if (count1 > 0) - { - if ( (buf1[0] == buf2[0]) && (buf1[count1-1] == buf2[count2-1]) ) - { - printf("First character (%c) and Last Character (%c) match. \n", buf1[0], buf1[count1-1]); - } - else - { - printf("First and last characters do not match.\n"); - printf("%c does not match %c\n", buf1[0], buf2[0]); - printf("or %c does not match %c\n", buf1[count1-1], buf2[count2-1]); - } - } -} -else -{ - printf("Warning: Files of differing lengths: %d and %d\n", count1, count2); -} - - -} - -char orig_text_buffer[BUFFERSIZE], comp_text_buffer[BUFFERSIZE], new_text_buffer[BUFFERSIZE]; - - -int main(int argc, char *argv[]) - -{ -int count, i; -int new_count; -char start_char; -int comp_count = 0; - - printf("SPEC 129.compress harness\n"); - - //scanf("%i %c %li", &count, &start_char, &seedi); - count = 10; - start_char=10; - seedi = 12345; - printf("Initial File Size:%i Start character:%c\n", count, start_char, seedi); - fill_text_buffer(count, start_char, orig_text_buffer); - for (i = 1; i <= 25; i++) - { - new_count=add_line(orig_text_buffer, count, i, start_char); - count=new_count; - //oper=COMPRESS; - printf("The starting size is: %d\n", count); - //comp_count=spec_select_action(orig_text_buffer, count, oper, comp_text_buffer); - printf("The compressed size is: %d\n", comp_count); - //oper=UNCOMPRESS; - //new_count=spec_select_action(comp_text_buffer, comp_count, oper, new_text_buffer); - printf("The compressed/uncompressed size is: %d\n", new_count); - //compare_buffer(orig_text_buffer, count, new_text_buffer, new_count); - } -/* Remove comments for Debugging */ -/* - printf("Original Text File:\n"); - print_buffer(count, orig_text_buffer); - printf("New Text File:\n"); - print_buffer(count, new_text_buffer); */ - - return 0; -} diff --git a/ir/be/test/iabs.c b/ir/be/test/iabs.c deleted file mode 100644 index 357d8e6c3..000000000 --- a/ir/be/test/iabs.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc) -{ - printf("%d\n", abs(argc)); - - return 0; -} diff --git a/ir/be/test/if.c b/ir/be/test/if.c deleted file mode 100644 index 5e8ae89f1..000000000 --- a/ir/be/test/if.c +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include - -int test1(int a) -{ - return a == 0; -} - -int test2(int a, int b) -{ - return a == b; -} - -int test2a(int a, int b) -{ - return a != b; -} - -int test3(int a, int b) -{ - return a == 0 && b + 1 < 10; -} - -int test4(int a, int b) -{ - return a == 0 || b + 1 < 10; -} - -int test5(int a, int b) -{ - return a > b ? a : b - 1; -} - -int test6(int a, int b) -{ - return a < 0 ? -1 : (a > 0 ? 1 : 0); -} - -int test6a(int a, int b) -{ - if(a < b) - ; - else - ; - - return 0; -} - -int test7(int a, int b) -{ - int i, res = 0; - - for(i = 0; i < a; ++i) - res += i * b; - - return res; -} - -int test8(int a, int b, int c) -{ - return a < b ? (a < c ? a : c) : (b < c ? b : c); -} - -int test9(int a, int b) -{ - return a ? b : b; -} - -int testam(int a, int b, int c) -{ - if(a < 42) - return b; - else - return c; -} - -int main() -{ -#define TU(t,a,s) printf("%s(%d) = %d (should be %d)\n", \ - #t, a, t(a), s); \ - assert(t(a) == s); - -#define TB(t,a,b,s) printf("%s(%d,%d) = %d (should be %d)\n", \ - #t, a, b, t(a,b), s); \ - assert(t(a,b) == s); - -#define TT(t,a,b,c,s) printf("%s(%d,%d,%d) = %d (should be %d)\n", \ - #t, a, b, c, t(a,b,c), s); \ - assert(t(a,b,c) == s); - - - TU(test1, 0, 1); - TU(test1, 42, 0); - - TB(test2, 0, 0, 1); - TB(test2, -23, -23, 1); - TB(test2, 0, 42, 0); - TB(test2, -1, 0, 0); - - TB(test2a, 0, 0, 0); - TB(test2a, -23, -23, 0); - TB(test2a, 0, 42, 1); - TB(test2a, -1, 0, 1); - - TB(test3, 0, 8, 1); - TB(test3, 0, -200, 1); - TB(test3, 0, 10, 0); - TB(test3, 42, 8, 0); - TB(test3, -1, -200, 0); - TB(test3, -1, 10, 0); - - TB(test4, 0, 8, 1); - TB(test4, 0, -200, 1); - TB(test4, 0, 10, 1); - TB(test4, 42, 8, 1); - TB(test4, -1, -200, 1); - TB(test4, -1, 10, 0); - - TB(test5, 42, -1, 42); - TB(test5, 1, 0, 1); - TB(test5, 0, 1, 0); - TB(test5, -1, 42, 41); - - TB(test6, -5, 42, -1); - TB(test6, -20, -1, -1); - TB(test6, 20, -1, 1); - TB(test6a, 42, -1, 0); - - TB(test7, 3, 2, 6); - - TT(test8, 0, 2, 3, 0); - TT(test8, 0, 2, 1, 0); - TT(test8, -1, 42, 5, -1); - TT(test8, -7, 4, -42, -42); - TT(test8, 0, 2, -1, -1); - TT(test8, 24, 123, 7, 7); - - TT(testam, -24, 13, 7, 13); - TT(testam, 102, 13, 7, 7); - - TB(test9, 3, 2, 2); - TB(test9, -42, -42, -42); - - return 0; -} diff --git a/ir/be/test/incmem.c b/ir/be/test/incmem.c deleted file mode 100644 index 4bc137da7..000000000 --- a/ir/be/test/incmem.c +++ /dev/null @@ -1,6 +0,0 @@ -volatile int x = -1; - -int main(void) { - x ++; - return x; -} diff --git a/ir/be/test/invsqrt.c b/ir/be/test/invsqrt.c deleted file mode 100644 index 4fc96049c..000000000 --- a/ir/be/test/invsqrt.c +++ /dev/null @@ -1,20 +0,0 @@ -/** - * magical invsqrt function from Quake III code - * see: http://www.codemaestro.com/reviews/9 - */ - -float InvSqrt(float x) -{ - float xhalf = 0.5f*x; - int i = *(int*)&x; - i = 0x5f3759df - (i>>1); - x = *(float*)&i; - x = x*(1.5f-xhalf*x*x); - return x; -} - -int main(void) { - int result = InvSqrt(0.00056); - printf("Result: %d (should be 42)", result); - return result != 42; -} diff --git a/ir/be/test/kahansum.c b/ir/be/test/kahansum.c deleted file mode 100644 index d02c5a60a..000000000 --- a/ir/be/test/kahansum.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -float kahanSum(const float A[], int n) { - float sum = 0.0, C = 0.0, Y, T; - int i; - - for (i = 0; i < n; ++i) { - Y = A[i] - C; - T = sum + Y; - C = T - sum - Y; - sum = T; - } - return sum; -} - -int main() -{ - float test[] = { 1,2,3,4,5,6,7,8,9}; - printf("Result: %f\n", kahanSum(test, sizeof(test)/sizeof(float))); - - return 0; -} diff --git a/ir/be/test/langshootout/bintree.c b/ir/be/test/langshootout/bintree.c deleted file mode 100644 index f9aa7d5d3..000000000 --- a/ir/be/test/langshootout/bintree.c +++ /dev/null @@ -1,142 +0,0 @@ -/* The Computer Language Shootout Benchmarks - http://shootout.alioth.debian.org/ - - contributed by Kevin Carson - compilation: - gcc -O3 -fomit-frame-pointer -funroll-loops -static binary-trees.c -lm - icc -O3 -ip -unroll -static binary-trees.c -lm -*/ - -//#include -#include -#include -#include - - -typedef struct tn { - struct tn* left; - struct tn* right; - long item; -} treeNode; - - -static -treeNode* NewTreeNode(treeNode* left, treeNode* right, long item) -{ - treeNode* new; - - new = (treeNode*)malloc(sizeof(treeNode)); - - new->left = left; - new->right = right; - new->item = item; - - return new; -} /* NewTreeNode() */ - -static -long ItemCheck(treeNode* tree) -{ - if (tree->left == NULL) - return tree->item; - else - return tree->item + ItemCheck(tree->left) - ItemCheck(tree->right); -} /* ItemCheck() */ - -static -treeNode* BottomUpTree(long item, unsigned depth) -{ - if (depth > 0) - return NewTreeNode - ( - BottomUpTree(2 * item - 1, depth - 1), - BottomUpTree(2 * item, depth - 1), - item - ); - else - return NewTreeNode(NULL, NULL, item); -} /* BottomUpTree() */ - -static -void DeleteTree(treeNode* tree) -{ - if (tree->left != NULL) - { - DeleteTree(tree->left); - DeleteTree(tree->right); - } - - free(tree); -} /* DeleteTree() */ - - -int main(int argc, char* argv[]) -{ - unsigned N, depth, minDepth, maxDepth, stretchDepth; - treeNode *stretchTree, *longLivedTree, *tempTree; - - if(argc < 2) { - N = 10; - printf("Using default input %d\n", N); - } else { - N = atol(argv[1]); - } - - minDepth = 4; - - if ((minDepth + 2) > N) - maxDepth = minDepth + 2; - else - maxDepth = N; - - stretchDepth = maxDepth + 1; - - stretchTree = BottomUpTree(0, stretchDepth); - printf - ( - "stretch tree of depth %u\t check: %li\n", - stretchDepth, - ItemCheck(stretchTree) - ); - - DeleteTree(stretchTree); - - longLivedTree = BottomUpTree(0, maxDepth); - - for (depth = minDepth; depth <= maxDepth; depth += 2) - { - long i, iterations, check; - - iterations = pow(2, maxDepth - depth + minDepth); - - check = 0; - - for (i = 1; i <= iterations; i++) - { - tempTree = BottomUpTree(i, depth); - check += ItemCheck(tempTree); - DeleteTree(tempTree); - - tempTree = BottomUpTree(-i, depth); - check += ItemCheck(tempTree); - DeleteTree(tempTree); - } /* for(i = 1...) */ - - printf - ( - "%li\t trees of depth %u\t check: %li\n", - iterations * 2, - depth, - check - ); - } /* for(depth = minDepth...) */ - - printf - ( - "long lived tree of depth %u\t check: %li\n", - maxDepth, - ItemCheck(longLivedTree) - ); - - return 0; -} /* main() */ diff --git a/ir/be/test/langshootout/fannkuch.c b/ir/be/test/langshootout/fannkuch.c deleted file mode 100644 index 9d396682f..000000000 --- a/ir/be/test/langshootout/fannkuch.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * The Computer Lannguage Shootout - * http://shootout.alioth.debian.org/ - * Contributed by Heiner Marxen - * - * "fannkuch" for C gcc - * - * $Id$ - */ - -#include -#include - -#define Int int -#define Aint int - - static long -fannkuch( int n ) -{ - Aint* perm; - Aint* perm1; - Aint* count; - long flips; - long flipsMax; - Int r; - Int i; - Int k; - Int didpr; - const Int n1 = n - 1; - - if( n < 1 ) return 0; - - perm = calloc(n, sizeof(*perm )); - perm1 = calloc(n, sizeof(*perm1)); - count = calloc(n, sizeof(*count)); - - for( i=0 ; i k>0 */ - Int j; - for( i=1, j=k-1 ; i 0 ) { - break; - } - ++r; - } - } -} - -int -main( int argc, char* argv[] ) -{ - int n = (argc>1) ? atoi(argv[1]) : 10; - - printf("Pfannkuchen(%d) = %ld\n", n, fannkuch(n)); - return 0; -} diff --git a/ir/be/test/langshootout/fasta.c b/ir/be/test/langshootout/fasta.c deleted file mode 100644 index 61ddb8e28..000000000 --- a/ir/be/test/langshootout/fasta.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- mode: c -*- - * $Id$ - * http://shootout.alioth.debian.org/ - * - * by Paul Hsieh - */ - -#include -#include - -#define IM 139968 -#define IA 3877 -#define IC 29573 - -double gen_random (double max) { - static long last = 42; - return max * (last = (last * IA + IC) % IM) / IM; -} - -struct aminoacids { - char c; - double p; -}; - -/* Weighted selection from alphabet */ - -void makeCumulative (struct aminoacids * genelist, int count) { - double cp = 0.0; - int i; - - for (i=0; i < count; i++) { - cp += genelist[i].p; - genelist[i].p = cp; - } -} - -char selectRandom (const struct aminoacids * genelist, int count) { - double r = gen_random (1); - int i, lo, hi; - - if (r < genelist[0].p) return genelist[0].c; - - lo = 0; - hi = count-1; - - while (hi > lo+1) { - i = (hi + lo) / 2; - if (r < genelist[i].p) hi = i; else lo = i; - } - return genelist[hi].c; -} - -/* Generate and write FASTA format */ - -#define LINE_LENGTH (60) - -void makeRandomFasta (const char * id, const char * desc, const struct -aminoacids * genelist, int count, int n) { - int todo = n; - int i, m; - - printf (">%s %s\n", id, desc); - - for (; todo > 0; todo -= LINE_LENGTH) { - char pick[LINE_LENGTH+1]; - if (todo < LINE_LENGTH) m = todo; else m = LINE_LENGTH; - for (i=0; i < m; i++) pick[i] = selectRandom (genelist, count); - pick[m] = '\0'; - puts (pick); - } -} - -void makeRepeatFasta (const char * id, const char * desc, const char * -s, int n) { - char * ss; - int todo = n, k = 0, kn = strlen (s); - int m; - - ss = (char *) malloc (kn + 1); - memcpy (ss, s, kn+1); - - printf (">%s %s\n", id, desc); - - for (; todo > 0; todo -= LINE_LENGTH) { - if (todo < LINE_LENGTH) m = todo; else m = LINE_LENGTH; - - while (m >= kn - k) { - printf ("%s", s+k); - m -= kn - k; - k = 0; - } - - ss[k + m] = '\0'; - puts (ss+k); - ss[k + m] = s[m+k]; - k += m; - } - - free (ss); -} - -/* Main -- define alphabets, make 3 fragments */ - -struct aminoacids iub[] = { - { 'a', 0.27 }, - { 'c', 0.12 }, - { 'g', 0.12 }, - { 't', 0.27 }, - - { 'B', 0.02 }, - { 'D', 0.02 }, - { 'H', 0.02 }, - { 'K', 0.02 }, - { 'M', 0.02 }, - { 'N', 0.02 }, - { 'R', 0.02 }, - { 'S', 0.02 }, - { 'V', 0.02 }, - { 'W', 0.02 }, - { 'Y', 0.02 } -}; - -#define IUB_LEN (sizeof (iub) / sizeof (struct aminoacids)) - -struct aminoacids homosapiens[] = { - { 'a', 0.3029549426680 }, - { 'c', 0.1979883004921 }, - { 'g', 0.1975473066391 }, - { 't', 0.3015094502008 }, -}; - -#define HOMOSAPIENS_LEN (sizeof (homosapiens) / sizeof (struct aminoacids)) - -char * alu = - "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" - "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" - "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" - "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" - "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" - "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" - "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; - -int main (int argc, char * argv[]) { - int n = 1000; - - if (argc > 1) sscanf (argv[1], "%d", &n); - - makeCumulative (iub, IUB_LEN); - makeCumulative (homosapiens, HOMOSAPIENS_LEN); - - makeRepeatFasta ("ONE", "Homo sapiens alu", alu, n*2); - makeRandomFasta ("TWO", "IUB ambiguity codes", iub, IUB_LEN, n*3); - makeRandomFasta ("THREE", "Homo sapiens frequency", homosapiens, -HOMOSAPIENS_LEN, n*5); - - return 0; -} diff --git a/ir/be/test/langshootout/n-body.c b/ir/be/test/langshootout/n-body.c deleted file mode 100644 index 7081537f2..000000000 --- a/ir/be/test/langshootout/n-body.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * The Great Computer Language Shootout - * http://shootout.alioth.debian.org/ - * - * contributed by Christoph Bauer - * - */ - -#include -#include -#include - -#define pi 3.141592653589793 -#define solar_mass (4 * pi * pi) -#define days_per_year 365.24 - -struct planet { - double x, y, z; - double vx, vy, vz; - double mass; -}; - -void advance(int nbodies, struct planet * bodies, double dt) -{ - int i, j; - - for (i = 0; i < nbodies; i++) { - struct planet * b = &(bodies[i]); - for (j = i + 1; j < nbodies; j++) { - struct planet * b2 = &(bodies[j]); - double dx = b->x - b2->x; - double dy = b->y - b2->y; - double dz = b->z - b2->z; - double distance = sqrt(dx * dx + dy * dy + dz * dz); - double mag = dt / (distance * distance * distance); - b->vx -= dx * b2->mass * mag; - b->vy -= dy * b2->mass * mag; - b->vz -= dz * b2->mass * mag; - b2->vx += dx * b->mass * mag; - b2->vy += dy * b->mass * mag; - b2->vz += dz * b->mass * mag; - } - } - for (i = 0; i < nbodies; i++) { - struct planet * b = &(bodies[i]); - b->x += dt * b->vx; - b->y += dt * b->vy; - b->z += dt * b->vz; - } -} - -double energy(int nbodies, struct planet * bodies) -{ - double e; - int i, j; - - e = 0.0; - for (i = 0; i < nbodies; i++) { - struct planet * b = &(bodies[i]); - e += 0.5 * b->mass * (b->vx * b->vx + b->vy * b->vy + b->vz * b->vz); - for (j = i + 1; j < nbodies; j++) { - struct planet * b2 = &(bodies[j]); - double dx = b->x - b2->x; - double dy = b->y - b2->y; - double dz = b->z - b2->z; - double distance = sqrt(dx * dx + dy * dy + dz * dz); - e -= (b->mass * b2->mass) / distance; - } - } - return e; -} - -void offset_momentum(int nbodies, struct planet * bodies) -{ - double px = 0.0, py = 0.0, pz = 0.0; - int i; - for (i = 0; i < nbodies; i++) { - px += bodies[i].vx * bodies[i].mass; - py += bodies[i].vy * bodies[i].mass; - pz += bodies[i].vz * bodies[i].mass; - } - bodies[0].vx = - px / solar_mass; - bodies[0].vy = - py / solar_mass; - bodies[0].vz = - pz / solar_mass; -} - -#define NBODIES 5 -struct planet bodies[NBODIES] = { - { /* sun */ - 0, 0, 0, 0, 0, 0, solar_mass - }, - { /* jupiter */ - 4.84143144246472090e+00, - -1.16032004402742839e+00, - -1.03622044471123109e-01, - 1.66007664274403694e-03 * days_per_year, - 7.69901118419740425e-03 * days_per_year, - -6.90460016972063023e-05 * days_per_year, - 9.54791938424326609e-04 * solar_mass - }, - { /* saturn */ - 8.34336671824457987e+00, - 4.12479856412430479e+00, - -4.03523417114321381e-01, - -2.76742510726862411e-03 * days_per_year, - 4.99852801234917238e-03 * days_per_year, - 2.30417297573763929e-05 * days_per_year, - 2.85885980666130812e-04 * solar_mass - }, - { /* uranus */ - 1.28943695621391310e+01, - -1.51111514016986312e+01, - -2.23307578892655734e-01, - 2.96460137564761618e-03 * days_per_year, - 2.37847173959480950e-03 * days_per_year, - -2.96589568540237556e-05 * days_per_year, - 4.36624404335156298e-05 * solar_mass - }, - { /* neptune */ - 1.53796971148509165e+01, - -2.59193146099879641e+01, - 1.79258772950371181e-01, - 2.68067772490389322e-03 * days_per_year, - 1.62824170038242295e-03 * days_per_year, - -9.51592254519715870e-05 * days_per_year, - 5.15138902046611451e-05 * solar_mass - } -}; - -int main(int argc, char ** argv) -{ - int n = 1000000; - int i; - - if(argc > 1) - n = atoi(argv[1]); - - offset_momentum(NBODIES, bodies); - printf ("%.9f\n", energy(NBODIES, bodies)); - for (i = 1; i <= n; i++) - advance(NBODIES, bodies, 0.01); - printf ("%.9f\n", energy(NBODIES, bodies)); - return 0; -} diff --git a/ir/be/test/langshootout/nsieve-bits.c b/ir/be/test/langshootout/nsieve-bits.c deleted file mode 100644 index e3d1b5466..000000000 --- a/ir/be/test/langshootout/nsieve-bits.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The Great Computer Language Shootout - * http://shootout.alioth.debian.org/ - * - * Written by Dima Dorfman, 2004 - * Compile: gcc -std=c99 -O2 -o nsieve_bits_gcc nsieve_bits.c - */ - -#include -#include -#include -#include -#include - -typedef uint_fast8_t bits; -#define NBITS (CHAR_BIT * sizeof(bits)) - -static uintmax_t -nsieve(uintmax_t m) -{ - uintmax_t count, i, j; - bits a[m / NBITS]; - - memset(a, (1 << CHAR_BIT) - 1, sizeof(a)); - count = 0; - for (i = 2; i < m; ++i) - if (a[i / NBITS] & (1 << i % NBITS)) { - for (j = i + i; j < m; j += i) - a[j / NBITS] &= ~(1 << j % NBITS); - ++count; - } - return (count); -} - -static void -test(unsigned long n) -{ - uintmax_t count, m; - - m = (1 << n) * 10000; - count = nsieve(m); - printf("Primes up to %8ju %8ju\n", m, count); -} - -int -main(int argc, char **argv) -{ - unsigned long n = 9; - char *cp; - - if(argc > 1) - n = atoi(argv[1]); - test(n); - if (n >= 1) - test(n - 1); - if (n >= 2) - test(n - 2); - exit(0); -} diff --git a/ir/be/test/langshootout/nsieve.c b/ir/be/test/langshootout/nsieve.c deleted file mode 100644 index c9b459d73..000000000 --- a/ir/be/test/langshootout/nsieve.c +++ /dev/null @@ -1,39 +0,0 @@ -// The Computer Language Shootout -// http://shootout.alioth.debian.org/ -// Precedent C entry modified by bearophile for speed and size, 31 Jan 2006 -// Compile with: -O3 -s -std=c99 -fomit-frame-pointer - -#include -#include -#include - -typedef unsigned char boolean; - - -static void nsieve(int m) { - unsigned int count = 0, i, j; - boolean * flags = (boolean *) malloc(m * sizeof(boolean)); - memset(flags, 1, m); - - for (i = 2; i < m; ++i) - if (flags[i]) { - ++count; - for (j = i << 1; j < m; j += i) - if (flags[j]) flags[j] = 0; - } - - free(flags); - printf("Primes up to %8u %8u\n", m, count); -} - -int main(int argc, char * argv[]) { - int i; - int m = 8; - - if(argc > 1) - m = atoi(argv[1]); - - for (i = 0; i < 3; i++) - nsieve(10000 << (m-i)); - return 0; -} diff --git a/ir/be/test/langshootout/partial-sums.c b/ir/be/test/langshootout/partial-sums.c deleted file mode 100644 index 963cba276..000000000 --- a/ir/be/test/langshootout/partial-sums.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -** The Computer Language Shootout -** http://shootout.alioth.debian.org/ -** contributed by Mike Pall -** de-optimized by Isaac Gouy -** -** compile with: -** gcc -O3 -fomit-frame-pointer -ffast-math -o partialsums partialsums.c -lm -** Adding -march= may help, too. -** On a P4/K8 or later try adding: --march= -mfpmath=sse -msse2 -*/ - -#include -#include -#include - -int main(int argc, char **argv) -{ - int k; - int n = 100000; - double sum, a; - - if(argc > 1) - n = atoi(argv[1]); - -/* -** Yes, I (Mike Pall) tried using a double as a primary or secondary loop variable. -** But the x86 ABI requires a cleared x87 FPU stack before every call -** (e.g. to sin()) which nullifies any performance gains. -** -** Combining all loops does not pay off because the x87 FPU has to shuffle -** stack slots and/or runs out of registers. This may not be entirely true -** for SSE2 with fully inlined FPU code (-ffast-math required). Dito for -** other CPUs with a register-based FPU and a sane FP ABI. -** -** Auto vectorization may be a bit easier with separate loops, too. -*/ - -#define kd ((double)k) - - sum = 0.0; - for (k = 0; k <= n; k++) sum += pow(2.0/3.0, kd); - printf("%.9f\t(2/3)^k\n", sum); - - sum = 0.0; - for (k = 1 ; k <= n; k++) sum += 1/sqrt(kd); /* aka pow(kd, -0.5) */ - printf("%.9f\tk^-0.5\n", sum); - - sum = 0.0; - for (k = 1; k <= n; k++) sum += 1.0/(kd*(kd+1.0)); - printf("%.9f\t1/k(k+1)\n", sum); - - sum = 0.0; - for (k = 1; k <= n; k++) { - double sk = sin(kd); - sum += 1.0/(kd*kd*kd*sk*sk); - } - printf("%.9f\tFlint Hills\n", sum); - - sum = 0.0; - for (k = 1; k <= n; k++) { - double ck = cos(kd); - sum += 1.0/(kd*kd*kd*ck*ck); - } - printf("%.9f\tCookson Hills\n", sum); - - sum = 0.0; - for (k = 1; k <= n; k++) sum += 1.0/kd; - printf("%.9f\tHarmonic\n", sum); - - sum = 0.0; - for (k = 1; k <= n; k++) sum += 1.0/(kd*kd); - printf("%.9f\tRiemann Zeta\n", sum); - - sum = 0.0; a = -1.0; - for (k = 1; k <= n; k++) sum += (a = -a)/kd; - printf("%.9f\tAlternating Harmonic\n", sum); - - sum = 0.0; a = -1.0; - for (k = 1; k <= n; k++) sum += (a = -a)/(2.0*kd - 1.0); - printf("%.9f\tGregory\n", sum); - - return 0; -} diff --git a/ir/be/test/langshootout/recursive.c b/ir/be/test/langshootout/recursive.c deleted file mode 100644 index cefabad08..000000000 --- a/ir/be/test/langshootout/recursive.c +++ /dev/null @@ -1,51 +0,0 @@ -// The Computer Language Shootout -// http://shootout.alioth.debian.org/ -// recursive test, by bearophile, Jan 24 2006 -// Compile with: -O3 -s -fomit-frame-pointer -funroll-loops - -#include - -int Ack(int x, int y) { - if (x == 0) - return y+1; - if (y == 0) - return Ack(x-1, 1); - return Ack(x-1, Ack(x, y-1)); -} - -int Fib(int n) { - if (n < 2) - return 1; - return Fib(n-2) + Fib(n-1); -} - -double FibFP(double n) { - if (n < 2.0) - return 1.0; - return FibFP(n-2.0) + FibFP(n-1.0); -} - -int Tak(int x, int y, int z) { - if (y < x) - return Tak( Tak(x-1, y, z), Tak(y-1, z, x), Tak(z-1, x, y) ); - return z; -} - -double TakFP(double x, double y, double z) { - if (y < x) - return TakFP( TakFP(x-1.0, y, z), TakFP(y-1.0, z, x), TakFP(z-1.0, x, y) ); - return z; -} - -int main(int argc, char **argv) { - int n = 7; - - if(argc > 1) - n = atoi(argv[1]) - 1; - printf("Ack(3,%d): %d\n", n+1, Ack(3, n+1)); - printf("Fib(%.1f): %.1f\n", 28.0+n, FibFP(28.0+n)); - printf("Tak(%d,%d,%d): %d\n", 3*n, 2*n, n, Tak(3*n, 2*n, n)); - printf("Fib(3): %d\n", Fib(3)); - printf("Tak(3.0,2.0,1.0): %.1f\n", TakFP(3.0, 2.0, 1.0)); - return 0; -} diff --git a/ir/be/test/langshootout/spectral-norm.c b/ir/be/test/langshootout/spectral-norm.c deleted file mode 100644 index 61bb3b156..000000000 --- a/ir/be/test/langshootout/spectral-norm.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- mode: c -*- - * - * The Great Computer Language Shootout - * http://shootout.alioth.debian.org/ - * - * Contributed by Sebastien Loisel - */ - -#include -#include -#include -/* Includes for alloca() */ -#if defined(__FreeBSD__) -#include -#elif defined(_WIN32) -#include -#else -#include -#endif - -double eval_A(int i, int j) { return 1.0/((i+j)*(i+j+1)/2+i+1); } - -void eval_A_times_u(int N, const double u[], double Au[]) -{ - int i,j; - for(i=0;i -#include - -typedef long long int ll_t; -typedef unsigned long long int ull_t; - -#ifdef __GNUC__ -ll_t mul_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t shl_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t shr_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t add_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t sub_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t div_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t mod_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t divmod_ll(ll_t a, ll_t b) __attribute__((noinline)); -ll_t abs_ll(ll_t a) __attribute__((noinline)); -ll_t neg_ll(ll_t a) __attribute__((noinline)); - -ull_t mul_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t shl_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t shr_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t add_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t sub_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t div_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t mod_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t divmod_ull(ull_t a, ull_t b) __attribute__((noinline)); -ull_t neg_ull(ull_t a) __attribute__((noinline)); -#endif - -ll_t mul_ll(ll_t a, ll_t b) { - return a * b; -} - -ll_t shl_ll(ll_t a, ll_t b) { - return a << b; -} - -ll_t shr_ll(ll_t a, ll_t b) { - return a >> b; -} - -ll_t add_ll(ll_t a, ll_t b) { - return a + b; -} - -ll_t sub_ll(ll_t a, ll_t b) { - return a - b; -} - -ll_t div_ll(ll_t a, ll_t b) { - return a / b; -} - -ll_t mod_ll(ll_t a, ll_t b) { - return a % b; -} - -ll_t divmod_ll(ll_t a, ll_t b) { - return (a / b) + (a % b); -} - -ll_t neg_ll(ll_t a) { - return -a; -} - -ll_t abs_ll(ll_t a) { - return a < 0 ? -a : a; -} - -double conv_ll_d(ll_t a) { - return (double)a; -} - -ll_t conv_d_ll(double a) { - return (ll_t)a; -} - -/* unsigned */ - -ull_t mul_ull(ull_t a, ull_t b) { - return a * b; -} - -ull_t shl_ull(ull_t a, ull_t b) { - return a << b; -} - -ull_t shr_ull(ull_t a, ull_t b) { - return a >> b; -} - -ull_t add_ull(ull_t a, ull_t b) { - return a + b; -} - -ull_t sub_ull(ull_t a, ull_t b) { - return a - b; -} - -ull_t div_ull(ull_t a, ull_t b) { - return a / b; -} - -ull_t mod_ull(ull_t a, ull_t b) { - return a % b; -} - -ull_t divmod_ull(ull_t a, ull_t b) { - return (a / b) + (a % b); -} - -ull_t neg_ull(ull_t a) { - return -a; -} - -#if 0 -double conv_ull_d(ull_t a) { - return (double)a; -} - -ull_t conv_d_ull(double a) { - return (ull_t)a; -} -#endif - -int main(void) { - ll_t a = 0xff; - ll_t b = 0x123456789LL; - ll_t c = 0x8001023000002460LL; - double d = (double)c; - - ull_t ua = 0xff; - ull_t ub = 0x123456789ULL; - ull_t uc = 0x8001023000002460ULL; - - printf("%lld * %lld = %lld\n", a, b, mul_ll(a, b)); - printf("%lld + %lld = %lld\n", a, b, add_ll(a, b)); - printf("%lld - %lld = %lld\n", a, b, sub_ll(a, b)); - printf("%lld / %lld = %lld\n", b, a, div_ll(b, a)); - printf("%lld %% %lld = %lld\n", b, a, mod_ll(b, a)); - printf("%lld / + %% %lld = %lld\n", b, a, divmod_ll(b, a)); - printf("%lld << %d = %lld\n", a, 2, shl_ll(a, 2)); - printf("%lld << %d = %lld\n", a, 33, shl_ll(a, 33)); - printf("%lld >> %d = %lld\n", a, 2, shr_ll(a, 2)); - printf("%lld >> %d = %lld\n", c, 33, shr_ll(c, 33)); - printf("abs(%lld) = %lld\n", c, abs_ll(c)); - printf("neg(%lld) = %lld\n", b, neg_ll(b)); - printf("conv(%lld) = %lf\n", c, conv_ll_d(c)); - printf("conv(%lf) = %lld\n", d, conv_d_ll(d)); - - printf("%llu * %llu = %llu\n", ua, ub, mul_ull(ua, ub)); - printf("%llu + %llu = %llu\n", ua, ub, add_ull(ua, ub)); - printf("%llu - %llu = %llu\n", ua, ub, sub_ull(ua, ub)); - printf("%llu / %llu = %llu\n", ub, ua, div_ull(ub, ua)); - printf("%llu %% %llu = %llu\n", ub, ua, mod_ull(ub, ua)); - printf("%llu / + %% %llu = %llu\n", ub, ua, divmod_ull(ub, ua)); - printf("%llu << %d = %llu\n", ua, 2, shl_ull(ua, 2)); - printf("%llu << %d = %llu\n", ua, 33, shl_ull(ua, 33)); - printf("%llu >> %d = %llu\n", ua, 2, shr_ull(ua, 2)); - printf("%llu >> %d = %llu\n", uc, 33, shr_ll(uc, 33)); - printf("neg(%llu) = %llu\n", ub, neg_ull(ub)); -#if 0 - printf("conv(%llu) = %lf\n", uc, conv_ull_d(uc)); - printf("conv(%lf) = %llu\n", d, conv_d_ull(d)); -#endif - return 0; -} diff --git a/ir/be/test/ll_call.c b/ir/be/test/ll_call.c deleted file mode 100644 index b6969a87f..000000000 --- a/ir/be/test/ll_call.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -long long fac(long long n) -{ - if(n < 1) - return 1; - - return (n*fac(n-1)); -} - -int main(void) { - printf("Result:%lld (should be 3628800)\n",fac(10)); - printf("Result:%lld (should be 39916800)\n",fac(11)); - printf("Result:%lld (should be 479001600)\n",fac(12)); - printf("Result:%lld (should be 6227020800)\n",fac(13)); - printf("Result:%lld (should be 87178291200)\n",fac(14)); - printf("Result:%lld (should be 1307674368000)\n",fac(15)); - printf("Result:%lld (should be 20922789888000)\n",fac(16)); - printf("Result:%lld (should be 355687428096000)\n",fac(17)); - printf("Result:%lld (should be 6402373705728000)\n",fac(18)); - printf("Result:%lld (should be 121645100408832000)\n",fac(19)); - printf("Result:%lld (should be 2432902008176640000)\n",fac(20)); - - return fac(20) != 2432902008176640000ULL; -} diff --git a/ir/be/test/localopts.c b/ir/be/test/localopts.c deleted file mode 100644 index 2851d1070..000000000 --- a/ir/be/test/localopts.c +++ /dev/null @@ -1,289 +0,0 @@ -/*$ -fno-inline $*/ -#include -#include - -#define CONST 42 - -int mul0(int x) -{ - return -x * CONST; -} - -int mul1(int x, int y) -{ - return -x * -y; -} - -int mul2(int x, int y, int z) -{ - return -x * (y - z); -} - -int mul3(int x, int y, int z) -{ - return (x - y) * z; -} - -int sub0(int x, int y, int z) -{ - return x - (y - z); -} - -int sub1(int x, int y) -{ - return x - (y * CONST); -} - -int sub2(int x, int y) -{ - return x - -y; -} - -int sub3(int x, int y) -{ - return -x - y; -} - -int sub4(int x) { - return 6 - ~x; -} - -int addmul(int x, int y) -{ - -} - -int cmp1(int x, int y) { - return -x == -y; -} - -int cmp2(int x, int y) { - return -x != -y; -} - -int cmp3(int x, int y) { - return ~x == ~y; -} - -int cmp4(int x, int y) { - return ~x != ~y; -} - -int cmp5(int x, int y, int z) { - return x + z == z + y; -} - -int cmp6(int x, int y, int z) { - return x + z != y + z; -} - -int cmp7(int x, int y, int z) { - return x - z == y - z; -} - -int cmp8(int x, int y, int z) { - return z -x != z - y; -} - -int cmp9(int x) { - return -x == 3; -} - -int cmp10(int x) { - return -x != 3; -} - -int cmp11(int x, int y) { - return x - y != x; -} - -int cmp12(int x, int y) { - return x + y == x && y + x == y; -} - -int and1(int a, int b) { - return (a|b)&a; -} - -int and2(int a, int b) { - return (a|b) & ~(a&b); -} - -int and3(int a) { - return (a & 2) == 2; -} - -int and4(int a) { - return (a & 2) == 4; -} - -int and5(int a) { - return (a & 2) != 4; -} - -int or1(int a) { - return (a | 2) != 0; -} - -int or2(int a) { - return (a | 7) == 0; -} - -int add1(int x) { - return x + ~x; -} - -int shr1(int x) { - return -(x >> 31); -} - -int shrs1(unsigned x) { - return -(x >> 31); -} - -int demorgan1(int a, int b) { - return (~a) & (~b); -} - -int demorgan2(int a, int b) { - return (~a) | (~b); -} - -int eor1(int a, int b) { - return a & (a ^ b); -} - -int shl1(int a) { - return (a << 3) == (5<<3); -} - -int shl2(int a) { - return (a << 3) == 41; -} - -int shr2(unsigned int a) { - return (a >> 3) == 5; -} - -int shr3(unsigned int a) { - return (a >> 3) == (1 << 29); -} - -int shrs2(int a) { - return (a >> 3) == 5; -} - -int shrs3(int a) { - return (a >> 3) == -5; -} - -int shrs4(int a) { - return (a >> 3) == (1 << 29); -} - -int conv1(signed char a) { - return (int)a < 0; -} - -int conv2(unsigned char a) { - return (int)a > 0; -} - -int conv3(signed char a) { - return (unsigned)a != 0; -} - -int phi1(int x) { - int a = x ? 23 : 42; - int b = x ? 42 : 23; - return a + b; -} - -int phi2(int x) { - int a = x ? 16 : 8; - int b = x ? 4 : 2; - return a / b; -} - -int phi3(int x) { - int a = x ? 5 : 9; - int b = x ? 2 : 4; - return a % b; -} - -int phi4(int x) { - int a = x ? 5 : 9; - int b = x ? 2 : 4; - return (a / b) + (a % b); -} - -int abs1(int x) { - return abs(-x); -} - -int main(void) -{ -#define TU(func,x,expect) \ - printf("%s(%d) = %d (should be %d)\n", #func, x, func(x), expect); -#define TB(func,x,y,expect) \ - printf("%s(%d,%d) = %d (should be %d)\n", #func, x, y, func(x,y), expect); -#define TT(func,x,y,z,expect) \ - printf("%s(%d,%d,%d) = %d (should be %d)\n", #func, x, y, z, func(x,y,z), expect); - - TU(mul0, 3, -126); - TB(mul1, 20, 3, 60); - TT(mul2, 9, 2, 5, 27); - TT(mul3, 5, 2, 9, 27); - TT(sub0, 42, 17, 59, 84); - TB(sub1, 23, 17, -691); - TB(sub2, 42, 17, 59); - TB(sub3, 42, 17, -59); - TU(sub4, 42, 49); - TB(cmp1, 42, 17, 0); - TB(cmp2, 42, 17, 1); - TB(cmp3, 42, 17, 0); - TB(cmp4, 42, 17, 1); - TT(cmp5, 42, 17, -4, 0); - TT(cmp6, 42, 17, -4, 1); - TT(cmp7, 42, 17, -4, 0); - TT(cmp8, 42, 17, -4, 1); - TU(cmp9, -3, 1); - TU(cmp10, -3, 0); - TB(cmp11, 5, 5, 1); - TB(cmp11, 42, 0, 0); - TB(cmp12, 0, 0, 1); - TB(cmp12, 42, 5, 0); - TB(cmp12, 5, 5, 0); - TB(and1, 42, 17, 42); - TB(and2, 42, 17, 42^17); - TU(and3, 34, 1); - TU(add1, -3, -1); - TU(shr1, -3, 1); - TU(shrs1, -3, -1); - TB(demorgan1, 42, 17, ~(42|17)); - TB(demorgan2, 42, 17, ~(42&17)); - TB(eor1, 42, 44, 42&~44); - TU(shl1, 5, 1); - TU(shl1, 6, 0); - TU(shl2, 5, 0); - TU(shr2, 5<<3, 1); - TU(shr2, 6<<3, 0); - TU(shr3, 5, 0); - TU(shrs2, 5<<3, 1); - TU(shrs2, 6<<3, 0); - TU(shrs3, -5<<3, 1); - TU(shrs3, -6<<3, 0); - TU(shrs4, 5, 0); - TU(conv1, 3, 0); - TU(conv2, 3, 1); - TU(conv3, 3, 1); - TU(and4, 7, 0); - TU(and5, 7, 1); - TU(or1, 7, 1); - TU(or2, 7, 0); - TU(phi1, 1, 65); - TU(phi2, 1, 4); - TU(phi3, 1, 1); - TU(phi4, 1, 3); - TU(abs1, 1, 1); -} diff --git a/ir/be/test/loopana.c b/ir/be/test/loopana.c deleted file mode 100644 index 44c56189d..000000000 --- a/ir/be/test/loopana.c +++ /dev/null @@ -1,50 +0,0 @@ -/* the loop analysis produces strange loop depths here... */ - -typedef struct OP { - int bla; - int blup; - int op_seq; - int op_type; - struct OP *next; -} OP; - -OP operation1; -OP operation2 = { 1, 2, 0, 4, &operation1 }; -OP *ptr = &operation2; - -int main(int argc, char **argv) -{ - OP *o = ptr; - - if(!o || o->op_seq) - return; - printf("%d\n", o->op_seq); - rand(); - - for( ; o; o = o->next) { - if(o->op_seq) - break; - if(o->bla > 52) - o->bla -= 20; - - switch(o->bla) { - case 1: - case 201: - printf("%d\n", o->bla); - break; - default: - printf("hmm\n"); -#if 0 - while(rand() > 10000) - ; -#endif - break; - case 500: - printf("jummy\n"); - break; - } - } - printf("hjo\n"); - - return 0; -} diff --git a/ir/be/test/loopspilling.c b/ir/be/test/loopspilling.c deleted file mode 100644 index 93e24a8a0..000000000 --- a/ir/be/test/loopspilling.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include - -int r = 0; -int a1 = 0, - a2 = 0, - a3 = 0, - a4 = 0, - a5 = 0, - a6 = 0, - a7 = 0, - a8 = 0, - a9 = 0, - a10 = 0, - a11 = 0; - -int main() { - int r1 = a1, - r2 = a2, - r3 = a3, - r4 = a4, - r5 = a5, - r6 = a6, - r7 = a7; - int i, i2; - - for(i = 0; i < r; ++i) { - int r8 = a8, - r9 = a9, - r10 = a10; -#if 1 - for(i2 = 0; i2 < r; ++i2) { - printf("%d %d %d\n", i2, r2, r9); - } -#endif - - printf("%d %d\n", i+1+r8+r9+r10, r2); - i *= 2; - } - - printf("%d", r1+r2+r3+r4+r5+r6+r7+i); - return 0; -} diff --git a/ir/be/test/lrot.c b/ir/be/test/lrot.c deleted file mode 100644 index 737581d2d..000000000 --- a/ir/be/test/lrot.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef CHAR_BIT -#define CHAR_BIT 8 -#endif - -#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) -#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) - -unsigned long long testL(unsigned long long a, int cnt) { - return cnt == 0 ? a : ROL(a, cnt); -} - -unsigned long long testR(unsigned long long a, int cnt) { - return cnt == 0 ? a : ROR(a, cnt); -} - -int main() { - int printf(const char *fmt, ...); - int i; - - for (i = 0; i < 64; ++i) { - printf("%lld %lld\n", testL(1, i), testR(1, i)); - } - return 0; -} diff --git a/ir/be/test/makediffhtml.xslt b/ir/be/test/makediffhtml.xslt deleted file mode 100644 index 6e7d82c65..000000000 --- a/ir/be/test/makediffhtml.xslt +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - background-color: green; color: white; - - - background-color: red; color: white; - - - - - - - - color: white; - - - color: black; - - - - - /result_gcc_.txt - - - /result_gcc_.txt - - - - - - - - - - color: white; - - - color: black; - - - - - - /result_firm_.txt - - /result_firm_.txt - - - - - - - - - - color: white; - - - color: black; - - - - - /result_diff_.txt - - - /result_diff_.txt - - - - - - - - - - - - - - - - Results - - - OLD:
- NEW:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameCompileLinkGCC CompileGCC RunFirm RunResults
- - buildresult_.txt - - -
- - -
-
diff --git a/ir/be/test/makehtml.xslt b/ir/be/test/makehtml.xslt deleted file mode 100644 index 7023f2ba2..000000000 --- a/ir/be/test/makehtml.xslt +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - background-color: green; color: white; - - - background-color: red; color: white; - - - - - - - - color: white; - - - color: black; - - - result_gcc_.txt - - - - - - - - color: white; - - - color: black; - - - result_firm_.txt - - - - - - - - color: white; - - - color: black; - - - result_diff_.txt - - - - - - - - - - - - - - Results - - - - - - - - - - - - - - - - - - - - - - - -
NameCompileLinkGCC CompileGCC RunFirm RunResults
- - buildresult_.txt - - -
- - -
-
diff --git a/ir/be/test/makereport.sh b/ir/be/test/makereport.sh deleted file mode 100755 index 8dcc1edce..000000000 --- a/ir/be/test/makereport.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash - -export LANG= -export LC_ALL= -export LC_COLLATE= -if test "$1" != "--recursive-hack"; then - "$0" --recursive-hack "$@" - exit $? -else - shift -fi - -EXEC_PREFIX= -if [ "$ECC" = "" ]; then - ECC="eccp" -fi -#EXEC_PREFIX="qemu-arm" -#ECC="/ben/beck/ipd/bin/eccp -march=arm -bra-chordal-co-algo=heur" -ECC_CFLAGS="${ADDCFLAGS} -v -O3 -ffp-strict" -GCC="icc -restrict" -GCC_CFLAGS="-O0 -Itcc -fp-model precise" -LINKFLAGS="-lm" -TIMEOUT_COMPILE=300 -TIMEOUT_RUN=30 -ECC_LINK="gcc -m32" - -CFILES="*.c" -OUTPUTDIR="stats-`date +%y.%m.%d`" - -mkdir -p build_firm -mkdir -p build_gcc -mkdir -p $OUTPUTDIR - -XMLRES=$OUTPUTDIR/result.xml -cat > $XMLRES << __END__ - - - - ${ECC_CFLAGS} - ${GCC_CFLAGS} - -__END__ - -# so endless apps stop at some point... -#ulimit -t 2 - -basedir=`pwd` - -if [ -z "$1" ]; then - DIRS=". langshootout ack" -else - for f in "$@"; do - if test -d "$f"; then - DIRS="$DIRS $f" - else - FILES="$FILES $f" - fi - done -fi -for d in $DIRS; do - for f in $d/*.c; do - FILES="$FILES $f" - done -done - -for file in $FILES; do - curdir="`dirname $file`" - COMPILE_RES="ok" - LINK_RES="omitted" - GCC_RES="ok" - GCC_RUN_RES="omitted" - FIRM_RUN_RES="omitted" - DIFF_RES="omitted" - FILE_FLAGS=`awk '/\/\\*\\$ .* \\$\\*\// { for (i = 2; i < NF; ++i) printf "%s ", $i }' $file` - - name="`basename $file .c`" - obj_name="build_firm/$name.o" - res="$OUTPUTDIR/buildresult_$name.txt" - echo -n "Building $name" - echo "Results for $name" > $res - echo "*** ECC/FIRM Compile" >> $res - CMD="ulimit -t ${TIMEOUT_COMPILE} ; ${ECC} -c -o ${obj_name} ${ECC_CFLAGS} ${FILE_FLAGS} ${file}" - echo "$CMD" >> $res - /bin/sh -c "$CMD" >> $res 2>&1 || { COMPILE_RES="failed"; echo -n " ... FAILED"; } - - if [ ${COMPILE_RES} = "ok" ]; then - LINK_RES="ok" - echo "*** Linking" >> $res - CMD="${ECC_LINK} $obj_name ${LINKFLAGS} -o build_firm/$name.exe" - echo "$CMD" >> $res - $CMD >> $res 2>&1 || { LINK_RES="failed"; echo -n " ... FAILED"; } - fi - - echo "*** GCC Compile" >> $res - CMD="${GCC} ${GCC_CFLAGS} ${FILE_FLAGS} $file ${LINKFLAGS} -o build_gcc/$name.exe" - echo "$CMD" >> $res - /bin/sh -c "$CMD" >> $res 2>&1 || { GCC_RES="failed"; echo -n " ... FAILED"; } - - if [ ${GCC_RES} = "ok" ]; then - GCC_RUN_RES="ok" - - echo "*** Run GCC" >> $res - CMD="ulimit -t ${TIMEOUT_RUN} ; build_gcc/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1" - echo "$CMD" >> $res - /bin/sh -c "$CMD" > $OUTPUTDIR/result_gcc_$name.txt 2>&1 || GCC_RUN_RES="failed" - fi - - if [ ${LINK_RES} = "ok" ]; then - FIRM_RUN_RES="ok" - - echo "*** Run Firm" >> $res - CMD="ulimit -t ${TIMEOUT_RUN} ; ${EXEC_PREFIX} build_firm/$name.exe > $OUTPUTDIR/result_firm_$name.txt 2>&1" - echo "$CMD" >> $res - /bin/sh -c "$CMD" > $OUTPUTDIR/result_firm_$name.txt 2>&1 || { FIRM_RUN_RES="failed"; echo -n " ... FAILED"; } - fi - - if [ ${GCC_RUN_RES} = "ok" -a ${FIRM_RUN_RES} = "ok" ]; then - DIFF_RES="ok" - - echo "*** Compare Results" >> $res - CMD="diff -u $OUTPUTDIR/result_gcc_$name.txt $OUTPUTDIR/result_firm_$name.txt" - $CMD > $OUTPUTDIR/result_diff_$name.txt 2>&1 || { DIFF_RES="failed"; echo -n " ... FAILED"; } - fi - echo - - cat >> $XMLRES << __END__ - - $COMPILE_RES - $LINK_RES - $GCC_RES - $GCC_RUN_RES - $FIRM_RUN_RES - $DIFF_RES - -__END__ -done - -echo "" >> $XMLRES - -xsltproc --output $OUTPUTDIR/index.html makehtml.xslt $XMLRES - -# maybe execute custom actions after result has been generated -[ -e after_compile.sh ] && ./after_compile.sh "$OUTPUTDIR" diff --git a/ir/be/test/max.c b/ir/be/test/max.c deleted file mode 100644 index 4ef574958..000000000 --- a/ir/be/test/max.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -#define MAX (1 << 10) -#define TRUNC 0xff -#define MAX_SHOW TRUNC - -void dump_field(short *field, int size, const char *name) { - int i; - printf("======== %s : START ========\n", name); - for(i = 0; i < size; i++){ - printf("data[%i] = %i\n", i, field[i]); - } - printf("======== %s : END ========\n", name); -} - -void dequant_h263_inter_c(short *data, const short *coeff, const unsigned int quant) { - const unsigned short quant_m_2 = quant << 1; - const unsigned short quant_add = (quant & 1 ? quant : quant - 1); - int i; - - for (i = 0; i < MAX; i++) { - short acLevel = coeff[i]; - - if (acLevel == 0) { - data[i] = 0; - } else if (acLevel < 0) { - acLevel = acLevel * quant_m_2 - quant_add; - data[i] = (acLevel > 2048 ? acLevel : 2048); - } else { - acLevel = acLevel * quant_m_2 + quant_add; - data[i] = (acLevel <= 2047 ? acLevel : 2047); - } - } -} - -int main(int argc, char **argv){ - short cur[MAX]; - short ref[MAX]; - int numofruns = 30; - int i,ii; - - if(argc > 1) - numofruns = atoi(argv[1]); - - for (i = 0; i < numofruns; i++){ - /* Reset cache. Alles andere ist unrealistisch. */ - for(ii = 0; ii < MAX; ii++){ - cur[ii] = 0; - ref[ii] = (ii + i + 3) & TRUNC; - } - - if (i == 0 && argc == 1) - dump_field(ref, MAX_SHOW, "ref"); - - dequant_h263_inter_c(cur, ref, 1024 * (i & 0x3)); - } - - if (argc == 1) - dump_field(cur, MAX_SHOW, "cur"); - - return 0; -} diff --git a/ir/be/test/most_complex_conv.c b/ir/be/test/most_complex_conv.c deleted file mode 100644 index afe309d33..000000000 --- a/ir/be/test/most_complex_conv.c +++ /dev/null @@ -1,7 +0,0 @@ -unsigned int MAX_INT = 4294967295; - -int main(void) { - double res = MAX_INT; - printf("Res: %f\n", res); - return 0; -} diff --git a/ir/be/test/mul.c b/ir/be/test/mul.c deleted file mode 100644 index 55a439836..000000000 --- a/ir/be/test/mul.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -/* - * Multiplication test for mul register constraints - */ -int a = -2, b = 3, c = -4, d = 6, e = -6; -unsigned ua = 2, ub = 3; - -int main() -{ - int A, B, C; - unsigned D; - - A = b * c; - B = A * d; - C = A * e; - D = ua * ub; - - printf("Result: %d %u\n", A+B+C, D); - - return 0; -} diff --git a/ir/be/test/mul2n.c b/ir/be/test/mul2n.c deleted file mode 100644 index 2b6fbc057..000000000 --- a/ir/be/test/mul2n.c +++ /dev/null @@ -1,13 +0,0 @@ -/* should produce only ONE mul, no conv's */ -#include - -int a = 0x80000000; - -int main(void) -{ - unsigned long long x = 3 * (unsigned long long)a; - printf("%lld\n", x); - x = (unsigned long long)a * (unsigned long long)a; - printf("%lld\n", x); - return 0; -} diff --git a/ir/be/test/mulconst.c b/ir/be/test/mulconst.c deleted file mode 100644 index 09cf5e1d7..000000000 --- a/ir/be/test/mulconst.c +++ /dev/null @@ -1,25 +0,0 @@ -/** - * check all kinds of multiplication with constants - */ - -#define test_C(C) \ -int test_##C(int i) { \ - return i * C; \ -} -#define test_N(C) \ -int test_m##C(int i) { \ - return i * -C; \ -} -#include "mulconst.h" -#undef test_C -#undef test_N - -#define test_C(C) printf("%d\n", test_##C(x)); -#define test_N(C) printf("%d\n", test_m##C(x)); - -int x = 1; - -int main() { -#include "mulconst.h" - return 0; -} diff --git a/ir/be/test/mulconst.h b/ir/be/test/mulconst.h deleted file mode 100644 index 040d1c094..000000000 --- a/ir/be/test/mulconst.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * check all kinds of multiplication with constants - */ -test_N(1) -test_N(2) -test_N(3) -test_N(4) -test_N(5) -test_N(6) -test_N(7) -test_N(8) -test_N(9) -test_N(10) -test_N(11) -test_N(12) -test_N(13) -test_N(14) -test_N(15) -test_N(16) -test_N(17) -test_N(18) -test_N(19) -test_N(20) -test_C(0) -test_C(1) -test_C(2) -test_C(3) -test_C(4) -test_C(5) -test_C(6) -test_C(7) -test_C(8) -test_C(9) -test_C(10) -test_C(11) -test_C(12) -test_C(13) -test_C(14) -test_C(15) -test_C(16) -test_C(17) -test_C(18) -test_C(19) -test_C(20) -test_C(27) -test_C(81) -test_C(1560) -test_C(46347) -test_C(348435) diff --git a/ir/be/test/multidim-array.c b/ir/be/test/multidim-array.c deleted file mode 100644 index 96e14c34d..000000000 --- a/ir/be/test/multidim-array.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -typedef int arraya[8][8]; - -int main() -{ - int i = 0,j = 0; - arraya *p; - p = (arraya*)calloc(1,sizeof(arraya)); - (*p) - [i] - [j] = 1; - - return 0; -} diff --git a/ir/be/test/mux.c b/ir/be/test/mux.c deleted file mode 100644 index ba6f828d8..000000000 --- a/ir/be/test/mux.c +++ /dev/null @@ -1,13 +0,0 @@ -/*$ -march=pentium3 $*/ - -int f(int a, int b) { - return a && b ? 11 : 42; -} - -int x = 2, y = 3; - -int main(void) { - int ret = 23 < f(x,y); - printf("%d\n", ret); - return ret; -} diff --git a/ir/be/test/nested_loops.c b/ir/be/test/nested_loops.c deleted file mode 100644 index 300eefa2d..000000000 --- a/ir/be/test/nested_loops.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -int k = 0; - -static void -send_via_write() - { - int r2 = k, fd; - if ( r2 <= 2147483647 ) - { - } - else - { - for (;;) - { - for (;;) - { - r2 = printf( "%d\n", fd ); - if ( r2 < 0 ) - { - continue; - } - if ( r2 != 235 ) - return; - break; - } - } - } - } - -int main(void) { - send_via_write(); - return(0); -} diff --git a/ir/be/test/nested_loops2.c b/ir/be/test/nested_loops2.c deleted file mode 100644 index ad805cb95..000000000 --- a/ir/be/test/nested_loops2.c +++ /dev/null @@ -1,33 +0,0 @@ -#include - -int k = 0; - -static void -send_via_write() { - int r2 = k; - if ( r2 <= 2147483647 ) - { - } - else - { - for (;;) - { - for (;;) - { - r2 = printf( "%d\n", r2 ); -// if ( r2 < 0 ) - { - continue; - } - if ( r2 != 235 ) - return; - } - } - } -} - -int main() -{ - send_via_write(); - return 0; -} diff --git a/ir/be/test/ns.c b/ir/be/test/ns.c deleted file mode 100644 index a6306c85e..000000000 --- a/ir/be/test/ns.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#define MAX_OPERANDS 3 - -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; - -typedef struct ASMInstr { - uint16_t sym; - uint8_t op_type[MAX_OPERANDS]; /* see OP_xxx */ -} ASMInstr; - -const ASMInstr asm_instrs[] = { - { 1, { 2, 3 }}, - /* last operation */ - { 0, }, -}; - -int main() -{ - int i; - - printf("sizeof(asm_instrs[]) = %d\n", sizeof(asm_instrs)); - - - for (i = 0; i < sizeof(asm_instrs)/sizeof(asm_instrs[0]); ++i) { - printf("%d.: %d { %d %d %d }\n", i, - asm_instrs[i].sym, - asm_instrs[i].op_type[0], - asm_instrs[i].op_type[1], - asm_instrs[i].op_type[2] - ); - } - - return 0; -} diff --git a/ir/be/test/nulladd.c b/ir/be/test/nulladd.c deleted file mode 100644 index 5f4deda91..000000000 --- a/ir/be/test/nulladd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -static int * const a = (int *)0x10; -static int * const b = (int *)0x20; - -int main() { - printf("%p\n", b - a); - return 0; -} diff --git a/ir/be/test/nullnode.c b/ir/be/test/nullnode.c deleted file mode 100644 index b669e20af..000000000 --- a/ir/be/test/nullnode.c +++ /dev/null @@ -1,29 +0,0 @@ -struct foo { - int bar; -}; - -struct foo *curcmd; -int tmps_max; -int tmps_base; - -#define CF_FLIP 020000 -#define CF_COND 01000 - -int main() { - struct foo *cmd; - int cmdflags; - - if (cmdflags & CF_COND) { - - goto maybe; - flipmaybe: - if (cmdflags) { - while (tmps_max > tmps_base) { /* clean up after last eval */ - } - } - maybe: - curcmd = cmd; - } - - return 0; -} diff --git a/ir/be/test/optest.c b/ir/be/test/optest.c deleted file mode 100644 index e1a790fec..000000000 --- a/ir/be/test/optest.c +++ /dev/null @@ -1,81 +0,0 @@ -#include - -#define tname(x) x##long -#define T long -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##int -#define T int -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##short -#define T short -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##char -#define T char -#include "optest.h" - -#define TEST_UNSIGNED - -#undef tname -#undef T -#define tname(x) x##unsigned_long -#define T unsigned long -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##unsigned_int -#define T unsigned int -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##unsigned_short -#define T unsigned short -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##unsigned_char -#define T unsigned char -#include "optest.h" - -#if 0 -#undef tname -#undef T -#define tname(x) x##unsigned_long_long -#define T unsigned long long -#include "optest.h" - -#undef TEST_UNSIGNED - -#undef tname -#undef T -#define tname(x) x##long_long -#define T long long -#include "optest.h" -#endif - -int main(int argc, char *argv[]) { - test_long(); - test_int(); - test_short(); - test_char(); - test_unsigned_long(); - test_unsigned_int(); - test_unsigned_short(); - test_unsigned_char(); -#if 0 - test_unsigned_long_long(); - test_long_long(); -#endif - return 0; -} diff --git a/ir/be/test/optest.h b/ir/be/test/optest.h deleted file mode 100644 index 67428b9f8..000000000 --- a/ir/be/test/optest.h +++ /dev/null @@ -1,168 +0,0 @@ -#include - -#ifndef TESTANZ -#define TESTANZ 21 -#define IMM 23 -#define IMM_SHIFT 4 -#define test16_1 42 -#define test16_2 11 -#define test16_shift 7 -#define test32_1 (T) 0x001200AB -#define test32_2 (T) 0x00341501 -#define test32_shift 5 -#define test32_s 7 -#endif - -T tname(test_add_) (T a, T b) { - return a+b; -} - -T tname(test_addi_) (T a) { - return a+IMM; -} - -T tname(test_sub_) (T a, T b) { - return a-b; -} - -T tname(test_subi_) (T a) { - return a-IMM; -} - -T tname(test_subfi_) (T a) { - return IMM-a; -} - -T tname(test_mul_) (T a, T b) { - return a*b; -} - -T tname(test_muli_) (T a) { - return a*IMM; -} - -T tname(test_div_) (T a, T b) { - return a/b; -} - -T tname(test_divi_) (T a) { - return a/IMM; -} - -#ifndef TEST_UNSIGNED -T tname(test_abs_) (T a) { - return a < 0 ? -a : a; -} - -T tname(test_neg_) (T a) { - return -a; -} -#endif - -#ifndef TEST_FLOAT -T tname(test_shl_) (T a, T b) { - return a<>b; -} - -T tname(test_shri_) (T a) { - return a>>IMM_SHIFT; -} - -T tname(test_mod_) (T a, T b) { - return a%b; -} -#endif - -T tname(test_cmp_) (T a, T b) { - return (a>b) ? 1 : 0; -} - -T tname(test_cmpi_) (T a) { - return (a>IMM) ? 1 : 0; -} - -T tname(res16_) [TESTANZ]; -T tname(res32_) [TESTANZ]; - -void tname(test_) () { - int i; - T *res16 = tname(res16_); - memset(res16, 0, TESTANZ * sizeof(res16[0])); - T *res32 = tname(res32_); - memset(res32, 0, TESTANZ * sizeof(res32[0])); - - res16[ 0] = tname(test_add_) (test16_1, test16_2); - res16[ 1] = tname(test_sub_) (test16_1, test16_2); - res16[ 2] = tname(test_mul_) (test16_1, test16_2); - res16[ 3] = tname(test_div_) (test16_1, test16_2); -#ifndef TEST_FLOAT - res16[ 4] = tname(test_shl_) (test16_1, test16_shift); - res16[ 5] = tname(test_shr_) (test16_1, test16_shift); - res16[ 6] = tname(test_mod_) (test16_1, test16_2); -#endif - res16[ 7] = tname(test_div_) (test16_1, test16_2); - res16[ 8] = tname(test_cmp_) (test16_1, test16_2); - res16[ 9] = tname(test_addi_) (test16_1); - res16[10] = tname(test_subi_) (test16_1); - res16[11] = tname(test_subfi_)(test16_1); - res16[12] = tname(test_muli_) (test16_1); - res16[13] = tname(test_divi_) (test16_1); -#ifndef TEST_FLOAT - res16[14] = tname(test_shli_) (test16_1); - res16[15] = tname(test_shri_) (test16_1); -#endif - res16[16] = tname(test_cmpi_) (test16_1); -#ifndef TEST_UNSIGNED - res16[17] = tname(test_neg_) (test16_1); - res16[18] = tname(test_neg_) (-test16_1); - res16[19] = tname(test_abs_) (test16_1); - res16[20] = tname(test_abs_) (-test16_1); -#endif - - res32[ 0] = tname(test_add_) (test32_1, test32_2); - res32[ 1] = tname(test_sub_) (test32_1, test32_2); - res32[ 2] = tname(test_mul_) (test32_1, test32_2); - res32[ 3] = tname(test_div_) (test32_1, test32_2); -#ifndef TEST_FLOAT - res32[ 4] = tname(test_shl_) (test32_1, test32_shift); - res32[ 5] = tname(test_shr_) (test32_1, test32_shift); - res32[ 6] = tname(test_mod_) (test32_1, test32_2); -#endif - res32[ 7] = tname(test_div_) (test32_1, test32_2); - res32[ 8] = tname(test_cmp_) (test32_1, test32_2); - res32[ 9] = tname(test_addi_) (test32_1); - res32[10] = tname(test_subi_) (test32_1); - res32[11] = tname(test_subfi_)(test32_1); - res32[12] = tname(test_muli_) (test32_1); - res32[13] = tname(test_divi_) (test32_1); -#ifndef TEST_FLOAT - res32[14] = tname(test_shli_) (test32_1); - res32[15] = tname(test_shri_) (test32_1); -#endif - res32[16] = tname(test_cmpi_) (test32_1); -#ifndef TEST_UNSIGNED - res32[17] = tname(test_neg_) (test32_1); - res32[18] = tname(test_neg_) (-test32_1); - res32[19] = tname(test_abs_) (test32_1); - res32[20] = tname(test_abs_) (-test32_1); -#endif - - printf("Result for %s\n", __PRETTY_FUNCTION__); - for (i=0; i - -#define TEST_FLOAT - -#define tname(x) x##float -#define T float -#include "optest.h" - -#undef tname -#undef T -#define tname(x) x##double -#define T double -#include "optest.h" - -#if 0 -#undef tname -#undef T -#define tname(x) x##long_double -#define T long_double -#include "optest.h" -#endif - -int main(int argc, char *argv[]) { - test_float(); - test_double(); -#if 0 - test_long_double(); -#endif - return 0; -} diff --git a/ir/be/test/pad_return.c b/ir/be/test/pad_return.c deleted file mode 100644 index 0dea4e559..000000000 --- a/ir/be/test/pad_return.c +++ /dev/null @@ -1,16 +0,0 @@ -int A; - -int test(int a) { - if (a == 23) - goto end; - while (A != 0) { - A = A * a; - } -end: - /* return should be padded by using ret $0 */ - return a; -} - -int main(int argc, char *argv[]) { - return 23 != test(23); -} diff --git a/ir/be/test/pbqpHeur.c b/ir/be/test/pbqpHeur.c deleted file mode 100644 index 6f84b3327..000000000 --- a/ir/be/test/pbqpHeur.c +++ /dev/null @@ -1,32 +0,0 @@ -char *block; - -int k3_3(int i1, int i2, int i3) { - char a1, a2, a3; - char b1, b2, b3; - char c1, c2, c3; - - a1 = block[++i1]; - a2 = block[++i2]; - a3 = block[++i3]; - - b1 = block[++i1]; - b2 = block[++i2]; - b3 = block[++i3]; - - c1 = block[++i1]; - c2 = block[++i2]; - c3 = block[++i3]; - - if (a1 != a2) - return a3; - if (b1 != b2) - return b3; - if (c1 != c2) - return c3; - - return 0; -} - -int main(int argc, char **argv) { - return 0; -} diff --git a/ir/be/test/pbqpHeur2.c b/ir/be/test/pbqpHeur2.c deleted file mode 100644 index 9f01d9aa0..000000000 --- a/ir/be/test/pbqpHeur2.c +++ /dev/null @@ -1,166 +0,0 @@ -/** - * This test case should provoke incompatible heuristical decision of the - * PBQP solver, which lead to infinity cost, i.e. no solution of the PBQP could - * found. - * - * It is necessary to manipulation some cost vectors to let the PBQP solver - * "crash". More details are shown below. - * - * This also seems more a missing feature of the PBQP solver than a counter - * example against the PBQP approach for instruction selection. - */ - -unsigned *block; -unsigned *block1, *block2, *block3, *block4, *block5, *block6; -unsigned *block7, *block8,*block9,*block10,*block11; -volatile unsigned arr[100]; -unsigned b = 3008; -unsigned g1,g2,g3; -unsigned g4,g5,g6; -unsigned g7,g8; -unsigned h1,h2,h3; -unsigned h4,h5,h6; -unsigned h7,h8,h9; -unsigned k1,k2,k3; -unsigned k4,k5,k6; -unsigned kb1,kb2,kb3; -unsigned kc1,kc2,kc3; -unsigned kd1,kd2,kd3; -unsigned ke1,ke2,ke3; - -unsigned k3_3(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, unsigned k2, unsigned k3) -{ - char a1, a2, a3; - char b1, b2, b3; - char c1, c2, c3; - - a1 = i1 + k1; - a2 = base[i2 + k1]; - a3 = base[i3 + k1]; - - b1 = i1 + k2; - b2 = base[i2 + k2]; - b3 = base[i3 + k2]; - - c1 = i1 + k3; - c2 = base[i2 + k3]; - c3 = base[i3 + k3]; - - if (a1 != a2) - return a3; - if (b1 != b2) - return b3; - if (c1 != c2) - return c3; - - return 0; -} - -unsigned k3_3_2(char* base, int i1, int i2, int i3, int k1, int k2, int k3) -{ - char a1, a2, a3; - char b1, b2, b3; - char c1, c2, c3; - - a1 = base[i1 + k1]; - a2 = base[i2 + k1]; - a3 = base[i3 + k1]; - - b1 = base[i1 + k2]; - b2 = base[i2 + k2]; - b3 = base[i3 + k2]; - - c1 = base[i1 + k3]; - c2 = base[i2 + k3]; - c3 = base[i3 + k3]; - - if (a1 != a2) - return a3; - if (b1 != b2) - return b3; - if (c1 != c2) - return c3; - - return 0; -} - -unsigned k3_3_am(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, unsigned k2, unsigned k3) -{ - char a1, a2, a3; - char b1, b2, b3; - char c1, c2, c3; - - a1 = base[i1 + k1]; - a2 = base[i2 + k1]; - a3 = base[i3 + k1]; - - b1 = base[i1 + k2]; - b2 = base[i2 + k2]; - b3 = base[i3 + k2]; - - c1 = base[i1 + k3]; - c2 = base[i2 + k3]; - c3 = base[i3 + k3]; - - if (a1 != a2) - return a3; - if (b1 != b2) - return b3; - if (c1 != c2) - return c3; - - return 0; -} - -void full_am(unsigned base, int index, unsigned base2, int index2, unsigned base3, int index3, unsigned base4, int index4, unsigned base5, int index5) -{ - /* - * This is the core of this example. - * The following line can be done with one instruction - * (add with address mode) on x86. - * We provoke four heuristical decision on nodes of this address mode - * pattern. The mean idea is that the root (the add node) choose this - * pattern, but the decision on the shift const forbid these. - * To achieve this you have to manipulate the cost of the shift const by - * hand! - * The other two heuristical decision ensure, that the two heuristical - * decision above are separated, i.e. there are at least two irreducible - * nodes between them. - */ - unsigned ca = arr[index] + base; - - /* - * The following function ensure irreducible users of given nodes. - * All of these function have to be inlined. - */ - - /* users for shift const */ - b = k3_3_am(block, h1, h2, h3, 2, 3, 4); - b = k3_3_am(block, h4, h5, h6, 2, 5, 6); - b = k3_3_am(block, h7, h8, h9, 2, 7, 8); - - /* users for symconst */ - unsigned cb = arr[index2] + base2; - b = k3_3(block1, cb, kb1, kb2, 101, 102, 103); - unsigned cc = arr[index3] + base3; - b = k3_3(block2, cc, kc1, kc2, 111, 112, 113); - unsigned cd = arr[index4] + base4; - b = k3_3(block3, cd, kd1, kd2, 121, 122, 123); - unsigned ce = arr[index5] + base5; - b = k3_3(block4, ce, ke1, ke2, 131, 132, 133); - - /* users for offset */ - b = k3_3_2(block5, 4 * index, g1, g2, 31, 32, 33); - b = k3_3_2(block6, 4 * index, g3, g4, 34, 35, 36); - b = k3_3_2(block7, 4 * index, g5, g6, 37, 38, 39); - b = k3_3_2(block8, 4 * index, g7, g8, 40, 41, 42); - - /* users for computed value */ - b = k3_3(block9, ca, k1, k2, 13, 14, 15); - b = k3_3(block10, ca, k3, k4, 16, 17, 18); - b = k3_3(block11, ca, k5, k6, 19, 20, 21); -} - -int main(int argc, char **argv) { - return 0; -} diff --git a/ir/be/test/pbqpHeur3.c b/ir/be/test/pbqpHeur3.c deleted file mode 100644 index db2583a45..000000000 --- a/ir/be/test/pbqpHeur3.c +++ /dev/null @@ -1,146 +0,0 @@ -/** - * This test case shows that it's not possible to find a PBQP solution for - * arbitrary pattern sets. - * - * You also have to use the following compiler flags: - * -O3 -fno-reassociation - * - * Because of the disabled reassociation you have to add the following rule: - * - Add(Add(Shl(ShiftConst(), index=IR_node()), imm=Const()), base=IR_node()) - * - * To get infinity costs you have to remove the following Lea rules: - * - Add(Shl(ShiftConst(), index=IR_node()), imm=Const()) - * - Add(Shl(ShiftConst(), index=IR_node()), base=IR_node()) - * - * For more details take a look at the diamond function. - */ -unsigned a; -unsigned b; -unsigned *gi1, gi2, gi3, gi4, gi5; -unsigned *gi101, gi102, gi103, gi104, gi105; -unsigned *gi201, gi202, gi203, gi204, gi205; -unsigned *gi211, gi212, gi213, gi214, gi215; -unsigned *gi301, gi302, gi303, gi304, gi305; -unsigned *gi311, gi312, gi313, gi314, gi315; -unsigned *gi401, gi402, gi403, gi404, gi405; -unsigned *gi411, gi412, gi413, gi414, gi415; -unsigned *gi501, gi502, gi503, gi504, gi505; -unsigned *gi511, gi512, gi513, gi514, gi515; -unsigned *gi601, gi602, gi603, gi604, gi605; -unsigned *gi611, gi612, gi613, gi614, gi615; -unsigned *gi701, gi702, gi703, gi704, gi705; -unsigned *gi711, gi712, gi713, gi714, gi715; -unsigned *gi801, gi802, gi803, gi804, gi805; -unsigned *gi811, gi812, gi813, gi814, gi815; -unsigned **gp; -unsigned use; - -int main(int argc, char **argv) -{ - return 0; -} - -unsigned add_1_shift_users(unsigned i1, unsigned i2, unsigned i3, - char *k1, char *k2, char *k3, - unsigned **gp1, unsigned **gp2, unsigned **gp3, unsigned **gp4, - unsigned **gp5, unsigned **gp6, unsigned **gp7, unsigned **gp8, - unsigned **gp9, - const int c1, const int c2, const int c3) -{ - unsigned tmp1 = i1 + c1; - unsigned tmp2 = (i2 << 3) + c2; - unsigned tmp3 = (i3 << 3) + c3; - - *gp1 = tmp1 + k1; - *gp2 = tmp2 + k1; - *gp3 = tmp3 + k1; - - *gp4 = tmp1 + k2; - *gp5 = tmp2 + k2; - *gp6 = tmp3 + k2; - - *gp7 = tmp1 + k3; - *gp8 = tmp2 + k3; - *gp9 = tmp3 + k3; - - return 0; -} - -unsigned add_3_add_const_shift_users(unsigned i1, unsigned i2, unsigned i3, - char *k1, char *k2, char *k3, - unsigned **gp1, unsigned **gp2, unsigned **gp3, unsigned **gp4, - unsigned **gp5, unsigned **gp6, unsigned **gp7, unsigned **gp8, - unsigned **gp9, - const int c1, const int c2) -{ - unsigned tmp2 = (i2 << 3) + c1; - unsigned tmp3 = (i3 << 3) + c2; - - *gp1 = i1 + k1; - *gp2 = tmp2 + k1; - *gp3 = tmp3 + k1; - - *gp4 = i1 + k2; - *gp5 = tmp2 + k2; - *gp6 = tmp3 + k2; - - *gp7 = i1 + k3; - *gp8 = tmp2 + k3; - *gp9 = tmp3 + k3; - - return 0; -} - -void diamond(void) -{ - /* - * This is the basic structure. - * - * as - * / \ - * asb asc - * \ / - * sum - * - * The basic idea is to make a heuristical "consume me" decision for "as". - * If "asb" and "asc" have no terminal rules which consumes "as", they also - * have to be consumed. Therefore "sum" has to consume both paths up to - * "as", which isn't possible. - */ - unsigned as = a << 3; - unsigned asb = as + 123235; - unsigned asc = as + 235346; - unsigned sum = asb + asc; - - b = sum; - - /* Add 3 users for asb. */ - use = add_3_add_const_shift_users(asb, gi1, gi2, - &gi3, &gi4, &gi5, - &gp[0], &gp[1], &gp[2], &gp[3], &gp[4], &gp[5], &gp[6], &gp[7], &gp[8], - 7, 8); - - /* Add 3 users for asc. */ - use = add_3_add_const_shift_users(asc, gi101, gi102, - &gi103, &gi104, &gi105, - &gp[100], &gp[101], &gp[102], &gp[103], &gp[104], &gp[105], &gp[106], &gp[107], &gp[108], - 107, 108); - - /* Add 4 users for as. */ - use = add_1_shift_users(as, gi201, gi202, - &gi203, &gi204, &gi205, - &gp[200], &gp[201], &gp[202], &gp[203], &gp[204], &gp[205], &gp[206], &gp[207], &gp[208], - 200, 201, 202); - use = add_1_shift_users(as, gi301, gi302, - &gi303, &gi304, &gi305, - &gp[300], &gp[301], &gp[302], &gp[303], &gp[304], &gp[305], &gp[306], &gp[307], &gp[308], - 300, 301, 302); - use = add_1_shift_users(as, gi401, gi402, - &gi403, &gi404, &gi405, - &gp[400], &gp[401], &gp[402], &gp[403], &gp[404], &gp[405], &gp[406], &gp[407], &gp[408], - 400, 401, 402); - use = add_1_shift_users(as, gi501, gi502, - &gi503, &gi504, &gi505, - &gp[500], &gp[501], &gp[502], &gp[503], &gp[504], &gp[505], &gp[506], &gp[507], &gp[508], - 500, 501, 502); -} diff --git a/ir/be/test/pbqp_RedN.c b/ir/be/test/pbqp_RedN.c deleted file mode 100644 index 21ed31bb5..000000000 --- a/ir/be/test/pbqp_RedN.c +++ /dev/null @@ -1,21 +0,0 @@ -#define GAMMEL - -double M; - -int main(void) -{ - int j; -#ifdef GAMMEL - int Ke[1], Me[42], Ce[42]; -#else - int Me[42], Ce[42]; -#endif - - while(!j) - for (j = 0; j < 1; j++) - M = Me[j] + Me[j + 1] + Me[j + 2] + Ce[j] + Ce[j + 1] + Ce[j + 2]; - - printf("done.\n"); - - return 0; -} diff --git a/ir/be/test/phi_bad.c b/ir/be/test/phi_bad.c deleted file mode 100644 index 91ee5d145..000000000 --- a/ir/be/test/phi_bad.c +++ /dev/null @@ -1,21 +0,0 @@ -static int A; - -/* This function produces unnecessary Phi nodes due to the way - * x is assigned. Note: This is not a bug, its by the Phi construction algorithm. */ -void test(int l, int m) { - int i, x = m; - - for (i = 0; i < l; ++i) { - A = x; - - if (l > 5) - x = m; - } -} - -int main() -{ - test(4,5); - printf("A = %d\n", A); - return 0; -} diff --git a/ir/be/test/postinc.c b/ir/be/test/postinc.c deleted file mode 100644 index a237c226d..000000000 --- a/ir/be/test/postinc.c +++ /dev/null @@ -1,12 +0,0 @@ -static void postinc_break(int *a, int *b) { - // assumes sizeof(int) == sizeof(int*) - *a = b+1; - *b = a+1; -} - -int main(void) { - int a, b; - postinc_break(&a, &b); - printf("%d\n", a-b); - return 0; -} diff --git a/ir/be/test/psi_test.c b/ir/be/test/psi_test.c deleted file mode 100644 index 96ecdd119..000000000 --- a/ir/be/test/psi_test.c +++ /dev/null @@ -1,28 +0,0 @@ -int func (int a, int b) { - return a == b; -} - -double func2(double a, double b) { - return a != b ? a : b; -} - -int func3(double a, double b) { - return a != b; -} - -int func4(double a, double b, int c, int d) { - return a > b ? c : d; -} - -double func5(double a, double b, int c, int d) { - return c < d ? a : b; -} - -int func6(double a, double b) { - return a == 0.0 && b + 1.0 < 10.0; -} - -int main() -{ - return 0; -} diff --git a/ir/be/test/ptr_to_int.c b/ir/be/test/ptr_to_int.c deleted file mode 100644 index a91a053af..000000000 --- a/ir/be/test/ptr_to_int.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -char* ptr(void) -{ - return (char*) 123; -} - -int main() -{ - printf("Int: %d\n", (int) ptr()); - return 0; -} diff --git a/ir/be/test/queens-handoptimized.c b/ir/be/test/queens-handoptimized.c deleted file mode 100644 index 0f71a4a98..000000000 --- a/ir/be/test/queens-handoptimized.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Project: GCC-firm - * File name: test/Queens.c - * Purpose: solve the queens problem - * Author: Markus Armbruster (in sather-k) - * Modified by: Michael Beck (for GCC-firm) - * Created: XX.11.2001 - * CVS-ID: $Id$ - * Copyright: (c) 2001 Universitaet Karlsruhe - * Licence: - */ -/* - -- The notorious n-queens problem (C.F. Gauss, 1850) - -- Copyright (C) 1996 Markus Armbruster -*/ - -#include -#include - - -typedef int boolean; - -#define true 1 -#define false 0 - -//static int *row; -// queen in column c is at row[c] - -static int myabs(int i) { - if(0 > i) - i = -i; - return(i); -} - -static inline boolean place_ok (int i, const int *r, int ri) { - // return whether queen in column i is - // not in check from queens left of it - int j = 0; - boolean res; - -#if 0 - if(0 >= i) - return true; - - do { - int rj = r[j]; - if ((rj == ri) || ((myabs(ri-rj)) == (i-j))) { - res = false; - return(res); - } - j = j+1; - } while(j < i); - - res = true; - return(res); -#else - while (j < i) { - int rj = r[j]; - if ((rj == ri) || ((myabs(ri-rj)) == (i-j))) { - res = false; - return(res); - } - j = j+1; - } - - res = true; - return(res); -#endif -} - -int solve (int n) { - // return the number of solutions to the n-queens problem - int c = 0; - int res = 0; - int *row; - - row = malloc(sizeof(*row) * n); - row[0] = -1; - while (c >= 0) { - int rc = row[c]; - - do { - rc++; - } while ((rc < n) && (!place_ok(c, row, rc))); - - if (rc < n) { // successfully placed at (c,row[c]) - row[c] = rc; - - if (c == n-1) - res = res+1; - else { - c = c+1; - row[c] = -1; - } - continue; - } - - row[c] = rc; - c = c-1; - } - free(row); - - return(res); -} - -static void usage (const char *progname) { - printf("usage: %s\n", progname); -} - - -int main (int argc, char *argv[]) { - int n; - - switch (argc) { - case 1: - n = 8; - break; - case 2: - n = atoi(argv[1]); - break; - default: - usage("queens"); - return 0; - } - printf("The %d-queens problem has %d solutions.\n", n, solve(n)); - - return 0; -} diff --git a/ir/be/test/rantext.h b/ir/be/test/rantext.h deleted file mode 100644 index 6c9bad170..000000000 --- a/ir/be/test/rantext.h +++ /dev/null @@ -1,514 +0,0 @@ -int freq_tab[MAXPRINTABLE][MAXPRINTABLE] = { -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,332,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1082,0,0,0,0,0,2,1174,493,0,0,0,0,17,0,0,0,51,48,29,1,1,1,1,1,1,0,0,0,0,0,0, -0,13558,4764,2161,1737,907,3159,1683,5183,9882,146,442,2003,3755,3133,4188,1430,83,774,4976,15912,816,224,10094,0,2597,3,6246,0,0,0,0, -0,1938,810,837,594,312,687,377,1107,652,37,170,468,881,460,647,592,51,296,1270,2699,185,122,1102,0,446,0,0,626,0,0,4, -0,0,0,0,0,0,0,0,0,85336,47895,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -309,0,0,9,1,0,2,328,1,0,0,0,0,5,34,2,0,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,3697,2611,3554,2217,804,2438,1312,1855,989,487,1732,2207,2400,530,1482,2838,520,1039,4077,2563,212,568,1063,63,245,1,2,0,0,0,0, -0,12,3,3,0,0,5,1,12,3,0,0,0,3,1,7,2,0,5,8,14,1,0,3,0,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,10,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -16269,0,1,0,1,0,70,2867,181,0,0,0,0,4,3,4,0,6,4,2,1,1,7,0,2,0,5,0,0,1,0,0, -0,3901,2838,4171,1689,2319,1943,2581,3443,19536,1185,908,3203,3037,992,2406,3011,317,1788,3595,3268,96,1630,2352,41,873,0,17,2,13,0,0, -0,66153,36457,24728,25199,11137,30305,15793,53432,33915,1673,6956,23787,48138,22792,35659,20512,1688,10990,55787,106335,8005,4293,47563,0,22389,53,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,5061,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3940,1,0,0,0,0,0,198,0,0,0,0,0,139,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,697,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2325,12,0,0,0,0,0,26,0,0,0,0,7,61,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,44, -0,121,58,43,25,14,106,81,86,133,9,3,53,48,41,78,33,1,17,241,905,3,10,128,0,24,17,0,0,14,0,0, -0,56,36,69,5785,1187,48,123,36,28,3,4,2650,69,113,31,26,3,152,8938,2414,4,21,27,0,14,2,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,19,26,39,19,11,116,43,23,3,4,21,25,41,10,11,31,8,9,151,39,0,7,12,0,5,0,0,0,0,0,0, -0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,43,615,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -16,0,0,0,0,0,0,0,0,0,0,0,5,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,7,24160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -65505,0,0,0,0,0,0,372,0,0,0,0,0,845,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1186,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -10,0,0,0,0,0,0,27,0,0,0,0,1,2269,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,12,31,27,19,4,16,31,41,62,71,2,16,42,9,62,15,1,11,40,15,5,4,25,0,6,0,0,0,0,0,0, -0,287,504,301,467,432,327,172,381,82,30,50,280,498,253,85,265,13,141,473,366,36,62,347,0,45,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,7,30574,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -7080,0,0,0,0,0,0,453,0,1,0,0,7,56,0,0,2,2,0,0,0,2,0,0,0,0,0,1,0,0,0,0, -0,2,2,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,18,4,0,0,0,0,0,0,0,2,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,6,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -50,0,0,0,0,0,0,0,0,0,0,0,0,6,1,0,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -49,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -29,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,5,6694,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -7757,0,0,0,0,0,0,101,0,667,0,0,0,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,7551,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -9376,0,0,0,0,0,0,79,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,7775,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2715,0,0,0,0,0,0,72,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3036,103,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2178,1,0,0,0,0,0,59,0,0,0,0,194,7,3,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0, -0,72,524,1681,848,535,665,893,7,280,66,45,2753,1284,5204,0,389,92,5550,1355,1606,988,389,20,72,76,11,0,0,249,0,3, -0,26,135,177,183,3,111,227,151,11,65,0,1063,187,8942,0,155,9,601,1952,577,110,17,189,0,682,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -10,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1119,30,0,0,1890,0,0,19,574,1,0,111,0,0,626,0,0,669,6,1,587,0,7,0,284,0,0,0,0,0,0, -0,427,0,0,0,1811,0,0,0,200,0,0,158,0,0,458,0,0,583,0,0,2841,0,0,0,834,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,33,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -4,0,0,0,0,0,0,4,0,4,0,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, -0,1909,269,21,92,3327,3,0,1810,786,0,1004,1225,6,0,1104,0,1,373,0,1123,789,8,0,40,198,0,0,0,2,0,0, -0,1712,0,0,0,76,0,0,513,312,0,0,778,0,2,1960,0,0,233,0,0,138,0,0,0,68,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1623,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -802,0,0,0,0,0,0,9,0,0,0,0,123,15,2,0,0,0,0,0,0,0,0,0,0,0,27,2,0,0,0,0, -0,563,0,1,12,1637,44,148,0,1280,0,0,10,107,2,1316,3,0,964,122,0,1064,12,220,0,347,0,0,0,114,0,2, -0,245,0,0,0,586,0,0,0,668,0,0,0,0,0,1003,0,0,221,0,0,371,0,4,0,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,2721,177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -2125,0,0,0,0,0,0,46,0,0,0,0,170,30,9,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,0,0, -0,779,186,188,1190,784,18,162,4,114,0,5,2564,842,5806,971,297,7,4116,4062,2218,376,142,205,167,428,2,0,0,137,0,0, -0,178,2,6,288,0,3,96,0,67,0,0,94,63,2635,1,55,3,125,29,27,21,344,0,2191,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,602,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1066,0,0,0,0,0,0,2,0,0,0,0,23,1,1,0,0,0,0,0,0,0,0,0,0,0,5,1,0,0,0,0, -0,647,0,0,0,439,962,0,0,119,0,0,253,0,0,710,0,0,268,0,35,14,0,0,0,3,0,0,0,24,0,0, -0,724,0,0,0,193,0,0,0,1300,0,0,246,0,0,2445,0,0,1190,0,0,80,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,204,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1802,0,0,0,0,0,0,9,0,0,0,0,12,10,16,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0, -0,718,189,0,0,855,0,11,410,55,0,0,682,2,66,693,0,0,409,109,2,346,0,0,0,2,0,0,0,11,0,0, -0,230,0,0,0,602,0,0,58,392,0,0,205,0,2,2065,0,0,492,0,0,101,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,804,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -206,0,0,0,0,0,0,3,0,0,0,0,53,2,3,0,0,0,0,0,0,0,0,0,0,0,9,1,0,0,0,0, -0,2020,59,0,0,2804,2,0,0,744,0,0,3,38,271,850,1,0,73,87,72,560,0,6,0,139,0,0,0,57,0,0, -0,1821,0,0,0,3488,0,0,0,666,0,0,0,0,0,1673,0,0,0,0,0,191,0,0,0,29,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1109,1063,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -19729,9,0,0,0,0,0,1949,0,0,0,0,404,2,195,0,0,0,0,0,0,0,0,0,0,0,31,59,0,0,0,31, -0,2774,122,2002,547,379,144,247,2,1816,0,34,1240,768,5766,3087,336,0,936,1560,684,2234,846,24,93,0,179,0,0,16,0,0, -0,69,0,5,7,0,1535,2,0,0,0,0,45,96,1508,3,2,0,63,940,982,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,179,0,0,0,42,0,0,0,0,0,0,0,0,0,353,0,0,0,0,0,331,0,0,0,0,0,0,0,0,0,0, -0,142,0,0,0,183,0,0,0,2,0,0,0,0,0,435,0,0,0,0,0,328,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1077,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -288,0,0,0,0,0,0,7,0,0,0,0,92,11,4,0,0,0,0,0,0,0,0,0,0,0,23,3,0,0,0,0, -0,235,0,0,0,1056,1,0,1,2102,0,0,152,0,9,0,0,0,1,9,1,0,0,2,0,3,0,0,0,53,0,0, -0,161,0,0,0,150,0,0,0,355,0,0,0,0,237,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,636,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -338,0,0,0,0,0,0,29,0,0,0,0,57,11,6,0,0,0,0,0,0,0,0,0,0,0,11,1,0,0,0,0, -0,2648,207,294,163,3422,39,6,0,2718,0,270,1857,56,5,2483,187,0,0,633,164,1367,219,1,30,558,0,0,0,51,0,0, -0,605,0,0,0,1322,0,0,0,471,0,0,1,0,0,1905,0,0,0,0,0,295,0,0,0,62,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,448,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -58,0,0,0,0,0,0,0,0,0,0,0,44,0,6,0,0,0,0,0,0,0,0,0,0,0,6,1,0,0,0,0, -0,1972,315,0,0,1361,0,0,0,1534,0,0,409,21,144,1310,302,0,1,33,0,255,0,26,0,13,0,0,0,29,0,0, -0,2185,0,0,0,772,0,0,0,427,0,0,0,0,0,856,0,0,0,0,0,468,0,0,0,1746,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1995,140,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -940,0,0,0,0,0,0,14,0,0,0,0,149,13,4,0,0,0,0,0,0,0,0,0,0,0,15,5,0,0,0,0, -0,1759,48,1688,2027,2539,7,2691,8,1816,3,18,44,33,210,994,2,54,1164,551,2454,415,91,65,0,519,116,0,0,143,0,0, -0,639,0,0,0,375,0,0,0,70,0,0,0,0,0,3030,0,0,0,0,0,142,0,0,0,22,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4275,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1671,22,0,0,0,0,0,92,0,0,0,0,1390,2,8,0,0,0,0,0,0,0,0,0,0,0,9,3,0,0,0,1, -0,73,419,459,154,15,1147,219,265,282,2,162,2490,1110,3740,77,537,0,3118,963,1099,1126,128,370,92,118,5,0,0,252,0,0, -0,1,35,48,11,0,1168,0,25,0,0,0,122,7,516,0,71,0,792,12,64,568,29,12,30,1,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,91,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -83,0,0,0,0,0,0,3,0,0,0,0,6,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0, -0,1231,0,21,0,1338,0,0,899,352,0,1,96,0,0,707,90,0,897,45,99,392,0,0,0,6,0,0,0,1,0,0, -0,763,0,0,0,548,0,0,142,178,0,0,278,0,0,541,0,0,971,2,5,172,0,0,0,77,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,933,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,164,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1899,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -808,0,0,0,0,0,0,42,0,0,0,0,181,19,8,0,0,0,0,0,0,0,0,0,0,0,27,1,0,0,0,0, -0,1829,214,483,2251,2026,89,415,2,3501,2,634,539,306,402,2938,17,2,201,477,975,950,93,248,0,1432,0,0,0,140,0,0, -0,126,0,0,0,944,0,0,13,341,0,0,0,0,0,985,0,0,0,0,0,106,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,5987,299,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1773,1,0,0,0,0,0,21,0,1,0,0,509,8,29,0,0,0,0,0,0,0,0,0,0,0,42,11,0,2,0,0, -0,1407,153,1030,193,966,0,0,533,1795,0,18,133,19,29,332,425,8,29,1707,3102,466,0,70,0,213,0,0,0,418,0,0, -0,636,11,152,1,1796,1,0,1568,1458,0,7,104,43,24,1903,311,4,0,0,692,410,0,223,0,56,0,0,0,1,0,0, -0,0,0,0,0,0,0,0,0,1727,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -924,1,0,0,0,0,0,23,0,0,0,0,101,21,9,0,0,0,0,0,0,0,0,0,0,0,20,2,0,0,0,0, -0,1699,1,48,2,2191,0,5,2051,2494,15,0,65,88,2,1665,2,0,1795,146,171,885,0,47,0,92,79,0,0,97,0,0, -0,526,0,0,0,296,0,0,13938,1134,0,0,0,0,0,3993,0,0,642,0,0,206,0,235,0,121,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -27,0,0,0,0,0,0,2,0,0,0,0,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,24,99,1883,425,787,342,210,0,372,0,647,871,523,596,53,63,0,823,5743,620,0,15,0,11,0,0,0,0,8,0,0, -0,0,0,0,0,0,0,1,0,0,0,0,22,1,510,0,368,0,21,31,6,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,492,394,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -8,0,0,0,0,0,0,2,0,1,0,0,16,0,42,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0, -0,352,0,0,0,481,0,0,0,1703,0,0,0,0,0,266,0,0,0,0,0,6,0,0,0,21,0,0,0,0,0,0, -0,158,0,0,0,244,0,0,1,143,0,0,0,0,0,89,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,284,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -7,0,0,0,0,0,0,3,0,0,0,0,26,4,4,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, -0,691,39,1,6,304,1,1,32,534,0,1,9,1,10,190,0,0,12,2,3,0,0,0,0,0,0,0,0,11,0,0, -0,663,0,0,0,1907,0,0,7625,2195,0,0,0,0,0,469,0,0,61,0,0,0,0,0,0,3,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,121,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -5,0,0,0,0,0,0,1,0,0,0,0,16,1,28,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0, -0,42,0,11,0,145,30,0,2,89,0,0,20,0,0,1,10,0,0,1,30,2,41,0,92,0,0,0,0,8,0,0, -0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1624,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -1452,0,0,0,0,0,0,11,0,0,0,0,114,19,5,0,0,0,0,0,0,0,0,0,0,0,44,2,0,0,0,0, -0,7,23,84,0,99,0,1,0,1,0,0,91,173,27,416,1,0,269,213,28,0,2,2,0,0,27,0,0,132,0,0, -0,2,0,0,0,751,0,0,0,21,0,0,0,0,0,2547,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -11,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, -0,216,0,0,0,66,0,0,0,1,0,0,0,0,0,58,0,0,0,0,0,0,0,9,0,0,0,0,0,1,0,0, -0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,543,37,39,97,3770,103,48,90,5,4,88,38,56,8,13,47,3,441,208,485,10,1,114,0,0,0,0,0,0,0,0, -0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,17,5692,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -549,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,567,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -14020,238,0,0,1,0,0,355,0,0,0,0,778,187,281,0,0,0,0,0,0,0,0,0,0,0,85,102,0,0,0,94, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0, -0,1,2858,7663,9925,546,1740,4423,199,11395,305,7084,19898,8399,50548,81,3398,35,30931,18569,37081,3470,11106,2716,194,11040,360,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -298,12,0,0,0,0,0,86,0,0,0,0,104,20,40,0,0,0,0,0,0,0,0,0,0,0,17,18,0,0,0,17, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0, -0,3516,375,0,50,17543,0,3,60,1729,274,2,5828,30,7,4993,0,0,4649,630,442,5902,3,8,0,3455,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -361,13,0,0,0,0,0,5,0,0,0,0,81,3,93,0,0,0,0,0,0,0,0,0,0,0,14,16,0,0,0,12, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,0, -0,7663,50,806,23,15220,0,0,14548,2527,0,4678,2100,6,0,14691,0,132,2801,46,3558,2351,0,0,0,627,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,435,3818,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -65355,837,0,0,0,0,0,746,0,0,0,0,8732,425,3575,0,0,0,0,0,0,0,0,0,0,0,1415,1800,0,0,0,950, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,205,0,0, -0,4697,10,25,830,15865,181,781,21,8802,20,44,1122,308,421,9780,15,0,2587,6182,16,1620,444,337,0,2254,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,297,7270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -125281,1796,0,1,0,0,0,3203,0,0,0,0,17027,1240,7914,0,0,0,0,0,0,0,0,0,0,0,2998,3488,0,0,0,2259, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,458,0,0, -0,28719,581,5906,17398,17460,4012,1708,727,5748,61,701,16031,7917,34343,1090,3889,470,57539,31505,14508,1562,5320,2679,1843,5263,85,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,11,815,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -22847,88,0,0,0,0,0,85,0,0,0,0,864,205,472,0,0,0,0,0,0,0,0,0,0,0,186,222,0,0,0,125, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0, -0,6875,0,0,0,6909,3096,0,0,4883,0,0,1808,0,5,14686,7,0,4870,150,2021,2459,0,1,0,186,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,746,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -11675,179,0,0,0,0,0,360,0,0,0,0,1743,277,944,0,0,0,0,0,0,0,0,0,0,0,374,448,0,0,0,254, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,183,0,0, -0,3692,86,0,134,8940,12,557,9600,3028,0,0,1795,271,1101,6506,5,0,4940,1651,221,2120,0,3,0,115,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,78,1191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -23689,292,0,0,0,0,0,848,0,0,0,0,2880,230,1177,0,0,0,0,0,0,0,0,0,0,0,409,485,0,0,0,233, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,0,0, -0,42464,142,23,48,83815,154,0,18,32699,0,0,216,321,514,23318,3,8,2214,630,6668,2800,3,73,0,6663,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,4,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -57,4,0,0,0,0,0,349,0,0,0,0,39,16,17,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,1, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, -0,2731,846,8764,7026,10398,5040,7133,25,17,0,2622,14900,9844,50832,7278,1633,95,12573,35259,29369,883,5609,11,408,0,609,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,4,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,220,0,0,0,1010,0,0,0,13,0,0,0,0,0,749,0,0,0,0,0,958,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,3,489,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -6447,206,0,0,0,0,0,678,0,0,0,0,1693,156,583,0,0,0,0,0,0,0,0,0,0,0,240,254,0,0,0,163, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0, -0,45,11,3,1,10515,61,1,6,4301,0,0,405,18,3627,131,1,0,26,1780,3,21,0,33,0,113,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,140,1143,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -24513,381,0,0,0,0,0,1046,0,0,0,0,3059,408,1473,0,0,0,0,0,0,0,0,0,0,0,556,683,0,0,0,274, -0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0, -0,10779,216,573,11146,21300,2708,79,4,12785,0,808,30270,519,74,16181,553,1,165,2998,2542,1665,853,83,0,6426,4,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,7,636,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -11557,234,0,0,0,0,0,470,0,1,0,0,2118,60,1312,0,0,0,0,0,0,0,0,0,0,0,499,521,0,0,0,318, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0, -0,15479,2277,1,0,27392,313,1,1,6398,0,0,140,1376,423,8832,3385,0,12,1843,18,3541,7,26,0,12237,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,1125,2545,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -41679,767,0,0,0,0,0,2261,0,1,0,0,6067,353,2947,0,0,0,0,0,0,0,0,0,0,0,1204,1285,0,0,0,831, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,367,0,0, -0,4086,138,8886,45037,18299,1306,23387,247,5252,323,3102,947,249,2032,23325,113,288,407,7983,20702,829,572,238,5,2502,57,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,891,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -36271,388,0,0,0,0,0,1300,0,0,0,0,2896,624,1035,0,0,0,0,0,0,0,0,0,0,0,404,530,0,0,0,443, -0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0, -0,1625,1825,1858,7299,1361,19076,903,355,2067,79,2698,8278,15775,30844,12322,2699,23,37848,7449,18500,56617,5855,17689,160,1672,139,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,274,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -3046,79,0,0,0,0,0,330,0,0,0,0,606,93,340,6,0,0,0,0,0,0,0,0,0,0,134,135,0,0,0,81, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0, -0,6054,26,4,5,9136,14,0,1131,3190,0,24,4318,11,3,6634,2200,0,7781,999,1552,2055,0,29,0,355,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3011,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,884,2306,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -49216,660,0,0,0,0,0,2526,0,2,0,0,6843,559,2966,2,0,0,0,0,0,0,0,0,0,0,1320,1373,0,0,0,905, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,263,0,0, -0,12847,599,2377,10826,44849,836,1643,201,14285,68,1655,2104,2671,3772,16034,901,67,3955,11971,11027,4651,2001,458,0,5464,3,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,141,4461,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -70864,1264,0,0,0,0,0,1197,0,2,0,0,11736,257,4595,0,0,0,0,0,0,0,0,0,0,0,1998,2276,0,0,0,1272, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,907,0,0, -0,6741,587,2425,300,25432,199,186,14975,10135,9,725,1784,856,203,12106,5232,109,9,9193,30854,5919,2,2978,0,471,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,477,3868,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -75329,791,0,0,0,0,0,1547,4,1,0,0,8653,567,4110,0,0,0,0,0,0,0,0,0,0,0,1685,1765,0,0,0,1108, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1434,0,0, -0,9363,27,1448,3,23420,174,10,103097,13567,6,0,3835,141,386,26524,12,0,8815,5193,4464,4208,1,1844,0,4177,11,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,517,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -15641,141,0,0,0,0,0,326,0,0,0,0,2037,23,766,0,0,0,0,0,0,0,0,0,0,0,265,252,0,0,0,359, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,1268,1401,4714,1806,4523,627,4338,0,2072,2,659,9869,2517,10973,386,3715,0,23727,14956,13583,4,16,0,44,124,33,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,2047,0,0,0,27918,0,0,0,4777,0,0,2,0,0,1534,0,0,6,2,0,54,0,0,0,357,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,58,591,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -8212,249,0,0,0,0,0,550,0,0,0,0,1894,168,528,0,0,0,0,0,0,0,0,0,0,0,221,232,0,0,0,203, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,0,0, -0,8480,44,5,233,13109,99,4,10099,17850,0,42,375,11,3596,9040,1,0,1289,1663,37,3,0,0,0,31,1,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -227,10,0,0,0,0,0,78,0,0,0,0,66,9,35,0,0,0,0,0,0,0,0,0,0,0,14,17,0,0,0,9, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, -0,180,0,585,0,1377,30,0,30,1102,0,0,4,1,0,11,395,12,0,3,633,21,0,0,0,5,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,79,2228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -44195,660,0,0,0,0,0,933,1,0,0,0,7236,317,2575,0,0,0,0,0,0,0,0,0,0,0,923,1026,0,0,0,619, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,110,0,0, -0,460,69,28,23,3916,46,15,14,633,0,3,85,302,45,20708,135,0,367,2297,76,0,12,29,4,0,8,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -23,3,0,0,0,0,0,0,0,0,0,0,24,8,6,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,3, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,157,0,0,0,923,0,0,0,60,0,0,28,0,0,62,0,0,0,0,0,11,4,4,0,34,53,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,6,470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; diff --git a/ir/be/test/reassoc-amok.c b/ir/be/test/reassoc-amok.c deleted file mode 100644 index b8b2e9e00..000000000 --- a/ir/be/test/reassoc-amok.c +++ /dev/null @@ -1,7 +0,0 @@ -int x = -65535; -int y = 32768; - -int main() -{ - return x + y + 32767; -} diff --git a/ir/be/test/reassoc.c b/ir/be/test/reassoc.c deleted file mode 100644 index 31ab3deb6..000000000 --- a/ir/be/test/reassoc.c +++ /dev/null @@ -1,8 +0,0 @@ -int a = 0; -int b = 3; - -int main() { - int res = (a-b) * (a-b); - printf("%d\n", res); - return 0; -} diff --git a/ir/be/test/rot.c b/ir/be/test/rot.c deleted file mode 100644 index 72aa2b2eb..000000000 --- a/ir/be/test/rot.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Result: %d (should be 42)\n", rot(21,1)); - - return 0; -} - -unsigned rot(unsigned x, unsigned y) -{ - return x << y | x >> (32-y); -} diff --git a/ir/be/test/rotate.c b/ir/be/test/rotate.c deleted file mode 100644 index 6e93acaca..000000000 --- a/ir/be/test/rotate.c +++ /dev/null @@ -1,24 +0,0 @@ -static unsigned int rotater3(unsigned int a) -{ - return (a << 3) | (a >> 29); -} - -static unsigned int rotatel3(unsigned int a) -{ - return (a >> 3) | (a << 29); -} - -static unsigned int rotater(unsigned int a, unsigned int b) -{ - return (a >> b) | (a << (32-b)); -} - - -int main() -{ - printf("5 >>r>> 3 = %d\n", rotater3(5)); - printf("5 <>r>> 4 = %d\n", rotater(5,4)); - - return 0; -} diff --git a/ir/be/test/rtsopt.c b/ir/be/test/rtsopt.c deleted file mode 100644 index fb1685a33..000000000 --- a/ir/be/test/rtsopt.c +++ /dev/null @@ -1,370 +0,0 @@ -#include -#include -#include -#include - -/* transform into Abs node, gcc(+), icc(+), cl(+) */ -int test_abs(int a) { - return abs(a); -} - -/* transform into Abs node, gcc(+), icc(+), cl(?) */ -long test_labs(long a) { - return labs(a); -} - -/* transform into Abs node, gcc(+), icc(+), cl(+) */ -double test_fabs(double a) { - return fabs(a); -} - -/* transform info memcpy(test + strlen(test), "ab", 2), gcc(+), icc(-), cl(-) */ -char *test_strcat(void) { - static char test[10] = "ab"; - return strcat(test, "bc"); -} - -/* evaluate, gcc(+), icc(-), cl(-) */ -char *test_strchr(void) { - return strchr("abc", 'b'); -} - -/* evaluate, gcc(+), icc(-), cl(-) */ -char *test_strrchr(void) { - return strrchr("abc", 'b'); -} - -/* evaluate into 0, gcc(+), icc(-), cl(-) */ -int test_strcmp1(const char *s) { - return strcmp(s, s); -} - -/* transform info -(*s), gcc(+), icc(-), cl(-) */ -int test_strcmp2(const char *s) { - return strcmp("", s); -} - -/* transform info *s, gcc(+), icc(-), cl(-) */ -int test_strcmp3(const char *s) { - return strcmp(s, ""); -} - -/* evaluate, gcc(+), icc(-), cl(-) */ -int test_strcmp4(void) { - return strcmp("ab", "cd"); -} - -/* evaluate into 0, gcc(+), icc(-), cl(-) */ -int test_strncmp1(const char *s, int len) { - return strncmp(s, s, len); -} - -/* transform info -(*s), gcc(+), icc(-), cl(-) */ -int test_strncmp2(const char *s) { - return strncmp("", s, 1); -} - -/* transform info *s, gcc(+), icc(-), cl(-) */ -int test_strncmp3(const char *s) { - return strncmp(s, "", 1); -} - -/* evaluate, gcc(+), cl(-) */ -int test_strncmp4(void) { - return strncmp("ab", "cd", 2); -} - -/* evaluate, gcc(+), cl(-) */ -int test_strncmp5(char *a, char *b) { - return strncmp(a, b, 0); -} - -/* transform into *s = '\0', s, gcc(+), icc(-), cl(+) */ -char *test_strcpy1(char *s) { - return strcpy(s, ""); -} - -/* transform into memcpy(s, c, len(c)+1), gcc(+), icc(-), cl(+) */ -char *test_strcpy2(char *s) { - return strcpy(s, "ab"); -} - -/* evaluate, gcc(+), icc(+), cl(+) */ -int test_strlen(void) { - return strlen("ab"); -} - -/* transform into d, gcc(+), icc(+), cl(-) */ -void *test_memcpy1(void *d, void *s) { - return memcpy(d, s, 0); -} - -/* transform into *(char *)d = *(char *)s, d, gcc(+), icc(+), cl(+) */ -void *test_memcpy2(void *d, void *s) { - return memcpy(d, s, 1); -} - -/* transform into *(short *)d = *(short *)s, d, gcc(+), icc(+), cl(+) */ -void *test_memcpy3(short *d, short *s) { - return memcpy(d, s, 2); -} - -/* transform into *(int *)d = *(int *)s, d, gcc(+), icc(+), cl(+) */ -void *test_memcpy4(int *d, int *s) { - return memcpy(d, s, 4); -} - -/* transform into *(long long *)d = *(long long *)s, d, gcc(+), icc(+), cl(+) */ -void *test_memcpy5(long long *d, long long *s) { - return memcpy(d, s, 8); -} - -/* transform into d, gcc(+), icc(+), cl(-) */ -void *test_memset1(void *d, int C) { - return memset(d, C, 0); -} - -/* transform into *(char *)d = (char)C, d, gcc(+), icc(+), cl(+) */ -void *test_memset2(void *d, int C) { - return memset(d, C, 1); -} - -/* transform into *(short *)d = (short)((char)C * 0x0101), d, gcc(+), icc(+), cl(+) */ -void *test_memset3(short *d, int C) { - return memset(d, C, 2); -} - -/* transform into *(int *)d = (int)((char)C * 0x01010101), d, gcc(+), icc(+), cl(+) */ -void *test_memset4(int *d, int C) { - return memset(d, C, 4); -} - -/* transform into *(long long *)d = (long long)((char)C) * 0x0101010101010101, d, gcc(+), icc(+), cl(+) */ -void *test_memset5(long long *d, int C) { - return memset(d, C, 8); -} - -/* evaluate into 1.0, gcc(+), icc(-), cl(-) */ -double test_pow1(double a) { - return pow(1.0, a); -} - -/* evaluate into 1.0, gcc(+), icc(+), cl(-) */ -double test_pow2(double a) { - return pow(a, 0.0); -} - -/* transform into sqrt(a), gcc(-), icc(+), cl(-) */ -double test_pow3(double a) { - return pow(a, 0.5); -} - -/* evaluate into a, gcc(+), icc(+), cl(-) */ -double test_pow4(double a) { - return pow(a, 1.0); -} - -/* evaluate into 1.0/a. gcc(+), icc(+), cl(-) */ -double test_pow5(double a) { - return pow(a, -1.0); -} - -/* evaluate into 1.0 gcc(+), icc(+), cl(-) */ -double test_exp1(void) { - return exp(0.0); -} - -/* evaluate into M_E gcc(+), icc(-), cl(?) */ -double test_exp2(void) { - return exp(1.0); -} - -/* evaluate gcc(-), icc(-), cl(?) */ -double test_exp3(void) { - return exp(7.3434); -} - -/* evaluate into 0.0 gcc(+), icc(-), cl(?) */ -double test_log1(void) { - return log(1.0); -} - -/* evaluate into 0.0 gcc(+), icc(-), cl(?) */ -double test_log2(void) { - return log2(1.0); -} - -/* evaluate into 0.0 gcc(+), icc(-), cl(?) */ -double test_log3(void) { - return log10(1.0); -} - -/* evaluate into 0.0 gcc(+), icc(-), cl(?) */ -double test_trunc1(void) { - return trunc(0.1); -} - -/* evaluate into 0.0 gcc(+), icc(-), cl(?) */ -double test_trunc2(void) { - return trunc(-8.9); -} - -/* transform into putchar, gcc(+), icc(-), cl(-) */ -void test_printf1() { - printf("\n"); -} - -/* transform into putchar(c), gcc(+), icc(+), cl(-) */ -void test_printf2(char c) { - printf("%c", c); -} - -/* transform into puts(s), gcc(+), icc(-), cl(-) */ -void test_printf3(char *s) { - printf("%s\n", s); -} - -/* transform into fwrite(s,strlen(s),f), gcc(+) OR fputs(s, f), icc(+), cl(-) */ -void test_fprintf1(FILE *f) { - fprintf(f, "ab"); -} - -/* transform into fputc(c,f), gcc(+), icc(+), cl(-) */ -void test_fprintf2(FILE *f, char c) { - fprintf(f, "%c", c); -} - -/* transform into fputs(s,file), gcc(+), icc(+), cl(-) */ -void test_fprintf3(FILE *f, char *s) { - fprintf(f, "%s", s); -} - -/* transform into memcpy(d,s,strlen(s)+1,1), gcc(+), icc(-), cl(-) */ -void test_sprintf1(char *d) { - sprintf(d, "ab"); -} - -/* transform into d[0] = c; d[1] = '\0';, gcc(-), icc(-), cl(-) */ -void test_sprintf2(char *d, char c) { - sprintf(d, "%c", c); -} - -/* transform into memcpy(d, s, strlen(s)+1, 1)), gcc(-), icc(-), cl(-) */ -void test_sprintf3(char *d, char *s) { - sprintf(d, "%s", s); -} - -/* transform fwrite(s,1,strlen(s),F), gcc(+), icc(-), cl(-) */ -void test_fputs(FILE *f) { - fputs("abs", f); -} - -/* evaluate to 0, gcc(-), icc(-), cl(-) */ -int test_fwrite1(FILE *f, char *s, int l) { - return fwrite(s, 0, l, f); -} - -/* evaluate to 0, gcc(-), icc(-), cl(-) */ -int test_fwrite2(FILE *f, char *s, int l) { - return fwrite(s, l, 0, f); -} - -/* transform into fputc(s[0],F) if this is usefull ..., gcc(-), icc(-), cl(-) */ -int test_fwrite3(FILE *f, char *s, int l) { - return fwrite(s,1,1,f); -} - -/* evaluate, gcc(+), cl(-) */ -double test_sin1(void) { - return sin(0.0); -} - -/* transform into fsin, gcc(+), cl(-) */ -double test_sin2(double x) { - return sin(x); -} - -/* transform into cos(x), gcc(+), icc(-), cl(-) */ -double test_cos1(double x) { - return cos(-x); -} - -/* evaluate, gcc(+), cl(-) */ -double test_cos2(void) { - return cos(0.0); -} - -/* transform into fcos, gcc(+), cl(-) */ -double test_cos3(double x) { - return cos(x); -} - -/* transform into cosf(x), gcc(+), icc(-), cl(-) */ -float test_cosf1(float x) { - return cosf(-x); -} - -#if 0 -/* transform into cosl(x), gcc(+), icc(-), cl(-) */ -long double test_cosl(long double x) { - return cosl(-x); -} -#endif - -/* evaluate, gcc(+), cl(-) */ -double test_tan1(void) { - return tan(0); -} - -/* evaluate, gcc(-), cl(-) */ -double test_asin1(void) { - return asin(0.0); -} - -/* evaluate, gcc(-), cl(-) */ -double test_acos1(void) { - return acos(1.0); -} - -/* evaluate, gcc(+), cl(-) */ -double test_atans1(void) { - return atan(0.0); -} - -/* evaluate into 0.0, gcc(+), icc(+), cl(-) */ -double test_sqrt1(void) { - return sqrt(0.0); -} - -/* evaluate into 1.0, gcc(+), icc(+), cl(-) */ -double test_sqrt2(void) { - return sqrt(1.0); -} - -/* evaluate, gcc(+), icc(+), cl(-) */ -double test_sqrt3(void) { - return sqrt(7.345); -} - -/* evaluate into 0.0, gcc(+), icc(-), cl(?) */ -double test_cbrt1(void) { - return cbrt(0.0); -} - -/* evaluate into 1.0, gcc(+), icc(-), cl(?) */ -double test_cbrt2(void) { - return cbrt(1.0); -} - -/* evaluate into -1.0, gcc(+), icc(-), cl(?) */ -double test_cbrt3(void) { - return cbrt(-1.0); -} - -/* transform exit(3) into a return 3, gcc(-), icc(-), cl(-) */ -int main() { - printf("%f\n", test_asin1()); - printf("%f\n", test_acos1()); - exit(0); - return 42; -} diff --git a/ir/be/test/scanner.c b/ir/be/test/scanner.c deleted file mode 100644 index 5523ead7d..000000000 --- a/ir/be/test/scanner.c +++ /dev/null @@ -1,1269 +0,0 @@ -/*$Header$*/ -#include -#include -#include -#include - -#ifdef PLATFORM_NT -#include -#endif -#ifdef PLATFORM_LINUX -#endif - -#define TRUE 1 -#define FALSE 0 - -#define MODE_RECOGNIZE 0 -#define MODE_TRAIN1 1 -#define MODE_TRAIN2 2 - -void alloc_td_bu(); - - -unsigned char **cimage; -double **tds; -double **bus; -int lwidth,lheight; -int width, height,numinputs; -long i,j; - -int pass_flag; -int highx[2], highy[2]; -double highest_confidence[2]; -int set_high[2]; - -#define DB1 1 -#define DB2 0 -#define DB3 1 - -FILE *fp; - -int winner,numf1s,numf2s, resonant,cp,numpatterns; - -double a, b, c, d, theta, delta_t; -double rho; - -typedef struct { - double *I; - double W; - double X; - double V; - double U; - double P; - double Q; - double R; - } f1_neuron; - -f1_neuron *f1_layer; - -typedef struct { - double y; - int reset; - } xyz; - -xyz *Y; - - -double g(i) -int i; -{ double result; - if (i != winner) - result =0; - else - if ( Y[i].y > 0) - result = d; - else - result =0; - return(result); -} - -void find_match() -{ int i; - winner = 0; - for (i=0;i Y[winner].y) - winner =i; -} - -double simtest() -{ int j; - double sum,norm; - double temp_sum; - - sum = norm =0; - for (j=0;j 0)) - tsum += tds[ti][tj] * d; - } - - f1_layer[ti].P = f1_layer[ti].U + tsum; - - tnorm += f1_layer[ti].P * f1_layer[ti].P; - - if (ttemp != f1_layer[ti].P) - tresult=0; - } - f1res = tresult; - - /* Compute F1 - Q values */ - - tnorm = sqrt((double) tnorm); - for (tj=0;tj Y[winner].y) - winner =ti; - } - - - } -#ifdef DEBUG - if (DB1) print_f12(); - if (DB1) printf("\n num iterations for p to stabalize = %i \n",j); -#endif - match_confidence=simtest(); -#ifdef DEBUG -fprintf(stdout,"rho %e\n",match_confidence); -#endif - if ((match_confidence) > rho) - { -#ifdef DEBUG - if (DB2 && (winner==0)) printf("#%i",winner); -#endif - weightadj(); - matched = 1; - } - else - { Y[winner].y = 0; - Y[winner].reset = 1; -#ifdef DEBUG - if (DB1) printf("#%iN",winner); -#endif - matchtest=0; - for (mt=spot;mt 0)) - tsum += tds[ti][tj] * d; - } - - f1_layer[ti].P = f1_layer[ti].U + tsum; - - tnorm += f1_layer[ti].P * f1_layer[ti].P; - - if (ttemp != f1_layer[ti].P) - tresult=0; - } - f1res = tresult; - - /* Compute F1 - Q values */ - - tnorm = sqrt((double) tnorm); - for (tj=0;tj Y[winner].y) - winner =ti; - } - - - } -#ifdef DEBUG - if (DB1) print_f12(); - if (DB1) printf("\n num iterations for p to stabilize = %i \n",j); -#endif - match_confidence=simtest2(); - if ((match_confidence) > rho) - { - /* If the winner is not the default F2 neuron (the highest one) - * we have a match. - */ - if (winner!=numf2s-1) - { - pass_flag=1; - fprintf(stdout,"F2 neuron %d passes vigilance with a value of %0.4f\n",winner,match_confidence); - print_f12(); - if (match_confidence > highest_confidence[winner]) - { - highest_confidence[winner] = match_confidence; - set_high[winner] = TRUE; - } - } - matched = 1; - } - else - { Y[winner].y = 0; - Y[winner].reset = 1; -#ifdef DEBUG - if (DB1) printf("#%i No",winner); -#endif - matchtest=0; - for (mt=0;mt(height-lheight+1))||(startx>(width-lwidth+1))) - { - fprintf(stderr,"Startx %d or Starty %d is out of range\n", startx, starty); - exit(1); - } - if ((endy>(height-lheight+1))||(endx>(width-lwidth+1))) - { - fprintf(stderr,"endx %d or endy %d is out of range\n", endx, endy); - exit(1); - } -#ifdef DEBUG - if (DB3) - { - fprintf(stdout,"made it to scan_recognize\n"); - fprintf(stdout,"w= %d h = %d lw = %d lh = %d\n",width,height,lwidth,lheight); - } -#endif - for (j=starty;j %s\n",argv[arg_index]); - goto Usage; - } - arg_index+=2; /* this works as long as options are duals!!! */ - } - - /* Some basic error checking. */ - - if (scanfile==NULL) - { - fprintf(stderr,"ERROR: Must specify input files\n"); - goto Usage; - } - if ((weightfile==NULL)&&(trainfile1==NULL)) - { - fprintf(stderr,"ERROR: Must specify weightfile or trainfile1\n"); - goto Usage; - } - if ((weightfile!=NULL)&&(trainfile1!=NULL)) - { - fprintf(stderr,"ERROR: Cannot specify weightfile and trainfile1\n"); - goto Usage; - } - -#ifdef DEBUG - fprintf(stdout,"scanfile = %s\n weightfile = %s\n startx = %d\n starty = %d\n stride = %d\n",scanfile,weightfile,startx,starty,stride); -#endif - - loadimage(scanfile); - - /* Differentiate between loading pretrained network (load_weights) - * and training. Currently, loading a pretrained network - * supports only 1 object. If we train, we can learn to - * recognize two objects. - */ - if (weightfile!=NULL) - { - numpatterns = 1; - if (objects==0) - { - objects = numpatterns; - } - load_weights(weightfile); - init_globs(MODE_RECOGNIZE); - init_net(); - } - else - { - if (trainfile2!=NULL) - { - numpatterns = 2; - if (objects] [-starty ] [-endx ] [-endy ] [-stride ] -scanfile -trainfile1 [-trainfile2 ]\n"); - exit(0); -Version: - fprintf(stderr,"Version 1.00 \n"); - exit(1); -} diff --git a/ir/be/test/setjump.c b/ir/be/test/setjump.c deleted file mode 100644 index 978a7e993..000000000 --- a/ir/be/test/setjump.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main(void) { - jmp_buf buf; - volatile int k = 0; - - int val = setjmp(buf); - printf("Val: %d K: %d\n", val, k); - - k = 1; - if(val == 0) - longjmp(buf, 20); - - return 0; -} diff --git a/ir/be/test/shiftamount.c b/ir/be/test/shiftamount.c deleted file mode 100644 index 91211a5ee..000000000 --- a/ir/be/test/shiftamount.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include - -int dbglvl = 4; - -#define FUDGE_BUF (100*1024) -#define MAX_SPEC_FD 2 -struct spec_fd_t { - int limit; - int len; - int pos; - unsigned char *buf; -} spec_fd[MAX_SPEC_FD]; - -int spec_init() { - int i, j; - !dbglvl; - - /* Allocate some large chunks of memory, we can tune this later */ - for (i = 0; i < MAX_SPEC_FD; i++) { - spec_fd[i].buf = (unsigned char *) malloc(FUDGE_BUF); - } - return 0; -} - -int spec_load(char *filename, int size) { -#define FILE_CHUNK (128*1024) - int fd, rc, i; -#ifndef O_BINARY -#define O_BINARY 0 -#endif - fd = open(filename, O_RDONLY | O_BINARY); - rc = read(fd, spec_fd[0].buf, FILE_CHUNK); - if (rc < 0) { - fprintf(stderr, "Error reading from %s: %s\n", filename, - strerror(errno)); - exit(0); - } - close(fd); - return 0; -} - -#define MB (1024*1024) -int main(int argc, char *argv[]) { - int input_size = 64; - char *input_name = "input.combined"; - - spec_init(); - - spec_load(input_name, input_size * MB); - - return 0; -} diff --git a/ir/be/test/shiftconst.c b/ir/be/test/shiftconst.c deleted file mode 100644 index b2dfbff3d..000000000 --- a/ir/be/test/shiftconst.c +++ /dev/null @@ -1,45 +0,0 @@ -int printf(const char *str, ...); - -#define T unsigned -#define tname(x) u_##x -#include "shiftconst.h" -#undef tname -#undef T - -#define T int -#define tname(x) i_##x -#include "shiftconst.h" -#undef tname -#undef T - -#define T long long -#define tname(x) ll_##x -#include "shiftconst.h" -#undef tname -#undef T - -#define T signed char -#define tname(x) sc_##x -#include "shiftconst.h" -#undef tname -#undef T - -int main(void) -{ -#define TEST(x) printf(#x "(0xAABBCCDD) = 0x%X\n", x(0xAABBCCDD)) -#define ALLTESTS(pf) \ - TEST(pf##k1); \ - TEST(pf##k2); \ - TEST(pf##k3); \ - TEST(pf##k4); \ - TEST(pf##k5); \ - TEST(pf##k6); \ - TEST(pf##k7); \ - TEST(pf##k8); - - ALLTESTS(u_); - ALLTESTS(i_); - ALLTESTS(ll_); - ALLTESTS(sc_); - return 0; -} diff --git a/ir/be/test/shiftconst.h b/ir/be/test/shiftconst.h deleted file mode 100644 index 4e6d2d453..000000000 --- a/ir/be/test/shiftconst.h +++ /dev/null @@ -1,32 +0,0 @@ -T tname(k1) (T x) { - return (x << 5) >> 24; -} - -T tname(k2) (T x) { - return (x >> 5) << 24; -} - -T tname(k3) (T x) { - return (x << 20) >> 20; -} - -T tname(k4) (T x) { - return (x & 0xfff0) >> 8; -} - -T tname(k5) (T x) { - unsigned short l = 24; - return (x << 5) >> l; -} - -T tname(k6) (T x) { - return (x & 0xff) >> 8; -} - -T tname(k7) (T x) { - return (x >> 10) << 5; -} - -T tname(k8) (T x) { - return (x >> 10) << 5; -} diff --git a/ir/be/test/simd1-i.c b/ir/be/test/simd1-i.c deleted file mode 100644 index de5d596f0..000000000 --- a/ir/be/test/simd1-i.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -unsigned int sse8_16bit_c( const int * b1, - const int * b2, - const unsigned int stride) -{ - int i; - int sse = 0; - - for (i=0; i<8; i++) { - sse += (b1[0] - b2[0])*(b1[0] - b2[0]); - sse += (b1[1] - b2[1])*(b1[1] - b2[1]); - sse += (b1[2] - b2[2])*(b1[2] - b2[2]); - sse += (b1[3] - b2[3])*(b1[3] - b2[3]); - sse += (b1[4] - b2[4])*(b1[4] - b2[4]); - sse += (b1[5] - b2[5])*(b1[5] - b2[5]); - sse += (b1[6] - b2[6])*(b1[6] - b2[6]); - sse += (b1[7] - b2[7])*(b1[7] - b2[7]); - - b1 = (const int*)((char*)b1+stride); - b2 = (const int*)((char*)b2+stride); - } - - return(sse); -} - -#define MAX 65536 - -int main(){ - int cur[MAX]; - int ref[MAX]; - int sum = 0; - int numofruns = 10; - int i,ii; - for (i=0;i < numofruns; i++){ - // Reset cache. Alles andere ist unrealistisch. - for(ii = 0; ii - -#define ITERS 8 - -unsigned int sse8_16bit_c( const short * b1, - const short * b2, - const unsigned int stride) -{ - int i; - int sse = 0; - - for (i=0; i 1) { - numofruns = atoi(argv[1]); - } - - for (i=0;i < numofruns; i++){ - // Reset cache. Alles andere ist unrealistisch. - for(ii = 0; ii < MAX; ++ii) { - cur[ii]=(ii)&0xff; - ref[ii]=(ii+i+3)&0xff; - } - sum = sse8_16bit_c(cur, ref, STRIDE); - if(i < 10) - printf("sum[%i] = %i\n",i, sum); - } - - return 0 ; -} diff --git a/ir/be/test/simd2.c b/ir/be/test/simd2.c deleted file mode 100644 index a4d56d5e0..000000000 --- a/ir/be/test/simd2.c +++ /dev/null @@ -1,68 +0,0 @@ -#include - -#define abs(X) (((X)>0)?(X):-(X)) - -unsigned int sad16_c( const unsigned char * const cur, - const unsigned char * const ref, - const unsigned int stride, - const unsigned int best_sad) -{ - - unsigned int sad = 0; - unsigned int j; - unsigned char const *ptr_cur = cur; - unsigned char const *ptr_ref = ref; - - for (j = 0; j < 16; j++) { - sad += abs(ptr_cur[0] - ptr_ref[0]); - sad += abs(ptr_cur[1] - ptr_ref[1]); - sad += abs(ptr_cur[2] - ptr_ref[2]); - sad += abs(ptr_cur[3] - ptr_ref[3]); - sad += abs(ptr_cur[4] - ptr_ref[4]); - sad += abs(ptr_cur[5] - ptr_ref[5]); - sad += abs(ptr_cur[6] - ptr_ref[6]); - sad += abs(ptr_cur[7] - ptr_ref[7]); - sad += abs(ptr_cur[8] - ptr_ref[8]); - sad += abs(ptr_cur[9] - ptr_ref[9]); - sad += abs(ptr_cur[10] - ptr_ref[10]); - sad += abs(ptr_cur[11] - ptr_ref[11]); - sad += abs(ptr_cur[12] - ptr_ref[12]); - sad += abs(ptr_cur[13] - ptr_ref[13]); - sad += abs(ptr_cur[14] - ptr_ref[14]); - sad += abs(ptr_cur[15] - ptr_ref[15]); - - - if (sad >= best_sad) - return sad; - - ptr_cur += stride; - ptr_ref += stride; - - } - - return sad; - -} - -int main(int argc, char** argv){ - unsigned char cur[65536]; - unsigned char ref[65536]; - int sum = 0; - int numofruns = 100; - int i,ii; - - if(argc > 1) { - numofruns = atoi(argv[1]); - } - - for (i=0;i < numofruns; i++){ - // Reset cache. Alles andere ist unrealistisch. - for(ii = 0; ii<65536;ii++){ - cur[ii]=ii&0xff; - ref[ii]=(ii+4)&0xff; - } - sum += sad16_c(cur, ref, 64, 100000); - } - printf("sum = %i\n", sum); - return 0 ; -} diff --git a/ir/be/test/simple.c b/ir/be/test/simple.c deleted file mode 100644 index 061ed7eef..000000000 --- a/ir/be/test/simple.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/ir/be/test/slow_memperm.c b/ir/be/test/slow_memperm.c deleted file mode 100644 index 1c441818c..000000000 --- a/ir/be/test/slow_memperm.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -unsigned m = 7; - -int main(void) { - - unsigned a; - unsigned c = 0; - - for (a=0; a<=m; a++) { - c = a; - } - - printf("%d %d\n", a, c); - - return 0; -} diff --git a/ir/be/test/sparam.c b/ir/be/test/sparam.c deleted file mode 100644 index 150290ada..000000000 --- a/ir/be/test/sparam.c +++ /dev/null @@ -1,43 +0,0 @@ -struct x { - int a; - int b; - int c; - int d; -}; - -struct y { - int a; - int b; - int c; - int d[20]; -}; - -int main() -{ - struct x A; - struct y B; - - A.a = 3; - A.b = 4; - A.c = 5; - A.d = 6; - - B.a = 4; - B.b = 5; - B.c = 6; - - printf("%d\n", t(A)); - printf("%d\n", z(B)); - - return 0; -} - -int t(struct x x) -{ - return x.b; -} - -int z(struct y x) -{ - return x.c; -} diff --git a/ir/be/test/sret.c b/ir/be/test/sret.c deleted file mode 100644 index 08b97cc9d..000000000 --- a/ir/be/test/sret.c +++ /dev/null @@ -1,20 +0,0 @@ -typedef struct _foo_t { - int a; - char b; -} foo_t; - -foo_t sret_func(int c) { - foo_t x; - x.a = c; - x.b = 0; - return x; -} - -int main(int argc) { - foo_t z; - - z.b = 13; - z = sret_func(argc); - - return z.b; -} diff --git a/ir/be/test/stmt_expr.c b/ir/be/test/stmt_expr.c deleted file mode 100644 index ffffbf69a..000000000 --- a/ir/be/test/stmt_expr.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#define maxint(a,b) \ - ({int _a = (a), _b = (b); _a > _b ? _a : _b; }) - -int main(int argc, char *argv[]) -{ - int i = argc + 3; - int j = argc * argc; - - printf("max %d, %d = %d\n", i, j, maxint(i,j)); - - return 0; -} diff --git a/ir/be/test/store_bug.c b/ir/be/test/store_bug.c deleted file mode 100644 index 9054f2c2b..000000000 --- a/ir/be/test/store_bug.c +++ /dev/null @@ -1,15 +0,0 @@ -extern int x; -int x; - -int main() -{ - int i = 0; - - x = 0; - do { - x = x + i; - ++i; - } while(i < 3); - - return x != 3; -} diff --git a/ir/be/test/strenght_red.c b/ir/be/test/strenght_red.c deleted file mode 100644 index 7ac1bf3da..000000000 --- a/ir/be/test/strenght_red.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main() -{ - int i; - - for (i = 0; i < 10; ++i) { - printf("%d\n", i * 4); - } - - return 0; -} diff --git a/ir/be/test/struct.c b/ir/be/test/struct.c deleted file mode 100644 index 5559ece8e..000000000 --- a/ir/be/test/struct.c +++ /dev/null @@ -1,111 +0,0 @@ -#include - -struct A { - int x; -}; - -struct B { - int y; - struct A a1; - struct A a2; -} b = { 1, 2, 3 }; - -struct C { - char s; - int d[3]; -} c = { 'q', { 4, 5, 6 } }; - -int e[3] = { 7, 8, 9 }; - -struct X { - char c; -} x = { 'w' }; - -struct N { - struct C foo[3]; - char c; - struct B b; -} n = { '1', { 10, 11, 12 }, - '2', { 13, 14, 15 }, - '3', { 16, 17, 18 }, - 'c', - { 19, 20, 21 } - }; - -int md[5][4][3] = { { { 22, 23, 24 }, { 25, 26, 27 }, { 28, 29, 30 }, { 31, 32, 33 } }, - { { 34, 35, 36 }, { 37, 38, 39 }, { 40, 41, 42 }, { 43, 44, 45 } }, - { { 46, 47, 48 }, { 49, 50, 51 }, { 52, 53, 54 }, { 55, 56, 57 } }, - { { 58, 59, 60 }, { 61, 62, 63 }, { 64, 65, 66 }, { 67, 68, 69 } }, - { { 70, 71, 72 }, { 73, 74, 75 }, { 76, 77, 78 }, { 79, 80, 81 } }, - }; - -struct G { - char z1; - int k[2][2][2]; - char z2; -} g = { - 'u', - { { { 82, 83 }, { 84, 85 } }, { { 86, 87 }, { 88, 89 } } }, - 'v' - }; - -struct X xarr[] = { { 'H' }, { 'e' }, { 'l' }, { 'l' }, { 'o' }, { ' ' }, { 'W' }, { 'o' }, { 'r' }, { 'l' }, { 'd' }, { '!' }, { '\n' } } ; - -struct C carr[] = { - { 'k', { 90, 91, 92 } }, - { 'm', { 93, 94, 95 } }, - { 'n', { 96, 97, 98 } } - }; - -int main(void) { - int i = 0; - - printf("expected 1 2 3\nfound %d %d %d\n\n", b.y, b.a1.x, b.a2.x); - - printf("expected q 4 5 6\nfound %c %d %d %d\n\n", c.s, c.d[0], c.d[1], c.d[2]); - - printf("expected 7 8 9\nfound %d %d %d\n\n", e[0], e[1], e[2]); - - printf("expected w\nfound %c\n\n", x.c); - - printf("expected 0\nfound %d\n\n", i); - - printf("expected 1 10 11 12 | 2 13 14 15 | 3 16 17 18 | c | 19 20 21\nfound %c %d %d %d | %c %d %d %d | %c %d %d %d | %c | %d %d %d\n\n", - n.foo[0].s, n.foo[0].d[0], n.foo[0].d[1], n.foo[0].d[2], - n.foo[1].s, n.foo[1].d[0], n.foo[1].d[1], n.foo[1].d[2], - n.foo[2].s, n.foo[2].d[0], n.foo[2].d[1], n.foo[2].d[2], - n.c, n.b.y, n.b.a1.x, n.b.a2.x); - - printf("expected numbers 22-81: %d %d %d | %d %d %d | %d %d %d | %d %d %d\n", md[0][0][0], md[0][0][1], md[0][0][2], - md[0][1][0], md[0][1][1], md[0][1][2], - md[0][2][0], md[0][2][1], md[0][2][2], - md[0][3][0], md[0][3][1], md[0][3][2]); - printf(" %d %d %d | %d %d %d | %d %d %d | %d %d %d\n", md[1][0][0], md[1][0][1], md[1][0][2], - md[1][1][0], md[1][1][1], md[1][1][2], - md[1][2][0], md[1][2][1], md[1][2][2], - md[1][3][0], md[1][3][1], md[1][3][2]); - printf(" %d %d %d | %d %d %d | %d %d %d | %d %d %d\n", md[2][0][0], md[2][0][1], md[2][0][2], - md[2][1][0], md[2][1][1], md[2][1][2], - md[2][2][0], md[2][2][1], md[2][2][2], - md[2][3][0], md[2][3][1], md[2][3][2]); - printf(" %d %d %d | %d %d %d | %d %d %d | %d %d %d\n", md[3][0][0], md[3][0][1], md[3][0][2], - md[3][1][0], md[3][1][1], md[3][1][2], - md[3][2][0], md[3][2][1], md[3][2][2], - md[3][3][0], md[3][3][1], md[3][3][2]); - printf(" %d %d %d | %d %d %d | %d %d %d | %d %d %d\n", md[4][0][0], md[4][0][1], md[4][0][2], - md[4][1][0], md[4][1][1], md[4][1][2], - md[4][2][0], md[4][2][1], md[4][2][2], - md[4][3][0], md[4][3][1], md[4][3][2]); - - printf("\nexpected u | 82 83 | 84 85 | 86 87 | 88 89 | v\nfound %c | %d %d | %d %d | %d %d | %d %d | %c\n\n", g.z1, g.k[0][0][0], - g.k[0][0][1], g.k[0][1][0], g.k[0][1][1], g.k[1][0][0], g.k[1][0][1], g.k[1][1][0], g.k[1][1][1], g.z2); - - printf("expected Hello World!\nfound "); - for (i = 0; i < sizeof(xarr); i++) printf("%c", xarr[i].c); - - printf("\nexpected k 90 91 92 | m 93 94 95 | n 96 97 98\nfound %c %d %d %d | %c %d %d %d | %c %d %d %d\n", - carr[0].s, carr[0].d[0], carr[0].d[1], carr[0].d[2], carr[1].s, carr[1].d[0], carr[1].d[1], carr[1].d[2], - carr[2].s, carr[2].d[0], carr[2].d[1], carr[2].d[2]); - - return 0; -} diff --git a/ir/be/test/structcall.c b/ir/be/test/structcall.c deleted file mode 100644 index 250b925ac..000000000 --- a/ir/be/test/structcall.c +++ /dev/null @@ -1,18 +0,0 @@ -struct A { - int a; - int b; -}; - -static int test(struct A arg) { - return arg.a + arg.b; -} - -int main(int argc, char *argv[]) { - struct A a; - - a.a = 3; - a.b = 4; - - printf("Sum = %d\n", test(a)); - return 0; -} diff --git a/ir/be/test/structtest.c b/ir/be/test/structtest.c deleted file mode 100644 index 994674452..000000000 --- a/ir/be/test/structtest.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -struct A { - int x; - int y; -}; - -int main(int argc, char *argv[]) -{ - struct A a; - - printf("structtest.c\n"); - - printf("sizeof struct(A) %ld\n", sizeof(struct A)); - printf("sizeof a %ld\n", sizeof(a)); - - a.x = 3; - a.y = 4; - - printf("a.x = %d (should be 3)\n", a.x); - printf("a.y = %d (should be 4)\n", a.y); - - return 0; -} diff --git a/ir/be/test/switch.c b/ir/be/test/switch.c deleted file mode 100644 index 5308137f0..000000000 --- a/ir/be/test/switch.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -static int switch1(int k) { - switch(k) { - case 42: - return 5; - case 13: - return 7; - case INT_MAX: - return 8; - case -1: - case INT_MIN: - return 9; - } - return 3; -} - -int main(void) -{ - assert(switch1(42) == 5); - assert(switch1(13) == 7); - assert(switch1(-1) == 9); - assert(switch1(700) == 3); - assert(switch1(-32000) == 3); - assert(switch1(INT_MAX) == 8); - assert(switch1(INT_MIN) == 9); - return 0; -} diff --git a/ir/be/test/switch_test.c b/ir/be/test/switch_test.c deleted file mode 100644 index d1c7f97a2..000000000 --- a/ir/be/test/switch_test.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -int test(int a) -{ - int b = 0xff; - - switch (a * b) { - case 0: - b *= a; - case 1: - b *= a; - ++b; - break; - case 2: - b /= a; - break; - case 3: - b *= a*a; - break; - case 4: - b = a % 3; - break; - case 5: - b = 2; - break; - default: - return 0; - } - return b; -} - -int main() -{ - printf("SwitchTest\n"); - printf(" on %d %d\n", -1, test(-1)); - printf(" on %d %d\n", 0, test(0)); - printf(" on %d %d\n", 1, test(1)); - printf(" on %d %d\n", 2, test(2)); - printf(" on %d %d\n", 3, test(3)); - printf(" on %d %d\n", 4, test(4)); - printf(" on %d %d\n", 5, test(5)); - printf(" on %d %d\n", 6, test(6)); - - return 0; -} diff --git a/ir/be/test/switch_test2.c b/ir/be/test/switch_test2.c deleted file mode 100644 index 71b2a57d2..000000000 --- a/ir/be/test/switch_test2.c +++ /dev/null @@ -1,43 +0,0 @@ -static int test2(int a) -{ - int b = 0xff; - - switch (a * b) { - case 0: - b *= a; - case 1: - b *= a; - ++b; - break; - case 2: - b /= a; - break; - case 3: - b *= a*a; - break; - case 4: - b = a % 3; - break; - case 10000: - b = 2; - break; - default: - return 0; - } - return b; -} - -int main() -{ - printf("SwitchTest\n"); - printf(" on %d %d\n", -1, test2(-1)); - printf(" on %d %d\n", 0, test2(0)); - printf(" on %d %d\n", 1, test2(1)); - printf(" on %d %d\n", 2, test2(2)); - printf(" on %d %d\n", 3, test2(3)); - printf(" on %d %d\n", 4, test2(4)); - printf(" on %d %d\n", 5, test2(5)); - printf(" on %d %d\n", 6, test2(6)); - - return 0; -} diff --git a/ir/be/test/tailrec.c b/ir/be/test/tailrec.c deleted file mode 100644 index 4bac4799e..000000000 --- a/ir/be/test/tailrec.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -static unsigned fak(unsigned n) -{ - if (n == 0) - return 1; - - return n * fak(n - 1); -} - - -int main(int argc, char *argv[]) -{ - int x = 4; - - printf("%d! = %d\n", x, fak(x)); - - return 0; -} diff --git a/ir/be/test/tailrec2.c b/ir/be/test/tailrec2.c deleted file mode 100644 index e2c4d3c0a..000000000 --- a/ir/be/test/tailrec2.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -unsigned fak(unsigned n) { - if (n == 0) - return 1; - return fak(n-1) * n; -} - -int main(int argc, char *argv[]) { - unsigned v = 7; - - if (argc > 1) - v = atoi(argv[1]); - printf("%u! = %u\n", v, fak(v)); -} diff --git a/ir/be/test/tcc/tcclib.h b/ir/be/test/tcc/tcclib.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/ir/be/test/tcc/tcctest.c b/ir/be/test/tcc/tcctest.c deleted file mode 100644 index 2b8e269c5..000000000 --- a/ir/be/test/tcc/tcctest.c +++ /dev/null @@ -1,2177 +0,0 @@ -/* - * TCC auto test program - */ -//#include "config.h" -#include -#include -#include - -#if GCC_MAJOR >= 3 - -/* Unfortunately, gcc version < 3 does not handle that! */ -#define ALL_ISOC99 - -/* only gcc 3 handles _Bool correctly */ -#define BOOL_ISOC99 - -/* gcc 2.95.3 does not handle correctly CR in strings or after strays */ -/* Matze: removed this test as I couldn't committ it to svn... */ -/* #define CORRECT_CR_HANDLING */ - -#endif - -/* deprecated and no longer supported in gcc 3.3 */ -//#define ACCEPT_CR_IN_STRINGS - -/* __VA_ARGS__ and __func__ support */ -#define C99_MACROS - -/* test various include syntaxes */ - -#define TCCLIB_INC -#define TCCLIB_INC1 -#define TCCLIB_INC3 "tcclib" - -#include TCCLIB_INC - -#include TCCLIB_INC1.TCCLIB_INC2 - -#include TCCLIB_INC1.h> - -/* gcc 3.2 does not accept that (bug ?) */ -//#include TCCLIB_INC3 ".h" - -#include "tcclib.h" - -#include - -void string_test(); -void expr_test(); -void macro_test(); -void scope_test(); -void forward_test(); -void funcptr_test(); -void loop_test(); -void switch_test(); -void goto_test(); -void enum_test(); -void typedef_test(); -void struct_test(); -void array_test(); -void expr_ptr_test(); -void bool_test(); -void expr2_test(); -void constant_expr_test(); -void expr_cmp_test(); -void char_short_test(); -void init_test(void); -void compound_literal_test(void); -int kr_test(); -void struct_assign_test(void); -void cast_test(void); -void bitfield_test(void); -void c99_bool_test(void); -void float_test(void); -void longlong_test(void); -void stdarg_test(void); -void whitespace_test(void); -void relocation_test(void); -void old_style_function(void); -void sizeof_test(void); -void typeof_test(void); -void local_label_test(void); -void statement_expr_test(void); -void asm_test(void); -void builtin_test(void); -void static_test(void); - -int fib(int n); -void num(int n); -void forward_ref(void); -int isid(int c); - -#define A 2 -#define N 1234 + A -#define pf printf -#define M1(a, b) (a) + (b) - -#define str\ -(s) # s -#define glue(a, b) a ## b -#define xglue(a, b) glue(a, b) -#define HIGHLOW "hello" -#define LOW LOW ", world" - -#define min(a, b) ((a) < (b) ? (a) : (b)) - -#ifdef C99_MACROS -#define dprintf(level,...) printf(__VA_ARGS__) -#endif - -/* gcc vararg macros */ -#define dprintf1(level, fmt, args...) printf(fmt, ## args) - -#define MACRO_NOARGS() - -#define AAA 3 -#undef AAA -#define AAA 4 - -#if 1 -#define B3 1 -#elif 1 -#define B3 2 -#elif 0 -#define B3 3 -#else -#define B3 4 -#endif - -#define __INT64_C(c) c ## LL -#define INT64_MIN (-__INT64_C(9223372036854775807)-1) - -int qq(int x) -{ - return x + 40; -} -#define qq(x) x - -#define spin_lock(lock) do { } while (0) -#define wq_spin_lock spin_lock -#define TEST2() wq_spin_lock(a) - -void macro_test(void) -{ - printf("macro:\n"); - pf("N=%d\n", N); - printf("aaa=%d\n", AAA); - - printf("min=%d\n", min(1, min(2, -1))); - - printf("s1=%s\n", glue(HIGH, LOW)); - printf("s2=%s\n", xglue(HIGH, LOW)); - printf("s3=%s\n", str("c")); - printf("s4=%s\n", str(a1)); - printf("B3=%d\n", B3); - -#ifdef A - printf("A defined\n"); -#endif -#ifdef B - printf("B defined\n"); -#endif -#ifdef A - printf("A defined\n"); -#else - printf("A not defined\n"); -#endif -#ifdef B - printf("B defined\n"); -#else - printf("B not defined\n"); -#endif - -#ifdef A - printf("A defined\n"); -#ifdef B - printf("B1 defined\n"); -#else - printf("B1 not defined\n"); -#endif -#else - printf("A not defined\n"); -#ifdef B - printf("B2 defined\n"); -#else - printf("B2 not defined\n"); -#endif -#endif - -#if 1+1 - printf("test true1\n"); -#endif -#if 0 - printf("test true2\n"); -#endif -#if 1-1 - printf("test true3\n"); -#endif -#if defined(A) - printf("test trueA\n"); -#endif -#if defined(B) - printf("test trueB\n"); -#endif - -#if 0 - printf("test 0\n"); -#elif 0 - printf("test 1\n"); -#elif 2 - printf("test 2\n"); -#else - printf("test 3\n"); -#endif - - MACRO_NOARGS(); - -#ifdef __LINE__ - printf("__LINE__ defined\n"); -#endif - - printf("__LINE__=%d __FILE__=%s\n", - __LINE__, __FILE__); -#line 200 - printf("__LINE__=%d __FILE__=%s\n", - __LINE__, __FILE__); -#line 203 "test" - printf("__LINE__=%d __FILE__=%s\n", - __LINE__, __FILE__); -#line 220 "tcctest.c" - - /* not strictly preprocessor, but we test it there */ -#ifdef C99_MACROS - printf("__func__ = %s\n", __func__); - dprintf(1, "vaarg=%d\n", 1); -#endif - dprintf1(1, "vaarg1\n"); - dprintf1(1, "vaarg1=%d\n", 2); - dprintf1(1, "vaarg1=%d %d\n", 1, 2); - - /* gcc extension */ - printf("func='%s'\n", __FUNCTION__); - - /* complicated macros in glibc */ - printf("INT64_MIN=%Ld\n", INT64_MIN); - { - int a; - a = 1; - glue(a+, +); - printf("a=%d\n", a); - glue(a <, <= 2); - printf("a=%d\n", a); - } - - /* macro function with argument outside the macro string */ -#define MF_s MF_hello -#define MF_hello(msg) printf("%s\n",msg) - -#define MF_t printf("tralala\n"); MF_hello - - MF_s("hi"); - MF_t("hi"); - - /* test macro substituion inside args (should not eat stream) */ - printf("qq=%d\n", qq(qq)(2)); - - /* test zero argument case. NOTE: gcc 2.95.x does not accept a - null argument without a space. gcc 3.2 fixes that. */ - -#define qq1(x) 1 - printf("qq1=%d\n", qq1( )); - - /* comment with stray handling *\ -/ - /* this is a valid *\/ comment */ - /* this is a valid comment *\*/ - // this is a valid\ -comment - - /* test function macro substitution when the function name is - substituted */ - TEST2(); - -#define PART_ONE(n) (!!((n) & 0xF)) -#define PART_TWO(n) (PART_ONE(n)) -#define PART_THREE(f) PART_TWO(0x##f##U) - printf("Nested macros: %d == 0\n", PART_THREE(0)); - -} - -int some_fn(int x) -{ - return x; -} - -int other_fn(int x) -{ - return x*2; -} - -int op(a,b) -{ - return a / b; -} - -int ret(a) -{ - if (a == 2) - return 1; - if (a == 3) - return 2; - return 0; -} - -void ps(const char *s) -{ - int c; - while (1) { - c = *s; - if (c == 0) - break; - printf("%c", c); - s++; - } -} - -const char foo1_string[] = "\ -bar\n\ -test\14\ -1"; - -void string_test() -{ - int b; - printf("string:\n"); - printf("\141\1423\143\n");/* dezdez test */ - printf("\x41\x42\x43\x3a\n"); - printf("c=%c\n", 'r'); - printf("wc=%C 0x%lx %C\n", L'a', L'\x1234', L'c'); - printf("foo1_string='%s'\n", foo1_string); -#if 0 - printf("wstring=%S\n", L"abc"); - printf("wstring=%S\n", L"abc" L"def" "ghi"); - printf("'\\377'=%d '\\xff'=%d\n", '\377', '\xff'); - printf("L'\\377'=%d L'\\xff'=%d\n", L'\377', L'\xff'); -#endif - ps("test\n"); - b = 32; - while ((b = b + 1) < 96) { - printf("%c", b); - } - printf("\n"); - printf("fib=%d\n", fib(33)); - b = 262144; - while (b != 0x80000000) { - num(b); - b = b * 2; - } -} - -void loop_test() -{ - int i; - i = 0; - while (i < 10) - printf("%d", i++); - printf("\n"); - for(i = 0; i < 10;i++) - printf("%d", i); - printf("\n"); - i = 0; - do { - printf("%d", i++); - } while (i < 10); - printf("\n"); - - /* break/continue tests */ - i = 0; - while (1) { - if (i == 6) - break; - i++; - if (i == 3) - continue; - printf("%d", i); - } - printf("\n"); - - /* break/continue tests */ - i = 0; - do { - if (i == 6) - break; - i++; - if (i == 3) - continue; - printf("%d", i); - } while(1); - printf("\n"); - - for(i = 0;i < 10;i++) { - if (i == 3) - continue; - printf("%d", i); - } - printf("\n"); -} - - -void goto_test() -{ - int i; - static void *label_table[3] = { &&label1, &&label2, &&label3 }; - - printf("goto:\n"); - i = 0; - s_loop: - if (i >= 10) - goto s_end; - printf("%d", i); - i++; - goto s_loop; - s_end: - printf("\n"); - - /* we also test computed gotos (GCC extension) */ - for(i=0;i<3;i++) { - goto *label_table[i]; - label1: - printf("label1\n"); - goto next; - label2: - printf("label2\n"); - goto next; - label3: - printf("label3\n"); - next: ; - } -} - -enum { - E0, - E1 = 2, - E2 = 4, - E3, - E4, -}; - -enum test { - E5 = 1000, -}; - -void enum_test() -{ - enum test b1; - printf("enum:\n%d %d %d %d %d %d\n", - E0, E1, E2, E3, E4, E5); - b1 = 1; - printf("b1=%d\n", b1); -} - -typedef int *my_ptr; - -void typedef_test() -{ - my_ptr a; - int b; - a = &b; - *a = 1234; - printf("typedef:\n"); - printf("a=%d\n", *a); -} - -void forward_test() -{ - printf("forward:\n"); - forward_ref(); - forward_ref(); -} - - -void forward_ref(void) -{ - printf("forward ok\n"); -} - -typedef struct struct1 { - int f1; - int f2, f3; - union union1 { - int v1; - int v2; - } u; - char str[3]; -} struct1; - -struct struct2 { - int a; - char b; -}; - -union union2 { - int w1; - int w2; -}; - -struct struct1 st1, st2; - -int main(int argc, char **argv) -{ - string_test(); - expr_test(); - macro_test(); - scope_test(); - forward_test(); - funcptr_test(); - loop_test(); - switch_test(); - goto_test(); - enum_test(); - typedef_test(); - struct_test(); - array_test(); - expr_ptr_test(); - bool_test(); - expr2_test(); - constant_expr_test(); - expr_cmp_test(); - char_short_test(); - init_test(); - compound_literal_test(); - kr_test(); - struct_assign_test(); - cast_test(); - bitfield_test(); - c99_bool_test(); - float_test(); - longlong_test(); - stdarg_test(); - whitespace_test(); - relocation_test(); - old_style_function(); - sizeof_test(); - typeof_test(); - statement_expr_test(); - local_label_test(); - asm_test(); - builtin_test(); - static_test(); - return 0; -} - -int tab[3]; -int tab2[3][2]; - -int g; - -void f1(g) -{ - printf("g1=%d\n", g); -} - -void scope_test() -{ - printf("scope:\n"); - g = 2; - f1(1); - printf("g2=%d\n", g); - { - int g; - g = 3; - printf("g3=%d\n", g); - { - int g; - g = 4; - printf("g4=%d\n", g); - } - } - printf("g5=%d\n", g); -} - -void array_test(int a[4]) -{ - int i, j; - - printf("array:\n"); - printf("sizeof(a) = %d\n", sizeof(a)); - printf("sizeof(\"a\") = %d\n", sizeof("a")); -#ifdef C99_MACROS - printf("sizeof(__func__) = %d\n", sizeof(__func__)); -#endif - printf("sizeof tab %d\n", sizeof(tab)); - printf("sizeof tab2 %d\n", sizeof tab2); - tab[0] = 1; - tab[1] = 2; - tab[2] = 3; - printf("%d %d %d\n", tab[0], tab[1], tab[2]); - for(i=0;i<3;i++) - for(j=0;j<2;j++) - tab2[i][j] = 10 * i + j; - for(i=0;i<3*2;i++) { - printf(" %3d", ((int *)tab2)[i]); - } - printf("\n"); -} - -void expr_test() -{ - int a, b; - a = 0; - printf("%d\n", a += 1); - printf("%d\n", a -= 2); - printf("%d\n", a *= 31232132); - printf("%d\n", a /= 4); - printf("%d\n", a %= 20); - printf("%d\n", a &= 6); - printf("%d\n", a ^= 7); - printf("%d\n", a |= 8); - printf("%d\n", a >>= 3); - printf("%d\n", a <<= 4); - - a = 22321; - b = -22321; - printf("%d\n", a + 1); - printf("%d\n", a - 2); - printf("%d\n", a * 312); - printf("%d\n", a / 4); - printf("%d\n", b / 4); - printf("%d\n", (unsigned)b / 4); - printf("%d\n", a % 20); - printf("%d\n", b % 20); - printf("%d\n", (unsigned)b % 20); - printf("%d\n", a & 6); - printf("%d\n", a ^ 7); - printf("%d\n", a | 8); - printf("%d\n", a >> 3); - printf("%d\n", b >> 3); - printf("%d\n", (unsigned)b >> 3); - printf("%d\n", a << 4); - printf("%d\n", ~a); - printf("%d\n", -a); - printf("%d\n", +a); - - printf("%d\n", 12 + 1); - printf("%d\n", 12 - 2); - printf("%d\n", 12 * 312); - printf("%d\n", 12 / 4); - printf("%d\n", 12 % 20); - printf("%d\n", 12 & 6); - printf("%d\n", 12 ^ 7); - printf("%d\n", 12 | 8); - printf("%d\n", 12 >> 2); - printf("%d\n", 12 << 4); - printf("%d\n", ~12); - printf("%d\n", -12); - printf("%d\n", +12); - printf("%d %d %d %d\n", - isid('a'), - isid('g'), - isid('T'), - isid('(')); - - { - /* Check that tcc saves registers before a conditional jump */ - /* Addresses bug "grischka case_2" */ - struct test_str { int a, b, c; }; - struct test_str t1 = {0,0,0}; - struct test_str t2 = {1,1,1}; - struct test_str *p1 = &t1; - struct test_str *p2 = &t2; - int f = 0; - int g = 0; - - p1->b = f==0 || isid(0); - printf("case_2.1: Expect 0 1 0 -> %d %d %d\n", p1->a, p1->b, p1->c); - p1->c = !f || isid(0); - printf("case_2.2: Expect 0 1 1 -> %d %d %d\n", p1->a, p1->b, p1->c); - - /* This will crash old versions of tcc during compilation: */ - p2->b = (f==1) && isid(0); - printf("case_2.1AND: Expect 0 1 0 -> %d %d %d\n", p2->a, p2->b, p2->c); - p2->b = (!(f==1)) && isid(0); - printf("case_2.2AND: Expect 0 1 0 -> %d %d %d\n", p2->a, p2->b, p2->c); - } -} - -int isid(int c) -{ - return (c >= 'a' & c <= 'z') | (c >= 'A' & c <= 'Z') | c == '_'; -} - -/**********************/ - -int vstack[10], *vstack_ptr; - -void vpush(int vt, int vc) -{ - *vstack_ptr++ = vt; - *vstack_ptr++ = vc; -} - -void vpop(int *ft, int *fc) -{ - *fc = *--vstack_ptr; - *ft = *--vstack_ptr; -} - -void expr2_test() -{ - int a, b; - - printf("expr2:\n"); - vstack_ptr = vstack; - vpush(1432432, 2); - vstack_ptr[-2] &= ~0xffffff80; - vpop(&a, &b); - printf("res= %d %d\n", a, b); -} - -void constant_expr_test() -{ - int a; - printf("constant_expr:\n"); - a = 3; - printf("%d\n", a * 16); - printf("%d\n", a * 1); - printf("%d\n", a + 0); -} - -int tab4[10]; - -void expr_ptr_test() -{ - int *p, *q; - - printf("expr_ptr:\n"); - p = tab4; - q = tab4 + 10; - printf("diff=%d\n", q - p); - p++; - printf("inc=%d\n", p - tab4); - p--; - printf("dec=%d\n", p - tab4); - ++p; - printf("inc=%d\n", p - tab4); - --p; - printf("dec=%d\n", p - tab4); - printf("add=%d\n", p + 3 - tab4); - printf("add=%d\n", 3 + p - tab4); -} - -void expr_cmp_test() -{ - int a, b; - printf("constant_expr:\n"); - a = -1; - b = 1; - printf("%d\n", a == a); - printf("%d\n", a != a); - - printf("%d\n", a < b); - printf("%d\n", a <= b); - printf("%d\n", a <= a); - printf("%d\n", b >= a); - printf("%d\n", a >= a); - printf("%d\n", b > a); - - printf("%d\n", (unsigned)a < b); - printf("%d\n", (unsigned)a <= b); - printf("%d\n", (unsigned)a <= a); - printf("%d\n", (unsigned)b >= a); - printf("%d\n", (unsigned)a >= a); - printf("%d\n", (unsigned)b > a); -} - -struct empty { -}; - -struct aligntest1 { - char a[10]; -}; - -struct aligntest2 { - int a; - char b[10]; -}; - -struct aligntest3 { - double a, b; -}; - -struct aligntest4 { - double a[0]; -}; - -void struct_test() -{ - struct1 *s; - union union2 u; - - printf("struct:\n"); - printf("sizes: %d %d %d %d\n", - sizeof(struct struct1), - sizeof(struct struct2), - sizeof(union union1), - sizeof(union union2)); - st1.f1 = 1; - st1.f2 = 2; - st1.f3 = 3; - printf("st1: %d %d %d\n", - st1.f1, st1.f2, st1.f3); - st1.u.v1 = 1; - st1.u.v2 = 2; - printf("union1: %d\n", st1.u.v1); - u.w1 = 1; - u.w2 = 2; - printf("union2: %d\n", u.w1); - s = &st2; - s->f1 = 3; - s->f2 = 2; - s->f3 = 1; - printf("st2: %d %d %d\n", - s->f1, s->f2, s->f3); - printf("str_addr=%x\n", (int)st1.str - (int)&st1.f1); - - /* align / size tests */ - printf("aligntest1 sizeof=%d alignof=%d\n", - sizeof(struct aligntest1), __alignof__(struct aligntest1)); - printf("aligntest2 sizeof=%d alignof=%d\n", - sizeof(struct aligntest2), __alignof__(struct aligntest2)); - printf("aligntest3 sizeof=%d alignof=%d\n", - sizeof(struct aligntest3), __alignof__(struct aligntest3)); - printf("aligntest4 sizeof=%d alignof=%d\n", - sizeof(struct aligntest4), __alignof__(struct aligntest4)); - - /* empty structures (GCC extension) */ - printf("sizeof(struct empty) = %d\n", sizeof(struct empty)); - printf("alignof(struct empty) = %d\n", __alignof__(struct empty)); -} - -/* XXX: depend on endianness */ -void char_short_test() -{ - int var1, var2; - - printf("char_short:\n"); - - var1 = 0x01020304; - var2 = 0xfffefdfc; - printf("s8=%d %d\n", - *(char *)&var1, *(char *)&var2); - printf("u8=%d %d\n", - *(unsigned char *)&var1, *(unsigned char *)&var2); - printf("s16=%d %d\n", - *(short *)&var1, *(short *)&var2); - printf("u16=%d %d\n", - *(unsigned short *)&var1, *(unsigned short *)&var2); - printf("s32=%d %d\n", - *(int *)&var1, *(int *)&var2); - printf("u32=%d %d\n", - *(unsigned int *)&var1, *(unsigned int *)&var2); - *(char *)&var1 = 0x08; - printf("var1=%x\n", var1); - *(short *)&var1 = 0x0809; - printf("var1=%x\n", var1); - *(int *)&var1 = 0x08090a0b; - printf("var1=%x\n", var1); -} - -/******************/ - -typedef struct Sym { - int v; - int t; - int c; - struct Sym *next; - struct Sym *prev; -} Sym; - -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) - -static int toupper1(int a) -{ - return TOUPPER(a); -} - -void bool_test() -{ - int *s, a, b, t, f, i; - - a = 0; - s = (void*)0; - printf("!s=%d\n", !s); - - if (!s || !s[0]) - a = 1; - printf("a=%d\n", a); - - printf("a=%d %d %d\n", 0 || 0, 0 || 1, 1 || 1); - printf("a=%d %d %d\n", 0 && 0, 0 && 1, 1 && 1); - printf("a=%d %d\n", 1 ? 1 : 0, 0 ? 1 : 0); -#if 1 && 1 - printf("a1\n"); -#endif -#if 1 || 0 - printf("a2\n"); -#endif -#if 1 ? 0 : 1 - printf("a3\n"); -#endif -#if 0 ? 0 : 1 - printf("a4\n"); -#endif - - a = 4; - printf("b=%d\n", a + (0 ? 1 : a / 2)); - - /* test register spilling */ - a = 10; - b = 10; - a = (a + b) * ((a < b) ? - ((b - a) * (a - b)): a + b); - printf("a=%d\n", a); - - /* test complex || or && expressions */ - t = 1; - f = 0; - a = 32; - printf("exp=%d\n", f == (32 <= a && a <= 3)); - printf("r=%d\n", (t || f) + (t && f)); - - /* test ? : cast */ - { - int aspect_on; - int aspect_native = 65536; - double bfu_aspect = 1.0; - int aspect; - for(aspect_on = 0; aspect_on < 2; aspect_on++) { - aspect=aspect_on?(aspect_native*bfu_aspect+0.5):65535UL; - printf("aspect=%d\n", aspect); - } - } - - /* Test passing structs & function pointers though conditional - * operator ? :. This is bug grischka-20050929 case_1 */ - { - struct test1 { int a, b, c; }; - struct test1 t0 = {10,20,30}; - struct test1 t1 = {11,21,31}; - struct test1 tx = {0,0,0}; - int (*pfn)(int); - int f = 0; - - tx = f==0 ? t0 : t1; - printf("case_1.1: 10,20,30 -> %d,%d,%d\n", tx.a, tx.b, tx.c); - - /* This tests to see that function pointers correctly pass through - the conditional operator ?:. This tests for - grischka-20050929 case_1.2. Note that this was already FIXED - in rl-1.0.0, but we want to TEST for it too. */ - pfn = f ? some_fn : other_fn; - printf("case_1.2: other -> %s\n", 1==pfn(1)?"some":"other"); - } - - - /* test ? : GCC extension */ - { - static int v1 = 34 ? : -1; /* constant case */ - static int v2 = 0 ? : -1; /* constant case */ - int a = 30; - - printf("%d %d\n", v1, v2); - printf("%d %d\n", a - 30 ? : a * 2, a + 1 ? : a * 2); - } - - /* again complex expression */ - for(i=0;i<256;i++) { - if (toupper1 (i) != TOUPPER (i)) - printf("error %d\n", i); - } - -} - -/* GCC accepts that */ -static int tab_reinit[]; -static int tab_reinit[10]; - -//int cinit1; /* a global variable can be defined several times without error ! */ -int cinit1; -int cinit1; -int cinit1 = 0; -int *cinit2 = (int []){3, 2, 1}; - -void compound_literal_test(void) -{ - int *p, i; - char *q, *q3; - - printf("compound_test:\n"); - - p = (int []){1, 2, 3}; - for(i=0;i<3;i++) - printf(" %d", p[i]); - printf("\n"); - - for(i=0;i<3;i++) - printf("%d", cinit2[i]); - printf("\n"); - - q = "tralala1"; - printf("q1=%s\n", q); - - q = (char *){ "tralala2" }; - printf("q2=%s\n", q); - - q3 = (char *){ q }; - printf("q3=%s\n", q3); - - q = (char []){ "tralala3" }; - printf("q4=%s\n", q); - -#ifdef ALL_ISOC99 - p = (int []){1, 2, cinit1 + 3}; - for(i=0;i<3;i++) - printf(" %d", p[i]); - printf("\n"); - - for(i=0;i<3;i++) { - p = (int []){1, 2, 4 + i}; - printf("%d %d %d\n", - p[0], - p[1], - p[2]); - } -#endif -} - -/* K & R protos */ - -kr_func1(a, b) -{ - return a + b; -} - -int kr_func2(a, b) -{ - return a + b; -} - -kr_test() -{ - printf("kr_test:\n"); - printf("func1=%d\n", kr_func1(3, 4)); - printf("func2=%d\n", kr_func2(3, 4)); - return 0; -} - -void num(int n) -{ - char *tab, *p; - tab = (char*)malloc(20); - p = tab; - while (1) { - *p = 48 + (n % 10); - p++; - n = n / 10; - if (n == 0) - break; - } - while (p != tab) { - p--; - printf("%c", *p); - } - printf("\n"); -} - -/* structure assignment tests */ -struct structa1 { - int f1; - char f2; -}; - -struct structa1 ssta1; - -void struct_assign_test1(struct structa1 s1, int t) -{ - printf("%d %d %d\n", s1.f1, s1.f2, t); -} - -struct structa1 struct_assign_test2(struct structa1 s1, int t) -{ - s1.f1 += t; - s1.f2 -= t; - return s1; -} - -void struct_assign_test3(void) -{ - // incompatible assigment - struct _s1 { int a, b, c; } *p1 = NULL; - struct _s2 { int a, b, c; } *p2 = p1; //warning - printf("struct assign, 0 -> %x\n", p2); -} - -void struct_assign_test(void) -{ - struct structa1 lsta1, lsta2; - -#if 0 - printf("struct_assign_test:\n"); - - lsta1.f1 = 1; - lsta1.f2 = 2; - printf("%d %d\n", lsta1.f1, lsta1.f2); - lsta2 = lsta1; - printf("%d %d\n", lsta2.f1, lsta2.f2); -#else - lsta2.f1 = 1; - lsta2.f2 = 2; -#endif - struct_assign_test1(lsta2, 3); - - printf("before call: %d %d\n", lsta2.f1, lsta2.f2); - lsta2 = struct_assign_test2(lsta2, 4); - printf("after call: %d %d\n", lsta2.f1, lsta2.f2); - struct_assign_test3(); -} - -/* casts to short/char */ - -void cast1(char a, short b, unsigned char c, unsigned short d) -{ - printf("%d %d %d %d\n", a, b, c, d); -} - -char bcast; -short scast; - -void cast_test() -{ - int a; - char c; - char tab[10]; - unsigned b,d; - short s; - double g = 0.1; - - printf("cast_test:\n"); - a = 0xfffff; - cast1(a, a, a, a); - a = 0xffffe; - printf("%d %d %d %d\n", - (char)(a + 1), - (short)(a + 1), - (unsigned char)(a + 1), - (unsigned short)(a + 1)); - printf("%d %d %d %d\n", - (char)0xfffff, - (short)0xfffff, - (unsigned char)0xfffff, - (unsigned short)0xfffff); - - a = (bcast = 128) + 1; - printf("%d\n", a); - a = (scast = 65536) + 1; - printf("%d\n", a); - - printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c)); - - /* test cast from unsigned to signed short to int */ - b = 0xf000; - d = (short)b; - printf("((unsigned)(short)0x%08x) = 0x%08x\n", b, d); - b = 0xf0f0; - d = (char)b; - printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d); - - /* Try casting pointer to short or _Bool (grishka case_6.1). This - * is lossy, so tcc will print a warning. This capability is needed - * to compile gcc 2.95 as well as other programs. */ - { - void *p = (void *) 3; - printf("Expect 3 1 -> %hd %hhd\n", - (short) p, (_Bool) p); /* Expect warning */ - } - - - /* test implicit int casting for array accesses */ - c = 0; - tab[1] = 2; - tab[c] = 1; - printf("%d %d\n", tab[0], tab[1]); - - /* test implicit casting on some operators */ - printf("sizeof(+(char)'a') = %d\n", sizeof(+(char)'a')); - printf("sizeof(-(char)'a') = %d\n", sizeof(-(char)'a')); - printf("sizeof(~(char)'a') = %d\n", sizeof(-(char)'a')); - - /* Cast float to bool */ - printf("%d\n", (_Bool) 0.1); - /* Cast non-constant double 0.1 to bool, should be 1, grischka case 6.2 */ - printf("1 -> %d\n", (_Bool) g); - - /* Cast with sign extension */ - a = (short)0xf000; - printf("0x%x == 0xfffff000\n", a); - a = (signed char)0xf0f0; - printf("0x%x == 0xfffffff0\n", a); -} - -/* initializers tests */ -struct structinit1 { - int f1; - char f2; - short f3; - int farray[3]; -}; - -int sinit1 = 2; -int sinit2 = { 3 }; -int sinit3[3] = { 1, 2, {{3}}, }; -int sinit4[3][2] = { {1, 2}, {3, 4}, {5, 6} }; -int sinit5[3][2] = { 1, 2, 3, 4, 5, 6 }; -int sinit6[] = { 1, 2, 3 }; -int sinit7[] = { [2] = 3, [0] = 1, 2 }; -char sinit8[] = "hello" "trala"; - -struct structinit1 sinit9 = { 1, 2, 3 }; -struct structinit1 sinit10 = { .f2 = 2, 3, .f1 = 1 }; -struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1, -#ifdef ALL_ISOC99 - .farray[0] = 10, - .farray[1] = 11, - .farray[2] = 12, -#endif -}; - -char *sinit12 = "hello world"; -char *sinit13[] = { - "test1", - "test2", - "test3", -}; -char sinit14[10] = { "abc" }; -int sinit15[3] = { sizeof(sinit15), 1, 2 }; - -struct { int a[3], b; } sinit16[] = { { 1 }, 2 }; - -struct bar { - char *s; - int len; -} sinit17[] = { - "a1", 4, - "a2", 1 -}; - -int sinit18[10] = { - [2 ... 5] = 20, - 2, - [8] = 10, -}; - -void init_test(void) -{ - int linit1 = 2; - int linit2 = { 3 }; - int linit4[3][2] = { {1, 2}, {3, 4}, {5, 6} }; - int linit6[] = { 1, 2, 3 }; - int i, j; - char linit8[] = "hello" "trala"; - int linit12[10] = { 1, 2 }; - int linit13[10] = { 1, 2, [7] = 3, [3] = 4, }; - char linit14[10] = "abc"; - int linit15[10] = { linit1, linit1 + 1, [6] = linit1 + 2, }; - struct linit16 { int a1, a2, a3, a4; } linit16 = { 1, .a3 = 2 }; - int linit17 = sizeof(linit17); - - printf("init_test:\n"); - - printf("sinit1=%d\n", sinit1); - printf("sinit2=%d\n", sinit2); - printf("sinit3=%d %d %d %d\n", - sizeof(sinit3), - sinit3[0], - sinit3[1], - sinit3[2] - ); - printf("sinit6=%d\n", sizeof(sinit6)); - printf("sinit7=%d %d %d %d\n", - sizeof(sinit7), - sinit7[0], - sinit7[1], - sinit7[2] - ); - printf("sinit8=%s\n", sinit8); - printf("sinit9=%d %d %d\n", - sinit9.f1, - sinit9.f2, - sinit9.f3 - ); - printf("sinit10=%d %d %d\n", - sinit10.f1, - sinit10.f2, - sinit10.f3 - ); - printf("sinit11=%d %d %d %d %d %d\n", - sinit11.f1, - sinit11.f2, - sinit11.f3, - sinit11.farray[0], - sinit11.farray[1], - sinit11.farray[2] - ); - - for(i=0;i<3;i++) - for(j=0;j<2;j++) - printf("[%d][%d] = %d %d %d\n", - i, j, sinit4[i][j], sinit5[i][j], linit4[i][j]); - printf("linit1=%d\n", linit1); - printf("linit2=%d\n", linit2); - printf("linit6=%d\n", sizeof(linit6)); - printf("linit8=%d %s\n", sizeof(linit8), linit8); - - printf("sinit12=%s\n", sinit12); - printf("sinit13=%d %s %s %s\n", - sizeof(sinit13), - sinit13[0], - sinit13[1], - sinit13[2]); - printf("sinit14=%s\n", sinit14); - - for(i=0;i<10;i++) printf(" %d", linit12[i]); - printf("\n"); - for(i=0;i<10;i++) printf(" %d", linit13[i]); - printf("\n"); - for(i=0;i<10;i++) printf(" %d", linit14[i]); - printf("\n"); - for(i=0;i<10;i++) printf(" %d", linit15[i]); - printf("\n"); - printf("%d %d %d %d\n", - linit16.a1, - linit16.a2, - linit16.a3, - linit16.a4); - /* test that initialisation is done after variable declare */ - printf("linit17=%d\n", linit17); - printf("sinit15=%d\n", sinit15[0]); - printf("sinit16=%d %d\n", sinit16[0].a[0], sinit16[1].a[0]); - printf("sinit17=%s %d %s %d\n", - sinit17[0].s, sinit17[0].len, - sinit17[1].s, sinit17[1].len); - for(i=0;i<10;i++) - printf("%x ", sinit18[i]); - printf("\n"); -} - - -void switch_test() -{ - int i; - - for(i=0;i<15;i++) { - switch(i) { - case 0: - case 1: - printf("a"); - break; - default: - printf("%d", i); - break; - case 8 ... 12: - printf("c"); - break; - case 3: - printf("b"); - break; - } - } - printf("\n"); -} - -/* ISOC99 _Bool type */ -void c99_bool_test(void) -{ -#ifdef BOOL_ISOC99 - int a; - _Bool b; - - printf("bool_test:\n"); - printf("sizeof(_Bool) = %d\n", sizeof(_Bool)); - a = 3; - printf("cast: %d %d %d\n", (_Bool)10, (_Bool)0, (_Bool)a); - b = 3; - printf("b = %d\n", b); - b++; - printf("b = %d\n", b); -#endif -} - -void bitfield_test(void) -{ - int a; - struct sbf1 { - int f1 : 3; - int : 2; - int f2 : 1; - int : 0; - int f3 : 5; - int f4 : 7; - unsigned int f5 : 7; - } st1; - printf("bitfield_test:"); - printf("sizeof(st1) = %d\n", sizeof(st1)); - - st1.f1 = 3; - st1.f2 = 1; - st1.f3 = 15; - a = 120; - st1.f4 = a; - st1.f5 = a; - st1.f5++; - printf("%d %d %d %d %d\n", - st1.f1, st1.f2, st1.f3, st1.f4, st1.f5); - - st1.f1 = 7; - if (st1.f1 == -1) - printf("st1.f1 == -1\n"); - else - printf("st1.f1 != -1\n"); - if (st1.f2 == -1) - printf("st1.f2 == -1\n"); - else - printf("st1.f2 != -1\n"); - - /* Do bitfield assignments return correct rvalue? This is bug - * grischka-2005-09-29 case_3 */ - { - struct test1 { unsigned a:1, b:1, c:1, d:1; }; - struct test1 t1 = {0, 1, 0, 1}; - struct test1 *p = &t1; - - printf("case_3.1: 0101 -> %d%d%d%d\n", p->a, p->b, p->c, p->d); - p->b = p->d = 0; - p->a = p->c = 1; - printf("case_3.2: 1010 -> %d%d%d%d\n", p->a, p->b, p->c, p->d); - } - -} - -#define FTEST(prefix, type, fmt)\ -void prefix ## cmp(type a, type b)\ -{\ - printf("%d %d %d %d %d %d\n",\ - a == b,\ - a != b,\ - a < b,\ - a > b,\ - a >= b,\ - a <= b);\ - printf(fmt " " fmt " " fmt " " fmt " " fmt " " fmt " " fmt "\n",\ - a,\ - b,\ - a + b,\ - a - b,\ - a * b,\ - a / b,\ - -a);\ - printf(fmt "\n", ++a);\ - printf(fmt "\n", a++);\ - printf(fmt "\n", a);\ -}\ -void prefix ## fcast(type a)\ -{\ - float fa;\ - double da;\ - long double la;\ - int ia;\ - unsigned int ua;\ - type b;\ - fa = a;\ - da = a;\ - la = a;\ - printf("ftof: %f %f %Lf\n", fa, da, la);\ - ia = (int)a;\ - ua = (unsigned int)a;\ - printf("ftoi: %d %u\n", ia, ua);\ - ia = -1234;\ - ua = 0x81234500;\ - b = ia;\ - printf("itof: " fmt "\n", b);\ - b = ua;\ - printf("utof: " fmt "\n", b);\ -}\ -\ -void prefix ## test(void)\ -{\ - printf("testing '%s'\n", #type);\ - prefix ## cmp(1, 2.5);\ - prefix ## cmp(2, 1.5);\ - prefix ## cmp(1, 1);\ - prefix ## fcast(234.6);\ - prefix ## fcast(-2334.6);\ -} - -FTEST(f, float, "%f") -FTEST(d, double, "%f") -FTEST(ld, long double, "%Lf") - -double ftab1[3] = { 1.2, 3.4, -5.6 }; - - -void float_test(void) -{ - float fa, fb; - double da, db; - int a; - unsigned int b; - - printf("float_test:\n"); - printf("sizeof(float) = %d\n", sizeof(float)); - printf("sizeof(double) = %d\n", sizeof(double)); - printf("sizeof(long double) = %d\n", sizeof(long double)); - ftest(); - dtest(); - ldtest(); - printf("%f %f %f\n", ftab1[0], ftab1[1], ftab1[2]); - printf("%f %f %f\n", 2.12, .5, 2.3e10); - // printf("%f %f %f\n", 0x1234p12, 0x1e23.23p10, 0x12dp-10); - da = 123; - printf("da=%f\n", da); - fa = 123; - printf("fa=%f\n", fa); - a = 4000000000; - da = a; - printf("da = %f\n", da); - b = 4000000000; - db = b; - printf("db = %f\n", db); -} - -int fib(int n) -{ - if (n <= 2) - return 1; - else - return fib(n-1) + fib(n-2); -} - -int reply_self(int x) -{ - return x; -} - -void funcptr_test() -{ - void (*func)(int); - int a; - struct { - int dummy; - void (*func)(int); - } st1; - - printf("funcptr:\n"); - func = # - (*func)(12345); - func = num; - a = 1; - a = 1; - func(12345); - /* more complicated pointer computation */ - st1.func = num; - st1.func(12346); - printf("sizeof1 = %d\n", sizeof(funcptr_test)); - printf("sizeof2 = %d\n", sizeof funcptr_test); - printf("sizeof3 = %d\n", sizeof(&funcptr_test)); - printf("sizeof4 = %d\n", sizeof &funcptr_test); - - /* Test function pointer indirection */ - { - int (*pfn)(int) = reply_self; - printf("case_9: 1 (7,8) -> %d (%d,%d)\n", - (int) (reply_self == *pfn), pfn(7), (******pfn)(8)); - } - -} - -void lloptest(long long a, long long b) -{ - unsigned long long ua, ub; - - ua = a; - ub = b; - /* arith */ - printf("arith: %Ld %Ld %Ld\n", - a + b, - a - b, - a * b); - - if (b != 0) { - printf("arith1: %Ld %Ld\n", - a / b, - a % b); - } - - /* binary */ - printf("bin: %Ld %Ld %Ld\n", - a & b, - a | b, - a ^ b); - - /* tests */ - printf("test: %d %d %d %d %d %d\n", - a == b, - a != b, - a < b, - a > b, - a >= b, - a <= b); - - printf("utest: %d %d %d %d %d %d\n", - ua == ub, - ua != ub, - ua < ub, - ua > ub, - ua >= ub, - ua <= ub); - - /* arith2 */ - a++; - b++; - printf("arith2: %Ld %Ld\n", a, b); - printf("arith2: %Ld %Ld\n", a++, b++); - printf("arith2: %Ld %Ld\n", --a, --b); - printf("arith2: %Ld %Ld\n", a, b); -} - -void llshift(long long a, int b) -{ - printf("shift: %Ld %Ld %Ld\n", - (unsigned long long)a >> b, - a >> b, - a << b); - printf("shiftc: %Ld %Ld %Ld\n", - (unsigned long long)a >> 3, - a >> 3, - a << 3); - printf("shiftc: %Ld %Ld %Ld\n", - (unsigned long long)a >> 35, - a >> 35, - a << 35); -} - -void llfloat(void) -{ - float fa; - double da; - long double lda; - long long la, lb, lc; - unsigned long long ula, ulb, ulc; - la = 0x12345678; - ula = 0x72345678; - la = (la << 20) | 0x12345; - ula = ula << 33; - printf("la=%Ld ula=%Lu\n", la, ula); - - fa = la; - da = la; - lda = la; - printf("lltof: %f %f %Lf\n", fa, da, lda); - - la = fa; - lb = da; - lc = lda; - printf("ftoll: %Ld %Ld %Ld\n", la, lb, lc); - - fa = ula; - da = ula; - lda = ula; - printf("ulltof: %f %f %Lf\n", fa, da, lda); - - ula = fa; - ulb = da; - ulc = lda; - printf("ftoull: %Lu %Lu %Lu\n", ula, ulb, ulc); -} - -long long llfunc1(int a) -{ - return a * 2; -} - -struct S { - int id; - char item; -}; - -long long int value(struct S *v) -{ - return ((long long int)v->item); -} - -void longlong_test(void) -{ - long long a, b, c; - unsigned long long ull; - int ia; - unsigned int ua; - printf("longlong_test:\n"); - printf("sizeof(long long) = %d\n", sizeof(long long)); - ia = -1; - ua = -2; - a = ia; - b = ua; - printf("%Ld %Ld\n", a, b); - printf("%Ld %Ld %Ld %Lx\n", - (long long)1, - (long long)-2, - 1LL, - 0x1234567812345679); - a = llfunc1(-3); - printf("%Ld\n", a); - - lloptest(1000, 23); - lloptest(0xff, 0x1234); - b = 0x72345678 << 10; - lloptest(-3, b); - llshift(0x123, 5); - llshift(-23, 5); - b = 0x72345678LL << 10; - llshift(b, 47); - - llfloat(); -#if 1 - b = 0x12345678; - a = -1; - c = a + b; - printf("%Lx\n", c); -#endif - - /* long long reg spill test */ - { - struct S a; - - a.item = 3; - printf("%lld\n", value(&a)); - } - lloptest(0x80000000, 0); - - /* another long long spill test */ - { - long long *p, v; - v = 1; - p = &v; - p[0]++; - printf("%lld\n", *p); - } - - /* Make sure long long comparison tests upper 32 bits */ - ull = 0xffffffff00000000ULL; - printf("ull=%llx\n",ull); - printf("ull!=0 ", (ull != 0) ? "true" : "false"); - printf("ull ", ull ? "true" : "false"); - - /* check double -> ull cast */ - { - double d = 2.4e18; - unsigned long long ull = d; - unsigned long long r = 100000000000LL; - printf("\ndouble->ull (grischka case 10): %.0f -> %ld\n", - d/r, (long)(ull/r)); - } - -} - -void vprintf1(const char *fmt, ...) -{ - va_list ap; - const char *p; - int c, i; - double d; - long long ll; - - va_start(ap, fmt); - - p = fmt; - for(;;) { - c = *p; - if (c == '\0') - break; - p++; - if (c == '%') { - c = *p; - switch(c) { - case '\0': - goto the_end; - case 'd': - i = va_arg(ap, int); - printf("%d", i); - break; - case 'f': - d = va_arg(ap, double); - printf("%f", d); - break; - case 'l': - ll = va_arg(ap, long long); - printf("%Ld", ll); - break; - } - p++; - } else { - putchar(c); - } - } - the_end: - va_end(ap); -} - - -void stdarg_test(void) -{ - vprintf1("%d %d %d\n", 1, 2, 3); - vprintf1("%f %d %f\n", 1.0, 2, 3.0); - vprintf1("%l %l %d %f\n", 1234567891234LL, 987654321986LL, 3, 1234.0); -} - -void whitespace_test(void) -{ - char *str; - -#if 1 - printf("whitspace:\n"); -#endif - pf("N=%d\n", 2); - -#ifdef CORRECT_CR_HANDLING - printf("aaa=%d\n", 3); -#endif - - pri\ -\ -ntf("min=%d\n", 4); - -#ifdef ACCEPT_CR_IN_STRINGS - printf("len1=%d\n", strlen(" -")); -#ifdef CORRECT_CR_HANDLING - str = " -"; - printf("len1=%d str[0]=%d\n", strlen(str), str[0]); -#endif - printf("len1=%d\n", strlen(" a -")); -#endif /* ACCEPT_CR_IN_STRINGS */ -} - -int reltab[3] = { 1, 2, 3 }; - -int *rel1 = &reltab[1]; -int *rel2 = &reltab[2]; - -void relocation_test(void) -{ - printf("*rel1=%d\n", *rel1); - printf("*rel2=%d\n", *rel2); -} - -void old_style_f(a,b,c) - int a, b; - double c; -{ - printf("a=%d b=%d b=%f\n", a, b, c); -} - -void decl_func1(int cmpfn()) -{ - printf("cmpfn=%lx\n", (long)cmpfn); -} - -void decl_func2(cmpfn) -int cmpfn(); -{ - printf("cmpfn=%lx\n", (long)cmpfn); -} - -void old_style_function(void) -{ - old_style_f((void *)1, 2, 3.0); - decl_func1(NULL); - decl_func2(NULL); -} - -void sizeof_test(void) -{ - int a; - int **ptr; - - printf("sizeof(int) = %d\n", sizeof(int)); - printf("sizeof(unsigned int) = %d\n", sizeof(unsigned int)); - printf("sizeof(short) = %d\n", sizeof(short)); - printf("sizeof(unsigned short) = %d\n", sizeof(unsigned short)); - printf("sizeof(char) = %d\n", sizeof(char)); - printf("sizeof(unsigned char) = %d\n", sizeof(unsigned char)); - printf("sizeof(func) = %d\n", sizeof sizeof_test()); - a = 1; - printf("sizeof(a++) = %d\n", sizeof a++); - printf("a=%d\n", a); - ptr = NULL; - printf("sizeof(**ptr) = %d\n", sizeof (**ptr)); - printf("-1>sizeof(int) = %d\n", -1>sizeof(int)); - - /* some alignof tests */ - printf("__alignof__(int) = %d\n", __alignof__(int)); - printf("__alignof__(unsigned int) = %d\n", __alignof__(unsigned int)); - printf("__alignof__(short) = %d\n", __alignof__(short)); - printf("__alignof__(unsigned short) = %d\n", __alignof__(unsigned short)); - printf("__alignof__(char) = %d\n", __alignof__(char)); - printf("__alignof__(unsigned char) = %d\n", __alignof__(unsigned char)); - printf("__alignof__(func) = %d\n", __alignof__ sizeof_test()); -} - -void typeof_test(void) -{ - double a; - typeof(a) b; - typeof(float) c; - - a = 1.5; - b = 2.5; - c = 3.5; - printf("a=%f b=%f c=%f\n", a, b, c); -} - -void statement_expr_test(void) -{ - int a, i; - - a = 0; - for(i=0;i<10;i++) { - a += 1 + - ( { int b, j; - b = 0; - for(j=0;j<5;j++) - b += j; b; - } ); - } - printf("a=%d\n", a); - -} - -void local_label_test(void) -{ - int a; - goto l1; - l2: - a = 1 + ({ - __label__ l1, l2, l3, l4; - goto l1; - l4: - printf("aa1\n"); - goto l3; - l2: - printf("aa3\n"); - goto l4; - l1: - printf("aa2\n"); - goto l2; - l3:; - 1; - }); - printf("a=%d\n", a); - return; - l4: - printf("bb1\n"); - goto l2; - l1: - printf("bb2\n"); - goto l4; -} - -/* inline assembler test */ -#ifdef __i386__ - -/* from linux kernel */ -static char * strncat1(char * dest,const char * src,size_t count) -{ -int d0, d1, d2, d3; -__asm__ __volatile__( - "repne\n\t" - "scasb\n\t" - "decl %1\n\t" - "movl %8,%3\n" - "1:\tdecl %3\n\t" - "js 2f\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n" - "2:\txorl %2,%2\n\t" - "stosb" - : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) - : "0" (src),"1" (dest),"2" (0),"3" (0xffffffff), "g" (count) - : "memory"); -return dest; -} - -static inline void * memcpy1(void * to, const void * from, size_t n) -{ -int d0, d1, d2; -__asm__ __volatile__( - "rep ; movsl\n\t" - "testb $2,%b4\n\t" - "je 1f\n\t" - "movsw\n" - "1:\ttestb $1,%b4\n\t" - "je 2f\n\t" - "movsb\n" - "2:" - : "=&c" (d0), "=&D" (d1), "=&S" (d2) - :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from) - : "memory"); -return (to); -} - -static __inline__ void sigaddset1(unsigned int *set, int _sig) -{ - __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); -} - -static __inline__ void sigdelset1(unsigned int *set, int _sig) -{ - asm("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); -} - -static __inline__ __const__ unsigned int swab32(unsigned int x) -{ - __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ - "rorl $16,%0\n\t" /* swap words */ - "xchgb %b0,%h0" /* swap higher bytes */ - :"=q" (x) - : "0" (x)); - return x; -} - -static __inline__ unsigned long long mul64(unsigned int a, unsigned int b) -{ - unsigned long long res; - __asm__("mull %2" : "=A" (res) : "a" (a), "r" (b)); - return res; -} - -static __inline__ unsigned long long inc64(unsigned long long a) -{ - unsigned long long res; - __asm__("addl $1, %%eax ; adcl $0, %%edx" : "=A" (res) : "A" (a)); - return res; -} - -unsigned int set; - -void asm_test(void) -{ - char buf[128]; - unsigned int val; - - printf("inline asm:\n"); - /* test the no operand case */ - asm volatile ("xorl %eax, %eax"); - - memcpy1(buf, "hello", 6); - strncat1(buf, " worldXXXXX", 3); - printf("%s\n", buf); - - /* 'A' constraint test */ - printf("mul64=0x%Lx\n", mul64(0x12345678, 0xabcd1234)); - printf("inc64=0x%Lx\n", inc64(0x12345678ffffffff)); - - set = 0xff; - sigdelset1(&set, 2); - sigaddset1(&set, 16); - /* NOTE: we test here if C labels are correctly restored after the - asm statement */ - goto label1; - label2: - __asm__("btsl %1,%0" : "=m"(set) : "Ir"(20) : "cc"); - printf("set=0x%x\n", set); - val = 0x01020304; - printf("swab32(0x%08x) = 0x%0x\n", val, swab32(val)); - return; - label1: - goto label2; -} - -#else - -void asm_test(void) -{ -} - -#endif - -#define COMPAT_TYPE(type1, type2) \ -{\ - printf("__builtin_types_compatible_p(%s, %s) = %d\n", #type1, #type2, \ - __builtin_types_compatible_p (type1, type2));\ -} - -int constant_p_var; - -void builtin_test(void) -{ -#if GCC_MAJOR >= 3 - COMPAT_TYPE(int, int); - COMPAT_TYPE(int, unsigned int); - COMPAT_TYPE(int, char); - COMPAT_TYPE(int, const int); - COMPAT_TYPE(int, volatile int); - COMPAT_TYPE(int *, int *); - COMPAT_TYPE(int *, void *); - COMPAT_TYPE(int *, const int *); - COMPAT_TYPE(char *, unsigned char *); -/* space is needed because tcc preprocessor introduces a space between each token */ - COMPAT_TYPE(char * *, void *); -#endif - printf("res = %d\n", __builtin_constant_p(1)); - printf("res = %d\n", __builtin_constant_p(1 + 2)); - printf("res = %d\n", __builtin_constant_p(&constant_p_var)); - printf("res = %d\n", __builtin_constant_p(constant_p_var)); -} - - -/* static_stub1 takes a pointer to a function, and returns a pointer to - * a function; that function must accept no parameters, and return nothing. */ -void ((*static_stub1(void ((*p)(void)))) (void)) -{ - static void (*pfn)(void); - void (*mytemp)(void); - mytemp = pfn; - pfn = p; - return mytemp; -} - -/* Another stub. The static "pfn" is in a different function, so it'd better - not be mapped to the same memory location. */ -void ((*static_stub2(void ((*p)(void)))) (void)) -{ - static void (*pfn)(void); - void (*mytemp)(void); - mytemp = pfn; - pfn = p; - return mytemp; -} - - -void static_test(void) -{ - void (*result)(void); - result = static_stub1(static_test); - printf("static_test Expect 1 -> %d\n", result == 0); - result = static_stub1(static_test); - printf("static_test Expect 1 -> %d\n", result == static_test); - result = static_stub2(static_test); - printf("static_test Expect 1 -> %d\n", result == 0); - result = static_stub2(static_test); - printf("static_test Expect 1 -> %d\n", result == static_test); -} - - -void const_func(const int a) -{ -} - -void const_warn_test(void) -{ - const_func(1); -} diff --git a/ir/be/test/test1.c b/ir/be/test/test1.c deleted file mode 100644 index 0107c0096..000000000 --- a/ir/be/test/test1.c +++ /dev/null @@ -1,7 +0,0 @@ -long long foo(void) { - return -1; -} - -int main(void) { - return 1 + foo(); -} diff --git a/ir/be/test/thread.c b/ir/be/test/thread.c deleted file mode 100644 index f48f60adc..000000000 --- a/ir/be/test/thread.c +++ /dev/null @@ -1,18 +0,0 @@ -#ifdef _WIN32 -#define __thread __declspec( thread ) -#endif - -__thread int tls_i[10]; -__thread int tls_j = 5; - -int test(int i) { - tls_j = i; - return tls_i[i]; -} - -int main() -{ - printf("tls_i: %d\n", test(3)); - printf("tls_j: %d\n", tls_j); - return 0; -} diff --git a/ir/be/test/trivial_add.c b/ir/be/test/trivial_add.c deleted file mode 100644 index 80ec2f68d..000000000 --- a/ir/be/test/trivial_add.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -/* - * Proj's of the arguments - * Simple DF node. - */ -int add(int a, int b) { - return a + b; -} - -int main(int argc, char *argv[]) -{ - printf("%d\n", add(1, 2)); - return 0; -} diff --git a/ir/be/test/trivial_div.c b/ir/be/test/trivial_div.c deleted file mode 100644 index 466175599..000000000 --- a/ir/be/test/trivial_div.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -/* - * Proj out of DF node - */ -int do_div(int a, int b) { - return a / b; -} - - -int main(int argc, char *argv[]) -{ - printf("%d\n", do_div(1, 2)); - return 0; -} diff --git a/ir/be/test/trivial_empty.c b/ir/be/test/trivial_empty.c deleted file mode 100644 index 647816e6f..000000000 --- a/ir/be/test/trivial_empty.c +++ /dev/null @@ -1,7 +0,0 @@ -/* - * first, the empty function - * shows start and end nodes - */ -int main(void) { - return 0; -} diff --git a/ir/be/test/trivial_extern_add.c b/ir/be/test/trivial_extern_add.c deleted file mode 100644 index 75753f60a..000000000 --- a/ir/be/test/trivial_extern_add.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * loads/stores from/to variables - * Shows the sel node - */ -#include - -int a; -int b; -int c; - -void add_a_and_b_to_c(void) -{ - c = a + b; -} - -int main(int argc, char *argv[]) -{ - a = 1; - b = 42; - add_a_and_b_to_c(); - printf("%d\n", c); - return 0; -} diff --git a/ir/be/test/trivial_max.c b/ir/be/test/trivial_max.c deleted file mode 100644 index 2e0acb6ee..000000000 --- a/ir/be/test/trivial_max.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -/* - * Control flow divertion in an if statement. - */ -int max(int a, int b) { - return a > b ? a : b; -} - -int main(int argc, char *argv[]) -{ - printf("%d\n", max(1, 2)); - return 0; -} diff --git a/ir/be/test/trivial_sum_upto.c b/ir/be/test/trivial_sum_upto.c deleted file mode 100644 index 6c57225da..000000000 --- a/ir/be/test/trivial_sum_upto.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -/* - * A simple loop - * Shows backendges. - */ -int sum_upto(int n) -{ - int i, res = 0; - - for(i = 0; i < n; ++i) - res += i; - - return res; -} - -int main(int argc, char *argv[]) -{ - printf("%d\n", sum_upto(42)); - return 0; -} diff --git a/ir/be/test/trivial_two_times.c b/ir/be/test/trivial_two_times.c deleted file mode 100644 index ed949cda0..000000000 --- a/ir/be/test/trivial_two_times.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -/* - * Proj's of the arguments - * Simple DF node. - */ -int add(int a, int b) { - return a + b; -} - -/* - * A function call - */ -int two_times(int a) { - return add(a, a); -} - -int main(int argc, char *argv[]) -{ - printf("%d\n", two_times(3)); - return 0; -} diff --git a/ir/be/test/truth.c b/ir/be/test/truth.c deleted file mode 100644 index 48c2e4e74..000000000 --- a/ir/be/test/truth.c +++ /dev/null @@ -1,12 +0,0 @@ -int a = 3, b = 4, c = 3; - -int truth(int a, int b, int c) -{ - return (a == c & (a < b)); -} - -int main() -{ - printf("truth(%d, %d, %d) = %d\n", a, b, c, truth(a, b, c)); - return 0; -} diff --git a/ir/be/test/types.c b/ir/be/test/types.c deleted file mode 100644 index d7c665ab9..000000000 --- a/ir/be/test/types.c +++ /dev/null @@ -1,15 +0,0 @@ -struct opcode { - struct { - unsigned imm16:16; - } foo; -}; - - -int main(void) { - int i; - struct opcode oc = { { 42 } }; - - i = oc.foo.imm16 & 0x80f4; - printf("Result: %d (should be 32)\n", i); - return 0; -} diff --git a/ir/be/test/types2.c b/ir/be/test/types2.c deleted file mode 100644 index 06972d9b0..000000000 --- a/ir/be/test/types2.c +++ /dev/null @@ -1,8 +0,0 @@ -int main(void) { - int i = 13957; - unsigned char c = printf(""); - - i |= (c ? 0xffffff00 : 0xd3); - printf("i: %d\n", i); - return 0; -} diff --git a/ir/be/test/unary.c b/ir/be/test/unary.c deleted file mode 100644 index 1351063cf..000000000 --- a/ir/be/test/unary.c +++ /dev/null @@ -1,8 +0,0 @@ -int a,b,c,d; - -int main(void) { - b = -a; - c = !a; - d = ~a; - return 0; -} diff --git a/ir/be/test/union_init.c b/ir/be/test/union_init.c deleted file mode 100644 index 995938d5d..000000000 --- a/ir/be/test/union_init.c +++ /dev/null @@ -1,49 +0,0 @@ -typedef union blub { - int i; - char a[4]; -} blub; - -blub a = { - .i = 23, - .a[2] = 23, 19 -}; - -blub b = { - .a[2] = 23, 19, - .i = 23 -}; - -#if 0 -blub c = { - .a[2] = 23, 19, 17, - .i = 23 -}; -#endif - -blub d = { - .a[2] = 23, - .i = 23, - .a[3] = 19 -}; - -blub e = { - .a[2] = 23, - .i = 23, - .a[2] = 19, 23 -}; - -blub f = { - .i = 23, - .a[2] = 23, - .a[1] = 19 -}; - -int main(void) -{ - printf("%d %d %d %d\n", a.a[0], a.a[1], a.a[2], a.a[3]); - printf("%d\n", b.i); - printf("%d %d %d %d\n", d.a[0], d.a[1], d.a[2], d.a[3]); - printf("%d %d %d %d\n", e.a[0], e.a[1], e.a[2], e.a[3]); - printf("%d %d %d %d\n", f.a[0], f.a[1], f.a[2], f.a[3]); - return 0; -} diff --git a/ir/be/test/unknown_combo.c b/ir/be/test/unknown_combo.c deleted file mode 100644 index 2c7768879..000000000 --- a/ir/be/test/unknown_combo.c +++ /dev/null @@ -1,21 +0,0 @@ -/*$ -fcombo $*/ - -int main() { - int x; - - if (x == 2) - printf("x == 2\n"); - if (x == 3) - printf("x == 3\n"); - - switch (x) { - case 1: - printf("Case 1\n"); - break; - case 2: - printf("Case 1\n"); - break; - } - - return 0; -} diff --git a/ir/be/test/unknown_combo2.c b/ir/be/test/unknown_combo2.c deleted file mode 100644 index 5033e21d9..000000000 --- a/ir/be/test/unknown_combo2.c +++ /dev/null @@ -1,26 +0,0 @@ -/*$ -fcombo $*/ - -/* - * This is a example for the 'Top reaches if first' - * problem. - * - * If the Cond is evaluated BEFORE the Phi(Unknown, 1) - * gets the Const 1, we decide for != and cannot revert - * this decision... - */ -int main(int argc) { - int x; - - if (argc) { - x = 1; - } else { - ++argc; - } - - if (x == 1) { - printf("x == 1\n"); - } else { - printf("x != 1\n"); - } - return 0; -} diff --git a/ir/be/test/use_uninit_ptr.c b/ir/be/test/use_uninit_ptr.c deleted file mode 100644 index 07c9796ce..000000000 --- a/ir/be/test/use_uninit_ptr.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -void foo(void) { - char *f1; - - printf("%d\n", *f1); - return; -} - -int main(void) { - return 0; -} diff --git a/ir/be/test/vadd_store.c b/ir/be/test/vadd_store.c deleted file mode 100644 index 9bdcae501..000000000 --- a/ir/be/test/vadd_store.c +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************ - * Program: vadd_store.c - * Function: Add 2 vectors (lying in memory) and store the result in - * a another vector in memory. - * Used as a test for the simd optimization. - * Author: Andreas Schoesser - * Date: 2007-02-13 - ************************************************************************/ - -#include -#include -#include - -#if 0 -void vadd_store(void) -{ - /*Also possible: Local pointers instead of function parameters: */ - //int *a = (int *) alloca(8), *b = (int *) alloca(8), *c = (int *) alloca(8); - int a[2], b[2], c[2]; - int i; - - printf("1. vload -> vadd -> vstore\n===================\n\n"); - - for(i = 0; i < 2; i++) - { - a[i] = rand() % 10; - b[i] = rand() % 10; - } - - -/* Also possible: Local arrays, but may be optimized so that no pattern is found - int a[2], b[2], c[2]; */ - - -/* Version 1: Directly adding. */ - - c[0] = a[0] + b[0]; - c[1] = a[1] + b[1]; - - - -/* Version 2: Adding of local variables - - int a0, a1, b0, b1, c0, c1; - - a0 = a[0]; - a1 = a[1]; - b0 = b[0]; - b1 = b[1]; - - c0 = a0 + b0; - c1 = a1 + b1; - - c[0] = c0; - c[1] = c1; */ - - - -/* Version 3: Mixed adding of locals and pointers - - int a0, b1, c0; - - a0 = a[0]; - b1 = b[1]; - - c0 = a0 + b[0]; - c[1] = a[1] + b1; - - c[0] = c0; */ - - for(i = 0; i < 2; i++) - printf("%d + %d = %d\n", a[i], b[i], c[i]); - printf("\n"); - -} -#endif - -#if 1 -void vadd_loop(void) -{ - /* Version 4: Manually unrolled loop */ - - int i, j; - int d[5][5], e[5][5], f[5][5]; - - //printf("2. vload -> vadd -> vstore, multi dimensional array, in loop\n==========================================\n\n"); - - for(j = 0; j < 4; j++) - for(i = 0; i < 2; i++) - { - e[j][i] = rand() % 10; - f[j][i] = rand() % 10; - } - - for(j = 0; j < 4; j++) - //for(i = 0; i < 2; i ++ ) - { - d[j][0] = e[j][0] + f[j][0]; - d[j][1] = e[j][1] + f[j][1]; - } - - for(j = 0; j < 4; j++) - { - for(i = 0; i < 2; i++) - printf("%d + %d = %d\n", e[j][i], f[j][i], d[j][i]); - printf("\n"); - } -} -#endif - -int main() -{ - srand(12345); - - //vadd_store(); - vadd_loop(); - - return 0; -} diff --git a/ir/be/test/valist.c b/ir/be/test/valist.c deleted file mode 100644 index 435d401f0..000000000 --- a/ir/be/test/valist.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#if defined(__FIRM_MAJOR__) && defined(__GNUC__) -#define va_start(v,l) __builtin_va_start(v,l) -#define va_end(v) __builtin_va_end(v) -#define va_arg(v,l) __builtin_va_arg(v,l) -#define va_copy(d,s) __builtin_va_copy(d,s) - -typedef __builtin_va_list __gnuc_va_list; -typedef __gnuc_va_list va_list; - -#else -#include -#endif - -char * foo(char *fmt, ...) { - va_list ap; - char *s; - - va_start(ap, fmt); - s = va_arg(ap, char *); - va_end(ap); - return s; -} - -int main() -{ - printf("<%s>\n", foo("bla", "blup")); - return 0; -} diff --git a/ir/be/test/vandrunen.c b/ir/be/test/vandrunen.c deleted file mode 100644 index 3012e6638..000000000 --- a/ir/be/test/vandrunen.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -int T6, T10, T13; - -/* - * The VanDrunen example for testimng GVN-PRE. - * Compile with -f no-const-fold to get the same result ... - */ -int vandrunen(int t1, int c1, int t11) -{ - int t12; - int t9; - int t8; - int t7; - int t5; - int t4; - int t3; - int t2; - - t2 = t1; - - for (;;) { - t3 = t2 + 1; - if (t3 > 50) - return 0; - - if (c1 != 0) { - t4 = t2 + t3; - t5 = t4; - T6 = t1 + t5; - t8 = t1; - } else { - t7 = t3 + 1; - t8 = t7; - } - t9 = t2 + t3; - T10 = t9 + t8; - t12 = t9 + t11; - T13 = t12 + t3; - t2 = t3; - } -} - -int main(int argc, char *argv[]) { - vandrunen(10, argc & 1, 1); - printf("%d %d %d\n", T6, T10, T13); - return 0; -} diff --git a/ir/be/test/vararray.c b/ir/be/test/vararray.c deleted file mode 100644 index 3c7fc6783..000000000 --- a/ir/be/test/vararray.c +++ /dev/null @@ -1,33 +0,0 @@ -#include - -void print(int *arr, int n) { - int i; - - for(i = 0; i < n; ++i) { - printf("%d\n", arr[i]); - } -} - -int test(int data[], int len) { - int arr[len]; - int i; - - for (i = 0; i < len; ++i) { - arr[i] = data[i]; - } - - print(arr, len); - - return 0; -} - -int _data[] = {0, 0, 0, 1, 11, 111, 2, 22, 222, 3, 33, 333, - 4, 44, 444, 5, 55, 555, 6, 66, 666, 7, 77, 777, - 8, 88, 888, 9, 99, 999}; -static const size_t len = sizeof(_data)/sizeof(_data[0]); - -int main() -{ - test(_data, len); - return 0; -} diff --git a/ir/be/test/vla.c b/ir/be/test/vla.c deleted file mode 100644 index 5c30c9798..000000000 --- a/ir/be/test/vla.c +++ /dev/null @@ -1,20 +0,0 @@ -/* stabs debug info has problems with VLAs */ - -#include - -void f(int x) -{ - int a[x]; - int i; - for (i = 0; i < x; ++i) { - a[i] = rand(); - } -} - - -int main(void) -{ - srand(23); - f(rand() & 31); - return 0; -} diff --git a/ir/be/test/volatile.c b/ir/be/test/volatile.c deleted file mode 100644 index 79da335db..000000000 --- a/ir/be/test/volatile.c +++ /dev/null @@ -1,16 +0,0 @@ - -volatile int i; -volatile float f; - -int main() -{ - /* access */ - (void) i; - (void) f; - - /* store */ - i = 5; - f = 2.4f; - - return 0; -} diff --git a/ir/be/test/while-printf.c b/ir/be/test/while-printf.c deleted file mode 100644 index 71cf68fad..000000000 --- a/ir/be/test/while-printf.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int main() -{ - int i = 0; - int j = 0; - do - { - j++; - i++; - printf("%d\n",i); - } - while(j < 10); - printf("Cyklusvariable1: %d\n",j); - - i = 0; - do - { - i++; - } - while(i < 10); - printf("Cyklusvariable2: %d\n",i); - - return 0; -}; diff --git a/ir/be/test/wrong_cmp.c b/ir/be/test/wrong_cmp.c deleted file mode 100644 index 5666a4ad4..000000000 --- a/ir/be/test/wrong_cmp.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#define MASK 0x00000020 - -int ctrl_space_write () -{ - unsigned int reg_offset = 160; - - if ((reg_offset & MASK) == MASK) - { - return 1; - } - - return (0); -} - -int main (void) -{ - int res = ctrl_space_write(); - printf("Result: %d (should be 1)\n", res); - return res == 1 ? 0 : 1; -}