From e80e978d6aa211056beddf4582390e374d1935ab Mon Sep 17 00:00:00 2001 From: Nick Kledzik Date: Sat, 12 Sep 2009 01:23:48 +0000 Subject: add comparison functions for ARM git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@81597 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Unit/bswapdi2_test.c | 42 +++++++++++++++++++++++++++++++++++ test/Unit/bswapsi2_test.c | 42 +++++++++++++++++++++++++++++++++++ test/Unit/eqdf2vfp_test.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ test/Unit/eqsf2vfp_test.c | 49 ++++++++++++++++++++++++++++++++++++++++ test/Unit/gedf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/gesf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/gtdf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/gtsf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/ledf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/lesf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/ltdf2vfp_test.c | 49 ++++++++++++++++++++++++++++++++++++++++ test/Unit/ltsf2vfp_test.c | 51 ++++++++++++++++++++++++++++++++++++++++++ test/Unit/nedf2vfp_test.c | 49 ++++++++++++++++++++++++++++++++++++++++ test/Unit/negdf2vfp_test.c | 46 ++++++++++++++++++++++++++++++++++++++ test/Unit/negsf2vfp_test.c | 46 ++++++++++++++++++++++++++++++++++++++ test/Unit/nesf2vfp_test.c | 49 ++++++++++++++++++++++++++++++++++++++++ test/Unit/unorddf2vfp_test.c | 47 +++++++++++++++++++++++++++++++++++++++ test/Unit/unordsf2vfp_test.c | 47 +++++++++++++++++++++++++++++++++++++++ 18 files changed, 876 insertions(+) create mode 100644 test/Unit/bswapdi2_test.c create mode 100644 test/Unit/bswapsi2_test.c create mode 100644 test/Unit/eqdf2vfp_test.c create mode 100644 test/Unit/eqsf2vfp_test.c create mode 100644 test/Unit/gedf2vfp_test.c create mode 100644 test/Unit/gesf2vfp_test.c create mode 100644 test/Unit/gtdf2vfp_test.c create mode 100644 test/Unit/gtsf2vfp_test.c create mode 100644 test/Unit/ledf2vfp_test.c create mode 100644 test/Unit/lesf2vfp_test.c create mode 100644 test/Unit/ltdf2vfp_test.c create mode 100644 test/Unit/ltsf2vfp_test.c create mode 100644 test/Unit/nedf2vfp_test.c create mode 100644 test/Unit/negdf2vfp_test.c create mode 100644 test/Unit/negsf2vfp_test.c create mode 100644 test/Unit/nesf2vfp_test.c create mode 100644 test/Unit/unorddf2vfp_test.c create mode 100644 test/Unit/unordsf2vfp_test.c (limited to 'test') diff --git a/test/Unit/bswapdi2_test.c b/test/Unit/bswapdi2_test.c new file mode 100644 index 00000000..177032d0 --- /dev/null +++ b/test/Unit/bswapdi2_test.c @@ -0,0 +1,42 @@ +//===-- bswapdi2_test.c - Test __bswapdi2 ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __bswapdi2 for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern uint64_t __bswapdi2(uint64_t); + +#if __arm__ +int test__bswapdi2(uint64_t a, uint64_t expected) +{ + uint64_t actual = __bswapdi2(a); + if (actual != expected) + printf("error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__bswapdi2(0x123456789ABCDEF0LL, 0xF0DEBC9A78563412LL)) + return 1; + if (test__bswapdi2(0x0000000100000002LL, 0x0200000001000000LL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/bswapsi2_test.c b/test/Unit/bswapsi2_test.c new file mode 100644 index 00000000..8ca4874a --- /dev/null +++ b/test/Unit/bswapsi2_test.c @@ -0,0 +1,42 @@ +//===-- bswapsi2_test.c - Test __bswapsi2 ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __bswapsi2 for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern uint32_t __bswapsi2(uint32_t); + +#if __arm__ +int test__bswapsi2(uint32_t a, uint32_t expected) +{ + uint32_t actual = __bswapsi2(a); + if (actual != expected) + printf("error in test__bswapsi2(0x%0X) = 0x%0X, expected 0x%0X\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__bswapsi2(0x12345678, 0x78563412)) + return 1; + if (test__bswapsi2(0x00000001, 0x01000000)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/eqdf2vfp_test.c b/test/Unit/eqdf2vfp_test.c new file mode 100644 index 00000000..36b77ad7 --- /dev/null +++ b/test/Unit/eqdf2vfp_test.c @@ -0,0 +1,53 @@ +//===-- eqdf2vfp_test.c - Test __eqdf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __eqdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __eqdf2vfp(double a, double b); + +#if __arm__ +int test__eqdf2vfp(double a, double b) +{ + int actual = __eqdf2vfp(a, b); + int expected = (a == b) ? 1 : 0; + if (actual != expected) + printf("error in __eqdf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__eqdf2vfp(0.0, 0.0)) + return 1; + if (test__eqdf2vfp(1.0, 1.0)) + return 1; + if (test__eqdf2vfp(0.0, 1.0)) + return 1; + if (test__eqdf2vfp(-1.0, -1.0)) + return 1; + if (test__eqdf2vfp(-1.0, 0.0)) + return 1; + if (test__eqdf2vfp(HUGE_VAL, 1.0)) + return 1; + if (test__eqdf2vfp(1.0, HUGE_VAL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/eqsf2vfp_test.c b/test/Unit/eqsf2vfp_test.c new file mode 100644 index 00000000..ebcdbc43 --- /dev/null +++ b/test/Unit/eqsf2vfp_test.c @@ -0,0 +1,49 @@ +//===-- eqsf2vfp_test.c - Test __eqsf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __eqsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __eqsf2vfp(float a, float b); + +#if __arm__ +int test__eqsf2vfp(float a, float b) +{ + int actual = __eqsf2vfp(a, b); + int expected = (a == b) ? 1 : 0; + if (actual != expected) + printf("error in __eqsf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__eqsf2vfp(0.0, 0.0)) + return 1; + if (test__eqsf2vfp(1.0, 1.0)) + return 1; + if (test__eqsf2vfp(-1.0, -1.0)) + return 1; + if (test__eqsf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__eqsf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/gedf2vfp_test.c b/test/Unit/gedf2vfp_test.c new file mode 100644 index 00000000..93df4c77 --- /dev/null +++ b/test/Unit/gedf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- gedf2vfp_test.c - Test __gedf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __gedf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __gedf2vfp(double a, double b); + +#if __arm__ +int test__gedf2vfp(double a, double b) +{ + int actual = __gedf2vfp(a, b); + int expected = (a >= b) ? 1 : 0; + if (actual != expected) + printf("error in __gedf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__gedf2vfp(0.0, 0.0)) + return 1; + if (test__gedf2vfp(1.0, 0.0)) + return 1; + if (test__gedf2vfp(-1.0, -2.0)) + return 1; + if (test__gedf2vfp(-2.0, -1.0)) + return 1; + if (test__gedf2vfp(HUGE_VAL, 1.0)) + return 1; + if (test__gedf2vfp(1.0, HUGE_VAL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/gesf2vfp_test.c b/test/Unit/gesf2vfp_test.c new file mode 100644 index 00000000..af67c70e --- /dev/null +++ b/test/Unit/gesf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- gesf2vfp_test.c - Test __gesf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __gesf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __gesf2vfp(float a, float b); + +#if __arm__ +int test__gesf2vfp(float a, float b) +{ + int actual = __gesf2vfp(a, b); + int expected = (a >= b) ? 1 : 0; + if (actual != expected) + printf("error in __gesf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__gesf2vfp(0.0, 0.0)) + return 1; + if (test__gesf2vfp(1.1, 1.0)) + return 1; + if (test__gesf2vfp(-1.0, -2.0)) + return 1; + if (test__gesf2vfp(-2.0, -1.0)) + return 1; + if (test__gesf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__gesf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/gtdf2vfp_test.c b/test/Unit/gtdf2vfp_test.c new file mode 100644 index 00000000..d39ad820 --- /dev/null +++ b/test/Unit/gtdf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- gtdf2vfp_test.c - Test __gtdf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __gtdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __gtdf2vfp(double a, double b); + +#if __arm__ +int test__gtdf2vfp(double a, double b) +{ + int actual = __gtdf2vfp(a, b); + int expected = (a > b) ? 1 : 0; + if (actual != expected) + printf("error in __gtdf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__gtdf2vfp(0.0, 0.0)) + return 1; + if (test__gtdf2vfp(1.0, 0.0)) + return 1; + if (test__gtdf2vfp(-1.0, -2.0)) + return 1; + if (test__gtdf2vfp(-2.0, -1.0)) + return 1; + if (test__gtdf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__gtdf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/gtsf2vfp_test.c b/test/Unit/gtsf2vfp_test.c new file mode 100644 index 00000000..40c37f2b --- /dev/null +++ b/test/Unit/gtsf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- gtsf2vfp_test.c - Test __gtsf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __gtsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __gtsf2vfp(float a, float b); + +#if __arm__ +int test__gtsf2vfp(float a, float b) +{ + int actual = __gtsf2vfp(a, b); + int expected = (a > b) ? 1 : 0; + if (actual != expected) + printf("error in __gtsf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__gtsf2vfp(0.0, 0.0)) + return 1; + if (test__gtsf2vfp(1.0, 0.0)) + return 1; + if (test__gtsf2vfp(-1.0, -2.0)) + return 1; + if (test__gtsf2vfp(-2.0, -1.0)) + return 1; + if (test__gtsf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__gtsf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/ledf2vfp_test.c b/test/Unit/ledf2vfp_test.c new file mode 100644 index 00000000..87455c38 --- /dev/null +++ b/test/Unit/ledf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- ledf2vfp_test.c - Test __ledf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __ledf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __ledf2vfp(double a, double b); + +#if __arm__ +int test__ledf2vfp(double a, double b) +{ + int actual = __ledf2vfp(a, b); + int expected = (a <= b) ? 1 : 0; + if (actual != expected) + printf("error in __ledf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__ledf2vfp(0.0, 0.0)) + return 1; + if (test__ledf2vfp(1.0, 1.0)) + return 1; + if (test__ledf2vfp(-1.0, -2.0)) + return 1; + if (test__ledf2vfp(-2.0, -1.0)) + return 1; + if (test__ledf2vfp(HUGE_VAL, 1.0)) + return 1; + if (test__ledf2vfp(1.0, HUGE_VAL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/lesf2vfp_test.c b/test/Unit/lesf2vfp_test.c new file mode 100644 index 00000000..03cb02a5 --- /dev/null +++ b/test/Unit/lesf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- lesf2vfp_test.c - Test __lesf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __lesf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __lesf2vfp(float a, float b); + +#if __arm__ +int test__lesf2vfp(float a, float b) +{ + int actual = __lesf2vfp(a, b); + int expected = (a <= b) ? 1 : 0; + if (actual != expected) + printf("error in __lesf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__lesf2vfp(0.0, 0.0)) + return 1; + if (test__lesf2vfp(1.0, 1.0)) + return 1; + if (test__lesf2vfp(-1.0, -2.0)) + return 1; + if (test__lesf2vfp(-2.0, -1.0)) + return 1; + if (test__lesf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__lesf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/ltdf2vfp_test.c b/test/Unit/ltdf2vfp_test.c new file mode 100644 index 00000000..615785ec --- /dev/null +++ b/test/Unit/ltdf2vfp_test.c @@ -0,0 +1,49 @@ +//===-- ltdf2vfp_test.c - Test __ltdf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __ltdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __ltdf2vfp(double a, double b); + +#if __arm__ +int test__ltdf2vfp(double a, double b) +{ + int actual = __ltdf2vfp(a, b); + int expected = (a < b) ? 1 : 0; + if (actual != expected) + printf("error in __ltdf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__ltdf2vfp(0.0, 0.0)) + return 1; + if (test__ltdf2vfp(1.0, 1.0)) + return 1; + if (test__ltdf2vfp(-1.0, -1.0)) + return 1; + if (test__ltdf2vfp(HUGE_VAL, 1.0)) + return 1; + if (test__ltdf2vfp(1.0, HUGE_VAL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/ltsf2vfp_test.c b/test/Unit/ltsf2vfp_test.c new file mode 100644 index 00000000..73df39f1 --- /dev/null +++ b/test/Unit/ltsf2vfp_test.c @@ -0,0 +1,51 @@ +//===-- ltsf2vfp_test.c - Test __ltsf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __ltsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __ltsf2vfp(float a, float b); + +#if __arm__ +int test__ltsf2vfp(float a, float b) +{ + int actual = __ltsf2vfp(a, b); + int expected = (a < b) ? 1 : 0; + if (actual != expected) + printf("error in __ltsf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__ltsf2vfp(0.0, 0.0)) + return 1; + if (test__ltsf2vfp(-1.0, 1.0)) + return 1; + if (test__ltsf2vfp(-1.0, -2.0)) + return 1; + if (test__ltsf2vfp(-2.0, -1.0)) + return 1; + if (test__ltsf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__ltsf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/nedf2vfp_test.c b/test/Unit/nedf2vfp_test.c new file mode 100644 index 00000000..f2983fc0 --- /dev/null +++ b/test/Unit/nedf2vfp_test.c @@ -0,0 +1,49 @@ +//===-- nedf2vfp_test.c - Test __nedf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __nedf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __nedf2vfp(double a, double b); + +#if __arm__ +int test__nedf2vfp(double a, double b) +{ + int actual = __nedf2vfp(a, b); + int expected = (a != b) ? 1 : 0; + if (actual != expected) + printf("error in __nedf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__nedf2vfp(0.0, 0.0)) + return 1; + if (test__nedf2vfp(1.0, 1.0)) + return 1; + if (test__nedf2vfp(-1.0, -1.0)) + return 1; + if (test__nedf2vfp(HUGE_VAL, 1.0)) + return 1; + if (test__nedf2vfp(1.0, HUGE_VAL)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/negdf2vfp_test.c b/test/Unit/negdf2vfp_test.c new file mode 100644 index 00000000..d019bd3a --- /dev/null +++ b/test/Unit/negdf2vfp_test.c @@ -0,0 +1,46 @@ +//===-- negdf2vfp_test.c - Test __negdf2vfp -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __negdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern double __negdf2vfp(double a); + +#if __arm__ +int test__negdf2vfp(double a) +{ + double actual = __negdf2vfp(a); + double expected = -a; + if (actual != expected) + printf("error in test__negdf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__negdf2vfp(1.0)) + return 1; + if (test__negdf2vfp(HUGE_VALF)) + return 1; + if (test__negdf2vfp(0.0)) + return 1; + if (test__negdf2vfp(-1.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/negsf2vfp_test.c b/test/Unit/negsf2vfp_test.c new file mode 100644 index 00000000..0c75fdf2 --- /dev/null +++ b/test/Unit/negsf2vfp_test.c @@ -0,0 +1,46 @@ +//===-- negsf2vfp_test.c - Test __negsf2vfp -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __negsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + + +extern float __negsf2vfp(float a); + +#if __arm__ +int test__negsf2vfp(float a) +{ + float actual = __negsf2vfp(a); + float expected = -a; + if (actual != expected) + printf("error in test__negsf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__negsf2vfp(1.0)) + return 1; + if (test__negsf2vfp(HUGE_VALF)) + return 1; + if (test__negsf2vfp(0.0)) + return 1; + if (test__negsf2vfp(-1.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/nesf2vfp_test.c b/test/Unit/nesf2vfp_test.c new file mode 100644 index 00000000..dcbc4838 --- /dev/null +++ b/test/Unit/nesf2vfp_test.c @@ -0,0 +1,49 @@ +//===-- nesf2vfp_test.c - Test __nesf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __nesf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __nesf2vfp(float a, float b); + +#if __arm__ +int test__nesf2vfp(float a, float b) +{ + int actual = __nesf2vfp(a, b); + int expected = (a != b) ? 1 : 0; + if (actual != expected) + printf("error in __nesf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__nesf2vfp(0.0, 0.0)) + return 1; + if (test__nesf2vfp(1.0, 1.0)) + return 1; + if (test__nesf2vfp(-1.0, -1.0)) + return 1; + if (test__nesf2vfp(HUGE_VALF, 1.0)) + return 1; + if (test__nesf2vfp(1.0, HUGE_VALF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/unorddf2vfp_test.c b/test/Unit/unorddf2vfp_test.c new file mode 100644 index 00000000..a08c06c3 --- /dev/null +++ b/test/Unit/unorddf2vfp_test.c @@ -0,0 +1,47 @@ +//===-- unorddf2vfp_test.c - Test __unorddf2vfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __unorddf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __unorddf2vfp(double a, double b); + +#if __arm__ +int test__unorddf2vfp(double a, double b) +{ + int actual = __unorddf2vfp(a, b); + int expected = (isnan(a) || isnan(b)) ? 1 : 0; + if (actual != expected) + printf("error in __unorddf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__unorddf2vfp(0.0, NAN)) + return 1; + if (test__unorddf2vfp(NAN, 1.0)) + return 1; + if (test__unorddf2vfp(NAN, NAN)) + return 1; + if (test__unorddf2vfp(1.0, 1.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/unordsf2vfp_test.c b/test/Unit/unordsf2vfp_test.c new file mode 100644 index 00000000..cf513969 --- /dev/null +++ b/test/Unit/unordsf2vfp_test.c @@ -0,0 +1,47 @@ +//===-- unordsf2vfp_test.c - Test __unordsf2vfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __unordsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include +#include + + +extern int __unordsf2vfp(float a, float b); + +#if __arm__ +int test__unordsf2vfp(float a, float b) +{ + int actual = __unordsf2vfp(a, b); + int expected = (isnan(a) || isnan(b)) ? 1 : 0; + if (actual != expected) + printf("error in __unordsf2vfp(%f, %f) = %d, expected %d\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__unordsf2vfp(0.0, NAN)) + return 1; + if (test__unordsf2vfp(NAN, 1.0)) + return 1; + if (test__unordsf2vfp(NAN, NAN)) + return 1; + if (test__unordsf2vfp(1.0, 1.0)) + return 1; +#endif + return 0; +} -- cgit v1.2.3