diff options
author | Nick Kledzik <kledzik@apple.com> | 2009-09-12 01:23:48 +0000 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2009-09-12 01:23:48 +0000 |
commit | 9130011d5ff9df9cbcf2067de5dac672921c5bad (patch) | |
tree | c472942247b6e7745538ab09f695e2db97b3ad02 | |
parent | 42c1287b684f7415f5b7ce173602e78d8b65f614 (diff) | |
download | bcm5719-llvm-9130011d5ff9df9cbcf2067de5dac672921c5bad.tar.gz bcm5719-llvm-9130011d5ff9df9cbcf2067de5dac672921c5bad.zip |
add comparison functions for ARM
llvm-svn: 81597
36 files changed, 1328 insertions, 0 deletions
diff --git a/compiler-rt/lib/arm/bswapdi2.S b/compiler-rt/lib/arm/bswapdi2.S new file mode 100644 index 00000000000..7e1aeb177ec --- /dev/null +++ b/compiler-rt/lib/arm/bswapdi2.S @@ -0,0 +1,22 @@ +//===------- bswapdi2 - Implement bswapdi2 ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern uint64_t __bswapdi2(uint64_t); +// +// Reverse all the bytes in a 64-bit integer. +// + .globl ___bswapdi2 +___bswapdi2: + rev r2, r1 // reverse bytes in high 32-bits into temp2 + rev r3, r0 // reverse bytes in low 32-bit into temp3 + mov r0, r2 // set low 32-bits of result to temp2 + mov r1, r3 // set high 32-bits of result to temp3 + bx lr diff --git a/compiler-rt/lib/arm/bswapsi2.S b/compiler-rt/lib/arm/bswapsi2.S new file mode 100644 index 00000000000..92851b19d42 --- /dev/null +++ b/compiler-rt/lib/arm/bswapsi2.S @@ -0,0 +1,19 @@ +//===------- bswapsi2 - Implement bswapsi2 ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern uint32_t __bswapsi2(uint32_t); +// +// Reverse all the bits in a 32-bit integer. +// + .globl ___bswapsi2 +___bswapsi2: + rev r0, r0 // reverse bytes in parameter and put into result register + bx lr diff --git a/compiler-rt/lib/arm/eqdf2vfp.S b/compiler-rt/lib/arm/eqdf2vfp.S new file mode 100644 index 00000000000..8111a0d541d --- /dev/null +++ b/compiler-rt/lib/arm/eqdf2vfp.S @@ -0,0 +1,26 @@ +//===-- eqdf2vfp.S - Implement eqdf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __eqdf2vfp(double a, double b); +// +// Returns one iff a == b and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___eqdf2vfp +___eqdf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + moveq r0, #1 // set result register to 1 if equal + movne r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/eqsf2vfp.S b/compiler-rt/lib/arm/eqsf2vfp.S new file mode 100644 index 00000000000..7d995b5a153 --- /dev/null +++ b/compiler-rt/lib/arm/eqsf2vfp.S @@ -0,0 +1,27 @@ +//===-- eqsf2vfp.S - Implement eqsf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __eqsf2vfp(float a, float b); +// +// Returns one iff a == b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___eqsf2vfp +___eqsf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + moveq r0, #1 // set result register to 1 if equal + movne r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/gedf2vfp.S b/compiler-rt/lib/arm/gedf2vfp.S new file mode 100644 index 00000000000..77d07bd8934 --- /dev/null +++ b/compiler-rt/lib/arm/gedf2vfp.S @@ -0,0 +1,26 @@ +//===-- gedf2vfp.S - Implement gedf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __gedf2vfp(double a, double b); +// +// Returns one iff a >= b and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___gedf2vfp +___gedf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movge r0, #1 // set result register to 1 if greater than or equal + movlt r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/gesf2vfp.S b/compiler-rt/lib/arm/gesf2vfp.S new file mode 100644 index 00000000000..205c3650ede --- /dev/null +++ b/compiler-rt/lib/arm/gesf2vfp.S @@ -0,0 +1,27 @@ +//===-- gesf2vfp.S - Implement gesf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __gesf2vfp(float a, float b); +// +// Returns one iff a >= b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___gesf2vfp +___gesf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movge r0, #1 // set result register to 1 if greater than or equal + movlt r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/gtdf2vfp.S b/compiler-rt/lib/arm/gtdf2vfp.S new file mode 100644 index 00000000000..8d6ebcf42e1 --- /dev/null +++ b/compiler-rt/lib/arm/gtdf2vfp.S @@ -0,0 +1,26 @@ +//===-- gtdf2vfp.S - Implement gtdf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __gtdf2vfp(double a, double b); +// +// Returns one iff a > b and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___gtdf2vfp +___gtdf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movgt r0, #1 // set result register to 1 if equal + movle r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/gtsf2vfp.S b/compiler-rt/lib/arm/gtsf2vfp.S new file mode 100644 index 00000000000..745a7c6dcfe --- /dev/null +++ b/compiler-rt/lib/arm/gtsf2vfp.S @@ -0,0 +1,27 @@ +//===-- gtsf2vfp.S - Implement gtsf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __gtsf2vfp(float a, float b); +// +// Returns one iff a > b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___gtsf2vfp +___gtsf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movgt r0, #1 // set result register to 1 if equal + movle r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/ledf2vfp.S b/compiler-rt/lib/arm/ledf2vfp.S new file mode 100644 index 00000000000..4dc9f47fb5b --- /dev/null +++ b/compiler-rt/lib/arm/ledf2vfp.S @@ -0,0 +1,26 @@ +//===-- ledf2vfp.S - Implement ledf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __ledf2vfp(double a, double b); +// +// Returns one iff a <= b and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___ledf2vfp +___ledf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movls r0, #1 // set result register to 1 if equal + movhi r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/lesf2vfp.S b/compiler-rt/lib/arm/lesf2vfp.S new file mode 100644 index 00000000000..b0a17af8f28 --- /dev/null +++ b/compiler-rt/lib/arm/lesf2vfp.S @@ -0,0 +1,27 @@ +//===-- lesf2vfp.S - Implement lesf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __lesf2vfp(float a, float b); +// +// Returns one iff a <= b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___lesf2vfp +___lesf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movls r0, #1 // set result register to 1 if equal + movhi r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/ltdf2vfp.S b/compiler-rt/lib/arm/ltdf2vfp.S new file mode 100644 index 00000000000..315bb6f7c94 --- /dev/null +++ b/compiler-rt/lib/arm/ltdf2vfp.S @@ -0,0 +1,26 @@ +//===-- ltdf2vfp.S - Implement ltdf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __ltdf2vfp(double a, double b); +// +// Returns one iff a < b and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___ltdf2vfp +___ltdf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movmi r0, #1 // set result register to 1 if equal + movpl r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/ltsf2vfp.S b/compiler-rt/lib/arm/ltsf2vfp.S new file mode 100644 index 00000000000..18a1cc50cc6 --- /dev/null +++ b/compiler-rt/lib/arm/ltsf2vfp.S @@ -0,0 +1,27 @@ +//===-- ltsf2vfp.S - Implement ltsf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __ltsf2vfp(float a, float b); +// +// Returns one iff a < b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___ltsf2vfp +___ltsf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movmi r0, #1 // set result register to 1 if equal + movpl r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/nedf2vfp.S b/compiler-rt/lib/arm/nedf2vfp.S new file mode 100644 index 00000000000..8cf4dc2f19f --- /dev/null +++ b/compiler-rt/lib/arm/nedf2vfp.S @@ -0,0 +1,26 @@ +//===-- nedf2vfp.S - Implement nedf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __nedf2vfp(double a, double b); +// +// Returns zero if a and b are unequal and neither is NaN. +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___nedf2vfp +___nedf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movne r0, #1 // set result register to 0 if unequal + moveq r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/negdf2vfp.S b/compiler-rt/lib/arm/negdf2vfp.S new file mode 100644 index 00000000000..b047ccc726c --- /dev/null +++ b/compiler-rt/lib/arm/negdf2vfp.S @@ -0,0 +1,20 @@ +//===-- negdf2vfp.S - Implement negdf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __negdf2vfp(double a, double b); +// +// Returns the negation a double precision floating point numbers using the +// Darwin calling convention where double arguments are passsed in GPR pairs. +// + .globl ___negdf2vfp +___negdf2vfp: + eor r1, r1, #-2147483648 // flip sign bit on double in r0/r1 pair + bx lr diff --git a/compiler-rt/lib/arm/negsf2vfp.S b/compiler-rt/lib/arm/negsf2vfp.S new file mode 100644 index 00000000000..1b0f3d6bea3 --- /dev/null +++ b/compiler-rt/lib/arm/negsf2vfp.S @@ -0,0 +1,20 @@ +//===-- negsf2vfp.S - Implement negsf2vfp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __negsf2vfp(float a); +// +// Returns the negation of a single precision floating point numbers using the +// Darwin calling convention where single arguments are passsed like 32-bit ints +// + .globl ___negsf2vfp +___negsf2vfp: + eor r0, r0, #-2147483648 // flip sign bit on float in r0 + bx lr diff --git a/compiler-rt/lib/arm/nesf2vfp.S b/compiler-rt/lib/arm/nesf2vfp.S new file mode 100644 index 00000000000..da0eef65614 --- /dev/null +++ b/compiler-rt/lib/arm/nesf2vfp.S @@ -0,0 +1,27 @@ +//===-- nesf2vfp.S - Implement nesf2vfp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __nesf2vfp(float a, float b); +// +// Returns one iff a != b and neither is NaN. +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___nesf2vfp +___nesf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movne r0, #1 // set result register to 1 if unequal + moveq r0, #0 + bx lr + diff --git a/compiler-rt/lib/arm/unorddf2vfp.S b/compiler-rt/lib/arm/unorddf2vfp.S new file mode 100644 index 00000000000..e458eb8c156 --- /dev/null +++ b/compiler-rt/lib/arm/unorddf2vfp.S @@ -0,0 +1,26 @@ +//===-- unorddf2vfp.S - Implement unorddf2vfp ------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __unorddf2vfp(double a, double b); +// +// Returns one iff a or b is NaN +// Uses Darwin calling convention where double precision arguments are passsed +// like in GPR pairs. +// + .globl ___unorddf2vfp +___unorddf2vfp: + fmdrr d6, r0, r1 // load r0/r1 pair in double register + fmdrr d7, r2, r3 // load r2/r3 pair in double register + fcmpd d6, d7 + fmstat + movvs r0, #1 // set result register to 1 if "overflow" (any NaNs) + movvc r0, #0 + bx lr diff --git a/compiler-rt/lib/arm/unordsf2vfp.S b/compiler-rt/lib/arm/unordsf2vfp.S new file mode 100644 index 00000000000..6b69080ff33 --- /dev/null +++ b/compiler-rt/lib/arm/unordsf2vfp.S @@ -0,0 +1,27 @@ +//===-- unordsf2vfp.S - Implement unordsf2vfp -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __unordsf2vfp(float a, float b); +// +// Returns one iff a or b is NaN +// Uses Darwin calling convention where single precision arguments are passsed +// like 32-bit ints +// + .globl ___unordsf2vfp +___unordsf2vfp: + fmsr s14, r0 // move from GPR 0 to float register + fmsr s15, r1 // move from GPR 1 to float register + fcmps s14, s15 + fmstat + movvs r0, #1 // set result register to 1 if "overflow" (any NaNs) + movvc r0, #0 + bx lr + 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; +} |