diff options
Diffstat (limited to 'compiler-rt/test')
-rw-r--r-- | compiler-rt/test/Unit/bswapdi2_test.c | 42 | ||||
-rw-r--r-- | compiler-rt/test/Unit/bswapsi2_test.c | 42 | ||||
-rw-r--r-- | compiler-rt/test/Unit/eqdf2vfp_test.c | 53 | ||||
-rw-r--r-- | compiler-rt/test/Unit/eqsf2vfp_test.c | 49 | ||||
-rw-r--r-- | compiler-rt/test/Unit/gedf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/gesf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/gtdf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/gtsf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/ledf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/lesf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/ltdf2vfp_test.c | 49 | ||||
-rw-r--r-- | compiler-rt/test/Unit/ltsf2vfp_test.c | 51 | ||||
-rw-r--r-- | compiler-rt/test/Unit/nedf2vfp_test.c | 49 | ||||
-rw-r--r-- | compiler-rt/test/Unit/negdf2vfp_test.c | 46 | ||||
-rw-r--r-- | compiler-rt/test/Unit/negsf2vfp_test.c | 46 | ||||
-rw-r--r-- | compiler-rt/test/Unit/nesf2vfp_test.c | 49 | ||||
-rw-r--r-- | compiler-rt/test/Unit/unorddf2vfp_test.c | 47 | ||||
-rw-r--r-- | compiler-rt/test/Unit/unordsf2vfp_test.c | 47 |
18 files changed, 876 insertions, 0 deletions
diff --git a/compiler-rt/test/Unit/bswapdi2_test.c b/compiler-rt/test/Unit/bswapdi2_test.c new file mode 100644 index 00000000000..177032d07d4 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/bswapsi2_test.c b/compiler-rt/test/Unit/bswapsi2_test.c new file mode 100644 index 00000000000..8ca4874a13c --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/eqdf2vfp_test.c b/compiler-rt/test/Unit/eqdf2vfp_test.c new file mode 100644 index 00000000000..36b77ad783e --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/eqsf2vfp_test.c b/compiler-rt/test/Unit/eqsf2vfp_test.c new file mode 100644 index 00000000000..ebcdbc4309d --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/gedf2vfp_test.c b/compiler-rt/test/Unit/gedf2vfp_test.c new file mode 100644 index 00000000000..93df4c770c0 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/gesf2vfp_test.c b/compiler-rt/test/Unit/gesf2vfp_test.c new file mode 100644 index 00000000000..af67c70e735 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/gtdf2vfp_test.c b/compiler-rt/test/Unit/gtdf2vfp_test.c new file mode 100644 index 00000000000..d39ad820661 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/gtsf2vfp_test.c b/compiler-rt/test/Unit/gtsf2vfp_test.c new file mode 100644 index 00000000000..40c37f2bfa7 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/ledf2vfp_test.c b/compiler-rt/test/Unit/ledf2vfp_test.c new file mode 100644 index 00000000000..87455c38f3a --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/lesf2vfp_test.c b/compiler-rt/test/Unit/lesf2vfp_test.c new file mode 100644 index 00000000000..03cb02a5969 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/ltdf2vfp_test.c b/compiler-rt/test/Unit/ltdf2vfp_test.c new file mode 100644 index 00000000000..615785ec1a8 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/ltsf2vfp_test.c b/compiler-rt/test/Unit/ltsf2vfp_test.c new file mode 100644 index 00000000000..73df39f12ff --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/nedf2vfp_test.c b/compiler-rt/test/Unit/nedf2vfp_test.c new file mode 100644 index 00000000000..f2983fc0e9c --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/negdf2vfp_test.c b/compiler-rt/test/Unit/negdf2vfp_test.c new file mode 100644 index 00000000000..d019bd3aadb --- /dev/null +++ b/compiler-rt/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 <stdio.h> +#include <stdlib.h> +#include <math.h> + + +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/compiler-rt/test/Unit/negsf2vfp_test.c b/compiler-rt/test/Unit/negsf2vfp_test.c new file mode 100644 index 00000000000..0c75fdf29fc --- /dev/null +++ b/compiler-rt/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 <stdio.h> +#include <stdlib.h> +#include <math.h> + + +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/compiler-rt/test/Unit/nesf2vfp_test.c b/compiler-rt/test/Unit/nesf2vfp_test.c new file mode 100644 index 00000000000..dcbc483869d --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/unorddf2vfp_test.c b/compiler-rt/test/Unit/unorddf2vfp_test.c new file mode 100644 index 00000000000..a08c06c39bc --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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/compiler-rt/test/Unit/unordsf2vfp_test.c b/compiler-rt/test/Unit/unordsf2vfp_test.c new file mode 100644 index 00000000000..cf513969c20 --- /dev/null +++ b/compiler-rt/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 <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <math.h> + + +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; +} |