about summary refs log tree commit diff homepage
path: root/test/Feature
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-27 00:55:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-27 00:55:57 +0000
commit7ea8afa20439c579c4a1ccb251a78770ef873787 (patch)
tree59d4455f6e3f078aa093d3b95c394050b96d43dd /test/Feature
parent648aa4261c5d2ac2c69dd08bf7a727bf6929c185 (diff)
downloadklee-7ea8afa20439c579c4a1ccb251a78770ef873787.tar.gz
Start move to using APFloat (support long double).
 - Incomplete, still have to move some conversion operations.

 - Also, there isn't support yet for copying long double values to native
   memory.

 - Still, should be a monotonic improvement and we are no longer faking long
   double support.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@74363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Feature')
-rw-r--r--test/Feature/LongDoubleSupport.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/test/Feature/LongDoubleSupport.c b/test/Feature/LongDoubleSupport.c
index b4631832..185a5485 100644
--- a/test/Feature/LongDoubleSupport.c
+++ b/test/Feature/LongDoubleSupport.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc > %t2.out
+// RUN: %klee --optimize=0 --exit-on-error %t1.bc > %t2.out
 
 #include <stdio.h>
 #include <float.h>
+#include <assert.h>
 
 // FIXME: This doesn't really work at all, it just doesn't
 // crash. Until we have wide constant support, that is all we care
@@ -10,11 +11,29 @@
 // constants, we don't actually end up seeing much code which uses long
 // double.
 int main() {
-  long double a = LDBL_MAX;
-  long double b = -1;
-  long double c = a + b;
-  printf("a = %Lg\n", a);
-  printf("b = %Lg\n", b);
-  printf("c = %Lg\n", c);
+  unsigned N0 = 0, N1 = 0, N2 = 0;
+
+  float V0 = .1;
+  while (V0 != 0) {
+    V0 *= V0;
+    N0++;
+  }
+  double V1 = .1;
+  while (V1 != 0) {
+    V1 *= V1;
+    N1++;
+  }
+  long double V2 = .1;
+  while (V2 != 0) {
+    V2 *= V2;
+    N2++;
+  }
+
+  printf("counts: %d, %d, %d\n", N0, N1, N2);
+
+  assert(N0 == 6);
+  assert(N1 == 9);
+  assert(N2 == 13);
+
   return 0;
 }