Search
lxdream.org :: lxdream :: r1131:4727c2006e0f
lxdream 0.9.1
released Jun 29
Download Now
changeset1131:4727c2006e0f
parent1130:5f56fc931112
child1132:1e074a98317c
authornkeynes
dateWed Oct 06 08:47:13 2010 +1000 (9 years ago)
Add missing files for the randmath test, and update .hgignore
.hgignore
test/randmath.c
test/random.dat
1.1 --- a/.hgignore Fri Sep 17 20:08:50 2010 +1000
1.2 +++ b/.hgignore Wed Oct 06 08:47:13 2010 +1000
1.3 @@ -6,6 +6,7 @@
1.4 .*\~
1.5 .*\.gmo
1.6 .*\.mo
1.7 +autom4te.cache
1.8 Makefile
1.9 config.h
1.10 config.status
1.11 @@ -18,7 +19,9 @@
1.12 src/drivers/mac_keymap.h
1.13 src/gendec
1.14 src/genglsl
1.15 -src/pvr2/gl_slsrc.c
1.16 +src/genmach
1.17 +src/pvr2/shaders.h
1.18 +src/pvr2/shaders.def
1.19 src/sh4/sh4dasm.c
1.20 src/sh4/sh4stat.c
1.21 src/sh4/sh4core.c
1.22 @@ -49,3 +52,6 @@
1.23 test/testta.bin
1.24 test/testaica
1.25 test/testaica.bin
1.26 +test/randmath
1.27 +test/randmath.bin
1.28 +test/randmath.native
1.29 \ No newline at end of file
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/randmath.c Wed Oct 06 08:47:13 2010 +1000
2.3 @@ -0,0 +1,60 @@
2.4 +#include <stdlib.h>
2.5 +#include <stdio.h>
2.6 +
2.7 +typedef unsigned char uint8_t;
2.8 +typedef signed char int8_t;
2.9 +typedef unsigned short uint16_t;
2.10 +typedef signed short int16_t;
2.11 +typedef unsigned int uint32_t;
2.12 +typedef signed int int32_t;
2.13 +typedef unsigned long long uint64_t;
2.14 +typedef signed long long int64_t;
2.15 +
2.16 +#define TEST_REPS 64
2.17 +
2.18 +void printuint8_t(uint8_t a) { printf( "%08X ", (unsigned int)a ); }
2.19 +void printint8_t(int8_t a) { printf( "%08X ", (unsigned int)(uint8_t)a ); }
2.20 +void printuint16_t(uint16_t a) { printf( "%08X ", (unsigned int)a ); }
2.21 +void printint16_t(int16_t a) { printf( "%08X ", (unsigned int)(uint16_t)a ); }
2.22 +void printuint32_t(uint32_t a) { printf( "%08X ", (unsigned int)a ); }
2.23 +void printint32_t(int32_t a) { printf( "%08X ", (unsigned int)a ); }
2.24 +void printuint64_t(uint64_t a) { printf( "%08X%08X ", (unsigned int)(a>>32),(unsigned int)a ); }
2.25 +void printint64_t(int64_t a) { printf( "%08X%08X ", (unsigned int)(a>>32),(unsigned int)a ); }
2.26 +
2.27 +#define TEST_TYPE(T) \
2.28 +void test##T() { \
2.29 + T a, b, c, d, e, f; \
2.30 + read(0,&a,sizeof(a)); read(0,&b,sizeof(b)); read(0,&c,sizeof(c)); read(0,&d,sizeof(d)); \
2.31 + e = a * b - c * d;\
2.32 + if( b != 0 && c != 0 ) { f = a / b + 1/c; }\
2.33 + T g = e - f / 2 + (uint32_t)b;\
2.34 + T h = b * c / d; T i = a / -d; \
2.35 + printf( "%d| ", sizeof(a) ); \
2.36 + print##T(a); print##T(b); print##T(c); print##T(d); \
2.37 + printf( ": " ); print##T(e); print##T(f); print##T(g); \
2.38 + print##T(h); print##T(i); \
2.39 + printf( "\n" ); \
2.40 +}
2.41 +
2.42 +TEST_TYPE(uint8_t);
2.43 +TEST_TYPE(int8_t);
2.44 +TEST_TYPE(uint16_t);
2.45 +TEST_TYPE(int16_t);
2.46 +TEST_TYPE(uint32_t);
2.47 +TEST_TYPE(int32_t);
2.48 +TEST_TYPE(uint64_t);
2.49 +TEST_TYPE(int64_t);
2.50 +
2.51 +int main(int argc, char *argv[]) {
2.52 + unsigned i;
2.53 +
2.54 + for(i=0;i<TEST_REPS;i++ ) { testuint64_t(); }
2.55 + for(i=0;i<TEST_REPS;i++ ) { testint64_t(); }
2.56 + for(i=0;i<TEST_REPS;i++ ) { testuint32_t(); }
2.57 + for(i=0;i<TEST_REPS;i++ ) { testint32_t(); }
2.58 + for(i=0;i<TEST_REPS;i++ ) { testuint16_t(); }
2.59 + for(i=0;i<TEST_REPS;i++ ) { testint16_t(); }
2.60 + for(i=0;i<TEST_REPS;i++ ) { testuint8_t(); }
2.61 + for(i=0;i<TEST_REPS;i++ ) { testint8_t(); }
2.62 + return 0;
2.63 +}
3.1 Binary file test/random.dat has changed
.