diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-09-02 12:42:19 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-09-02 12:42:19 +0000 |
commit | 265fa07b34a813ba9d8249ddad82d71e6002c10d (patch) | |
tree | 45831b1793c7920b10969fc7cf6316c202d78e91 /test/regression | |
parent | 94470fb6a652cb993982269fcb7a0e8319b54488 (diff) | |
download | compcert-265fa07b34a813ba9d8249ddad82d71e6002c10d.tar.gz compcert-265fa07b34a813ba9d8249ddad82d71e6002c10d.zip |
Merge of the reuse-temps branch:
- Reload temporaries are marked as destroyed (set to Vundef) across
operations in the semantics of LTL, LTLin, Linear and Mach,
allowing Asmgen to reuse them.
- Added IA32 port.
- Cleaned up float conversions and axiomatization of floats.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1499 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression')
-rw-r--r-- | test/regression/Makefile | 5 | ||||
-rw-r--r-- | test/regression/Results/casts3 | 1 | ||||
-rw-r--r-- | test/regression/Results/expr1 | 2 | ||||
-rw-r--r-- | test/regression/casts3.c | 60 | ||||
-rw-r--r-- | test/regression/expr1.c | 2 |
5 files changed, 66 insertions, 4 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile index 55b07f56..7d456df5 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -1,12 +1,13 @@ include ../../Makefile.config CCOMP=../../ccomp -CCOMPFLAGS=-stdlib ../../runtime -dparse -dcmedium -dclight -dasm \ +CCOMPFLAGS=-stdlib ../../runtime -dparse -dc -dclight -dasm \ -fstruct-passing -fstruct-assign -fbitfields LIBS=$(LIBMATH) # Can run and have reference output in Results + TESTS=bitfields1 bitfields2 bitfields3 bitfields4 \ bitfields5 bitfields6 \ expr1 initializers volatile2 \ @@ -32,7 +33,7 @@ all: $(TESTS:%=%.compcert) $(EXTRAS:%=%.s) clean: rm -f *.compcert - rm -f *.parsed.c *.light.c *.s *.o *~ + rm -f *.parsed.c *.compcert.c *.light.c *.s *.o *~ test: @for i in $(TESTS); do \ diff --git a/test/regression/Results/casts3 b/test/regression/Results/casts3 new file mode 100644 index 00000000..78ee28a4 --- /dev/null +++ b/test/regression/Results/casts3 @@ -0,0 +1 @@ +........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ diff --git a/test/regression/Results/expr1 b/test/regression/Results/expr1 index dc492037..f5a6864d 100644 --- a/test/regression/Results/expr1 +++ b/test/regression/Results/expr1 @@ -1 +1 @@ -Result: 0x0 +Result: 0 diff --git a/test/regression/casts3.c b/test/regression/casts3.c new file mode 100644 index 00000000..f6e35c24 --- /dev/null +++ b/test/regression/casts3.c @@ -0,0 +1,60 @@ +/* Testing int <-> float conversions */ + +#include <stdio.h> + +unsigned int urand(void) +{ + static unsigned int seed = 0; + seed = seed * 25173 + 8453; + return seed; +} + +signed int srand(void) +{ + return (signed int) urand(); +} + +double fuzzing[] = { 0.0, 0.01, 0.25, 0.4, 0.5, 0.6, 0.75, 0.99 }; + +double fuzz(void) +{ + static unsigned int n = 0; + n = n + 1; + if (n >= sizeof(fuzzing) / sizeof(double)) n = 0; + return fuzzing[n]; +} + +void test_signed_conv(void) +{ + int n = srand(); + double f = fuzz(); + double d = (double) n; + double e = n < 0 ? d - f : d + f; + int m = (int) e; + if (m != n) + printf("\nError: signed: %d, %g, %g, %d\n", n, f, e, m); +} + +void test_unsigned_conv(void) +{ + unsigned int n = srand(); + double f = fuzz(); + double d = (double) n; + double e = f + d; + unsigned int m = (unsigned int) e; + if (m != n) + printf("\nError: unsigned: %u, %g, %g, %u\n", n, f, e, m); +} + +int main() +{ + int i; + for (i = 0; i < 1000000; i++) { + if ((i % 1000) == 0) { printf("."); fflush(stdout); } + test_signed_conv(); + test_unsigned_conv(); + } + printf("\n"); + return 0; +} + diff --git a/test/regression/expr1.c b/test/regression/expr1.c index 0cc7b540..132ce44c 100644 --- a/test/regression/expr1.c +++ b/test/regression/expr1.c @@ -12,6 +12,6 @@ int main(int argc, char ** argv) struct list l; l.tl = &l; f(&(l.tl)); - printf("Result: %p\n", l.tl); + printf("Result: %d\n", (int) l.tl); return 0; } |