[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c

Jim Laskey jlaskey at apple.com
Thu Aug 18 10:16:34 PDT 2005



Changes in directory llvm-test/SingleSource/UnitTests:

2005-07-17-INT-To-FP.c updated: 1.1 -> 1.2
---
Log message:

Adding edge case tests for int to fp casting.



---
Diffs of the changes:  (+23 -0)

 2005-07-17-INT-To-FP.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+)


Index: llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c
diff -u llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.1 llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.2
--- llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c:1.1	Sun Jul 17 23:29:50 2005
+++ llvm-test/SingleSource/UnitTests/2005-07-17-INT-To-FP.c	Thu Aug 18 12:16:22 2005
@@ -1,8 +1,24 @@
 // Test the various SINT-TO-FP and UINT-TO-FP conversions.
 #include <stdio.h>
 
+int tests[] = {
+  0x80000000,
+  -123456789,
+  -10,
+  -2,
+  -1,
+  0,
+  1,
+  2,
+  10,
+  123456789,
+  0x7FFFFFFF
+};
+
 int main() {
+
   unsigned i;
+  // byte boundary tests
   for (i = 0; i < 64; ++i) {
     printf("%d %f, %f, %f, %f\n", i,
            (double)(signed char)(i << 2),            // i8
@@ -16,4 +32,11 @@
            (double)(unsigned int)(i << 26),            // i32
            (double)(unsigned long long)((unsigned long long)i << 58ULL));  // i64
   }
+  // edge case tests
+  for (unsigned i = 0; i < (sizeof(tests) / sizeof(int)); i++) {
+    printf("%d %f %f %f %f\n", (double)(unsigned)tests[i],
+                               (double)(  signed)tests[i],
+                               (float) (unsigned)tests[i],
+                               (float) (  signed)tests[i]);
+  }
 }






More information about the llvm-commits mailing list