summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2009-09-14 23:26:56 +0000
committerNick Kledzik <kledzik@apple.com>2009-09-14 23:26:56 +0000
commit0963c9e8ea7f97732b0fce419fa6f2e96d951969 (patch)
tree160eb55d25c2194d7b82cf1cb038c50e2c2373fa /test
parent7b268dc996e9683b634072759eb8537e21284827 (diff)
downloadcompiler-rt-0963c9e8ea7f97732b0fce419fa6f2e96d951969.tar.gz
compiler-rt-0963c9e8ea7f97732b0fce419fa6f2e96d951969.tar.bz2
compiler-rt-0963c9e8ea7f97732b0fce419fa6f2e96d951969.tar.xz
add conversion functions and test cases for ARM
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@81809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Unit/extebdsfdf2vfp_test.c46
-rw-r--r--test/Unit/fixdfsivfp_test.c48
-rw-r--r--test/Unit/fixsfsivfp_test.c50
-rw-r--r--test/Unit/fixunsdfsivfp_test.c48
-rw-r--r--test/Unit/fixunssfsivfp_test.c48
-rw-r--r--test/Unit/floatsidfvfp_test.c48
-rw-r--r--test/Unit/floatsisfvfp_test.c48
-rw-r--r--test/Unit/floatunssidfvfp_test.c48
-rw-r--r--test/Unit/floatunssisfvfp_test.c48
-rw-r--r--test/Unit/truncdfsf2vfp_test.c48
10 files changed, 480 insertions, 0 deletions
diff --git a/test/Unit/extebdsfdf2vfp_test.c b/test/Unit/extebdsfdf2vfp_test.c
new file mode 100644
index 00000000..f2cf682e
--- /dev/null
+++ b/test/Unit/extebdsfdf2vfp_test.c
@@ -0,0 +1,46 @@
+//===-- extendsfdf2vfp_test.c - Test __extendsfdf2vfp ---------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __extendsfdf2vfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __extendsfdf2vfp(float a);
+
+#if __arm__
+int test__extendsfdf2vfp(float a)
+{
+ double actual = __extendsfdf2vfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__extendsfdf2vfp(%f) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__extendsfdf2vfp(0.0))
+ return 1;
+ if (test__extendsfdf2vfp(1.0))
+ return 1;
+ if (test__extendsfdf2vfp(-1.0))
+ return 1;
+ if (test__extendsfdf2vfp(3.1415926535))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/fixdfsivfp_test.c b/test/Unit/fixdfsivfp_test.c
new file mode 100644
index 00000000..00d24fb1
--- /dev/null
+++ b/test/Unit/fixdfsivfp_test.c
@@ -0,0 +1,48 @@
+//===-- fixdfsivfp_test.c - Test __fixdfsivfp -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixdfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern int __fixdfsivfp(double a);
+
+#if __arm__
+int test__fixdfsivfp(double a)
+{
+ int actual = __fixdfsivfp(a);
+ int expected = a;
+ if (actual != expected)
+ printf("error in test__fixdfsivfp(%f) = %d, expected %d\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixdfsivfp(0.0))
+ return 1;
+ if (test__fixdfsivfp(1.0))
+ return 1;
+ if (test__fixdfsivfp(-1.0))
+ return 1;
+ if (test__fixdfsivfp(2147483647))
+ return 1;
+ if (test__fixdfsivfp(-2147483648.0))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/fixsfsivfp_test.c b/test/Unit/fixsfsivfp_test.c
new file mode 100644
index 00000000..19d70b1e
--- /dev/null
+++ b/test/Unit/fixsfsivfp_test.c
@@ -0,0 +1,50 @@
+//===-- fixsfsivfp_test.c - Test __fixsfsivfp -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixsfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern int __fixsfsivfp(float a);
+
+#if __arm__
+int test__fixsfsivfp(float a)
+{
+ int actual = __fixsfsivfp(a);
+ int expected = a;
+ if (actual != expected)
+ printf("error in test__fixsfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixsfsivfp(0.0))
+ return 1;
+ if (test__fixsfsivfp(1.0))
+ return 1;
+ if (test__fixsfsivfp(-1.0))
+ return 1;
+ if (test__fixsfsivfp(2147483647.0))
+ return 1;
+ if (test__fixsfsivfp(-2147483648.0))
+ return 1;
+ if (test__fixsfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/fixunsdfsivfp_test.c b/test/Unit/fixunsdfsivfp_test.c
new file mode 100644
index 00000000..7c968f29
--- /dev/null
+++ b/test/Unit/fixunsdfsivfp_test.c
@@ -0,0 +1,48 @@
+//===-- fixunsdfsivfp_test.c - Test __fixunsdfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixunsdfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern unsigned int __fixunsdfsivfp(double a);
+
+#if __arm__
+int test__fixunsdfsivfp(double a)
+{
+ unsigned int actual = __fixunsdfsivfp(a);
+ unsigned int expected = a;
+ if (actual != expected)
+ printf("error in test__fixunsdfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixunsdfsivfp(0.0))
+ return 1;
+ if (test__fixunsdfsivfp(1.0))
+ return 1;
+ if (test__fixunsdfsivfp(-1.0))
+ return 1;
+ if (test__fixunsdfsivfp(4294967295.0))
+ return 1;
+ if (test__fixunsdfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/fixunssfsivfp_test.c b/test/Unit/fixunssfsivfp_test.c
new file mode 100644
index 00000000..9653175f
--- /dev/null
+++ b/test/Unit/fixunssfsivfp_test.c
@@ -0,0 +1,48 @@
+//===-- fixunssfsivfp_test.c - Test __fixunssfsivfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __fixunssfsivfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern unsigned int __fixunssfsivfp(float a);
+
+#if __arm__
+int test__fixunssfsivfp(float a)
+{
+ unsigned int actual = __fixunssfsivfp(a);
+ unsigned int expected = a;
+ if (actual != expected)
+ printf("error in test__fixunssfsivfp(%f) = %u, expected %u\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__fixunssfsivfp(0.0))
+ return 1;
+ if (test__fixunssfsivfp(1.0))
+ return 1;
+ if (test__fixunssfsivfp(-1.0))
+ return 1;
+ if (test__fixunssfsivfp(4294967295.0))
+ return 1;
+ if (test__fixunssfsivfp(65536.0))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/floatsidfvfp_test.c b/test/Unit/floatsidfvfp_test.c
new file mode 100644
index 00000000..956fe862
--- /dev/null
+++ b/test/Unit/floatsidfvfp_test.c
@@ -0,0 +1,48 @@
+//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatsidfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __floatsidfvfp(int a);
+
+#if __arm__
+int test__floatsidfvfp(int a)
+{
+ double actual = __floatsidfvfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatsidfvfp(0))
+ return 1;
+ if (test__floatsidfvfp(1))
+ return 1;
+ if (test__floatsidfvfp(-1))
+ return 1;
+ if (test__floatsidfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatsidfvfp(0x80000000))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/floatsisfvfp_test.c b/test/Unit/floatsisfvfp_test.c
new file mode 100644
index 00000000..5642e9ba
--- /dev/null
+++ b/test/Unit/floatsisfvfp_test.c
@@ -0,0 +1,48 @@
+//===-- floatsisfvfp_test.c - Test __floatsisfvfp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatsisfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __floatsisfvfp(int a);
+
+#if __arm__
+int test__floatsisfvfp(int a)
+{
+ float actual = __floatsisfvfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__floatsisfvfp(%d) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatsisfvfp(0))
+ return 1;
+ if (test__floatsisfvfp(1))
+ return 1;
+ if (test__floatsisfvfp(-1))
+ return 1;
+ if (test__floatsisfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatsisfvfp(0x80000000))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/floatunssidfvfp_test.c b/test/Unit/floatunssidfvfp_test.c
new file mode 100644
index 00000000..be0bd078
--- /dev/null
+++ b/test/Unit/floatunssidfvfp_test.c
@@ -0,0 +1,48 @@
+//===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatunssidfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern double __floatunssidfvfp(unsigned int a);
+
+#if __arm__
+int test__floatunssidfvfp(unsigned int a)
+{
+ double actual = __floatunssidfvfp(a);
+ double expected = a;
+ if (actual != expected)
+ printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatunssidfvfp(0))
+ return 1;
+ if (test__floatunssidfvfp(1))
+ return 1;
+ if (test__floatunssidfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatunssidfvfp(0x80000000))
+ return 1;
+ if (test__floatunssidfvfp(0xFFFFFFFF))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/floatunssisfvfp_test.c b/test/Unit/floatunssisfvfp_test.c
new file mode 100644
index 00000000..13cee2f4
--- /dev/null
+++ b/test/Unit/floatunssisfvfp_test.c
@@ -0,0 +1,48 @@
+//===-- floatunssisfvfp_test.c - Test __floatunssisfvfp -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __floatunssisfvfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __floatunssisfvfp(unsigned int a);
+
+#if __arm__
+int test__floatunssisfvfp(unsigned int a)
+{
+ float actual = __floatunssisfvfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__floatunssisfvfp(%u) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__floatunssisfvfp(0))
+ return 1;
+ if (test__floatunssisfvfp(1))
+ return 1;
+ if (test__floatunssisfvfp(0x7FFFFFFF))
+ return 1;
+ if (test__floatunssisfvfp(0x80000000))
+ return 1;
+ if (test__floatunssisfvfp(0xFFFFFFFF))
+ return 1;
+#endif
+ return 0;
+}
diff --git a/test/Unit/truncdfsf2vfp_test.c b/test/Unit/truncdfsf2vfp_test.c
new file mode 100644
index 00000000..f02b8362
--- /dev/null
+++ b/test/Unit/truncdfsf2vfp_test.c
@@ -0,0 +1,48 @@
+//===-- truncdfsf2vfp_test.c - Test __truncdfsf2vfp -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file tests __truncdfsf2vfp for the compiler_rt library.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+extern float __truncdfsf2vfp(double a);
+
+#if __arm__
+int test__truncdfsf2vfp(double a)
+{
+ float actual = __truncdfsf2vfp(a);
+ float expected = a;
+ if (actual != expected)
+ printf("error in test__truncdfsf2vfp(%f) = %f, expected %f\n",
+ a, actual, expected);
+ return actual != expected;
+}
+#endif
+
+int main()
+{
+#if __arm__
+ if (test__truncdfsf2vfp(0.0))
+ return 1;
+ if (test__truncdfsf2vfp(1.0))
+ return 1;
+ if (test__truncdfsf2vfp(-1.0))
+ return 1;
+ if (test__truncdfsf2vfp(3.1415926535))
+ return 1;
+ if (test__truncdfsf2vfp(123.456))
+ return 1;
+#endif
+ return 0;
+}