From: Andreas Schösser Date: Tue, 24 Jul 2007 14:51:25 +0000 (+0000) Subject: Added Test Program which breaks backend X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=e1d902b818b3366587e1057b90256e2e82107c0a;p=libfirm Added Test Program which breaks backend [r15309] --- diff --git a/ir/be/test/fehler51.c b/ir/be/test/fehler51.c new file mode 100644 index 000000000..e5bbcd615 --- /dev/null +++ b/ir/be/test/fehler51.c @@ -0,0 +1,63 @@ +/************************************************************************ +* 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[]); + +main() +{ + int a[5][5]; + + a[1][1] = 20; + + 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); +} + +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; + 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("%d %d %d\n", a[i], b[i], c[i], d[i]); + printf("\n"); + return(sp1 + sp2); +}