diff options
-rw-r--r-- | lib/arm/extendsfdf2vfp.S | 23 | ||||
-rw-r--r-- | lib/arm/fixdfsivfp.S | 23 | ||||
-rw-r--r-- | lib/arm/fixsfsivfp.S | 23 | ||||
-rw-r--r-- | lib/arm/fixunsdfsivfp.S | 24 | ||||
-rw-r--r-- | lib/arm/fixunssfsivfp.S | 24 | ||||
-rw-r--r-- | lib/arm/floatsidfvfp.S | 23 | ||||
-rw-r--r-- | lib/arm/floatsisfvfp.S | 23 | ||||
-rw-r--r-- | lib/arm/floatunssidfvfp.S | 23 | ||||
-rw-r--r-- | lib/arm/floatunssisfvfp.S | 23 | ||||
-rw-r--r-- | lib/arm/truncdfsf2vfp.S | 23 | ||||
-rw-r--r-- | test/Unit/extebdsfdf2vfp_test.c | 46 | ||||
-rw-r--r-- | test/Unit/fixdfsivfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/fixsfsivfp_test.c | 50 | ||||
-rw-r--r-- | test/Unit/fixunsdfsivfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/fixunssfsivfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/floatsidfvfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/floatsisfvfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/floatunssidfvfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/floatunssisfvfp_test.c | 48 | ||||
-rw-r--r-- | test/Unit/truncdfsf2vfp_test.c | 48 |
20 files changed, 712 insertions, 0 deletions
diff --git a/lib/arm/extendsfdf2vfp.S b/lib/arm/extendsfdf2vfp.S new file mode 100644 index 00000000..024bbf0f --- /dev/null +++ b/lib/arm/extendsfdf2vfp.S @@ -0,0 +1,23 @@ +//===-- extendsfdf2vfp.S - Implement extendsfdf2vfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __extendsfdf2vfp(float a); +// +// Converts single precision float to double precision result. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR and a double precision result is returned in R0/R1 pair. +// + .globl ___extendsfdf2vfp +___extendsfdf2vfp: + fmsr s15, r0 // load float register from R0 + fcvtds d7, s15 // convert single to double + fmrrd r0, r1, d7 // return result in r0/r1 pair + bx lr diff --git a/lib/arm/fixdfsivfp.S b/lib/arm/fixdfsivfp.S new file mode 100644 index 00000000..75c322de --- /dev/null +++ b/lib/arm/fixdfsivfp.S @@ -0,0 +1,23 @@ +//===-- fixdfsivfp.S - Implement fixdfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __fixdfsivfp(double a); +// +// Converts double precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a double precision parameter is +// passed in GPR register pair. +// + .globl ___fixdfsivfp +___fixdfsivfp: + fmdrr d7, r0, r1 // load double register from R0/R1 + ftosizd s15, d7 // convert double to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/fixsfsivfp.S b/lib/arm/fixsfsivfp.S new file mode 100644 index 00000000..cd2fbe8c --- /dev/null +++ b/lib/arm/fixsfsivfp.S @@ -0,0 +1,23 @@ +//===-- fixsfsivfp.S - Implement fixsfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern int __fixsfsivfp(float a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR.. +// + .globl ___fixsfsivfp +___fixsfsivfp: + fmsr s15, r0 // load float register from R0 + ftosizs s15, s15 // convert single to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/fixunsdfsivfp.S b/lib/arm/fixunsdfsivfp.S new file mode 100644 index 00000000..ab6c4df9 --- /dev/null +++ b/lib/arm/fixunsdfsivfp.S @@ -0,0 +1,24 @@ +//===-- fixunsdfsivfp.S - Implement fixunsdfsivfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern unsigned int __fixunsdfsivfp(double a); +// +// Converts double precision float to a 32-bit unsigned int rounding towards +// zero. All negative values become zero. +// Uses Darwin calling convention where a double precision parameter is +// passed in GPR register pair. +// + .globl ___fixunsdfsivfp +___fixunsdfsivfp: + fmdrr d7, r0, r1 // load double register from R0/R1 + ftouizd s15, d7 // convert double to 32-bit int into s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/fixunssfsivfp.S b/lib/arm/fixunssfsivfp.S new file mode 100644 index 00000000..c39c6983 --- /dev/null +++ b/lib/arm/fixunssfsivfp.S @@ -0,0 +1,24 @@ +//===-- fixunssfsivfp.S - Implement fixunssfsivfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern unsigned int __fixunssfsivfp(float a); +// +// Converts single precision float to a 32-bit unsigned int rounding towards +// zero. All negative values become zero. +// Uses Darwin calling convention where a single precision parameter is +// passed in a GPR.. +// + .globl ___fixunssfsivfp +___fixunssfsivfp: + fmsr s15, r0 // load float register from R0 + ftouizs s15, s15 // convert single to 32-bit unsigned into s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/floatsidfvfp.S b/lib/arm/floatsidfvfp.S new file mode 100644 index 00000000..d4029248 --- /dev/null +++ b/lib/arm/floatsidfvfp.S @@ -0,0 +1,23 @@ +//===-- floatsidfvfp.S - Implement floatsidfvfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __floatsidfvfp(int a); +// +// Converts a 32-bit int to a double precision float. +// Uses Darwin calling convention where a double precision result is +// return in GPR register pair. +// + .globl ___floatsidfvfp +___floatsidfvfp: + fmsr s15, r0 // move int to float register s15 + fsitod d7, s15 // convert 32-bit int in s15 to double in d7 + fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + bx lr diff --git a/lib/arm/floatsisfvfp.S b/lib/arm/floatsisfvfp.S new file mode 100644 index 00000000..29e7e0df --- /dev/null +++ b/lib/arm/floatsisfvfp.S @@ -0,0 +1,23 @@ +//===-- floatsisfvfp.S - Implement floatsisfvfp ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __floatsisfvfp(int a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision result is +// return in a GPR.. +// + .globl ___floatsisfvfp +___floatsisfvfp: + fmsr s15, r0 // move int to float register s15 + fsitos s15, s15 // convert 32-bit int in s15 to float in s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/floatunssidfvfp.S b/lib/arm/floatunssidfvfp.S new file mode 100644 index 00000000..148945f6 --- /dev/null +++ b/lib/arm/floatunssidfvfp.S @@ -0,0 +1,23 @@ +//===-- floatunssidfvfp.S - Implement floatunssidfvfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern double __floatunssidfvfp(unsigned int a); +// +// Converts a 32-bit int to a double precision float. +// Uses Darwin calling convention where a double precision result is +// return in GPR register pair. +// + .globl ___floatunssidfvfp +___floatunssidfvfp: + fmsr s15, r0 // move int to float register s15 + fuitod d7, s15 // convert 32-bit int in s15 to double in d7 + fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + bx lr diff --git a/lib/arm/floatunssisfvfp.S b/lib/arm/floatunssisfvfp.S new file mode 100644 index 00000000..c8322787 --- /dev/null +++ b/lib/arm/floatunssisfvfp.S @@ -0,0 +1,23 @@ +//===-- floatunssisfvfp.S - Implement floatunssisfvfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __floatunssisfvfp(unsigned int a); +// +// Converts single precision float to a 32-bit int rounding towards zero. +// Uses Darwin calling convention where a single precision result is +// return in a GPR.. +// + .globl ___floatunssisfvfp +___floatunssisfvfp: + fmsr s15, r0 // move int to float register s15 + fuitos s15, s15 // convert 32-bit int in s15 to float in s15 + fmrs r0, s15 // move s15 to result register + bx lr diff --git a/lib/arm/truncdfsf2vfp.S b/lib/arm/truncdfsf2vfp.S new file mode 100644 index 00000000..2e26fdcf --- /dev/null +++ b/lib/arm/truncdfsf2vfp.S @@ -0,0 +1,23 @@ +//===-- truncdfsf2vfp.S - Implement truncdfsf2vfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// +// extern float __truncdfsf2vfp(double a); +// +// Converts double precision float to signle precision result. +// Uses Darwin calling convention where a double precision parameter is +// passed in a R0/R1 pair and a signle precision result is returned in R0. +// + .globl ___truncdfsf2vfp +___truncdfsf2vfp: + fmdrr d7, r0, r1 // load double from r0/r1 pair + fcvtsd s15, d7 // convert double to single (trucate precision) + fmrs r0, s15 // return result in r0 + bx lr diff --git a/test/Unit/extebdsfdf2vfp_test.c b/test/Unit/extebdsfdf2vfp_test.c new file mode 100644 index 00000000..f2cf682e --- /dev/null +++ b/test/Unit/extebdsfdf2vfp_test.c @@ -0,0 +1,46 @@ +//===-- extendsfdf2vfp_test.c - Test __extendsfdf2vfp ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __extendsfdf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern double __extendsfdf2vfp(float a); + +#if __arm__ +int test__extendsfdf2vfp(float a) +{ + double actual = __extendsfdf2vfp(a); + double expected = a; + if (actual != expected) + printf("error in test__extendsfdf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__extendsfdf2vfp(0.0)) + return 1; + if (test__extendsfdf2vfp(1.0)) + return 1; + if (test__extendsfdf2vfp(-1.0)) + return 1; + if (test__extendsfdf2vfp(3.1415926535)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/fixdfsivfp_test.c b/test/Unit/fixdfsivfp_test.c new file mode 100644 index 00000000..00d24fb1 --- /dev/null +++ b/test/Unit/fixdfsivfp_test.c @@ -0,0 +1,48 @@ +//===-- fixdfsivfp_test.c - Test __fixdfsivfp -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixdfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern int __fixdfsivfp(double a); + +#if __arm__ +int test__fixdfsivfp(double a) +{ + int actual = __fixdfsivfp(a); + int expected = a; + if (actual != expected) + printf("error in test__fixdfsivfp(%f) = %d, expected %d\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixdfsivfp(0.0)) + return 1; + if (test__fixdfsivfp(1.0)) + return 1; + if (test__fixdfsivfp(-1.0)) + return 1; + if (test__fixdfsivfp(2147483647)) + return 1; + if (test__fixdfsivfp(-2147483648.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/fixsfsivfp_test.c b/test/Unit/fixsfsivfp_test.c new file mode 100644 index 00000000..19d70b1e --- /dev/null +++ b/test/Unit/fixsfsivfp_test.c @@ -0,0 +1,50 @@ +//===-- fixsfsivfp_test.c - Test __fixsfsivfp -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixsfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern int __fixsfsivfp(float a); + +#if __arm__ +int test__fixsfsivfp(float a) +{ + int actual = __fixsfsivfp(a); + int expected = a; + if (actual != expected) + printf("error in test__fixsfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixsfsivfp(0.0)) + return 1; + if (test__fixsfsivfp(1.0)) + return 1; + if (test__fixsfsivfp(-1.0)) + return 1; + if (test__fixsfsivfp(2147483647.0)) + return 1; + if (test__fixsfsivfp(-2147483648.0)) + return 1; + if (test__fixsfsivfp(65536.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/fixunsdfsivfp_test.c b/test/Unit/fixunsdfsivfp_test.c new file mode 100644 index 00000000..7c968f29 --- /dev/null +++ b/test/Unit/fixunsdfsivfp_test.c @@ -0,0 +1,48 @@ +//===-- fixunsdfsivfp_test.c - Test __fixunsdfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixunsdfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern unsigned int __fixunsdfsivfp(double a); + +#if __arm__ +int test__fixunsdfsivfp(double a) +{ + unsigned int actual = __fixunsdfsivfp(a); + unsigned int expected = a; + if (actual != expected) + printf("error in test__fixunsdfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixunsdfsivfp(0.0)) + return 1; + if (test__fixunsdfsivfp(1.0)) + return 1; + if (test__fixunsdfsivfp(-1.0)) + return 1; + if (test__fixunsdfsivfp(4294967295.0)) + return 1; + if (test__fixunsdfsivfp(65536.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/fixunssfsivfp_test.c b/test/Unit/fixunssfsivfp_test.c new file mode 100644 index 00000000..9653175f --- /dev/null +++ b/test/Unit/fixunssfsivfp_test.c @@ -0,0 +1,48 @@ +//===-- fixunssfsivfp_test.c - Test __fixunssfsivfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __fixunssfsivfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern unsigned int __fixunssfsivfp(float a); + +#if __arm__ +int test__fixunssfsivfp(float a) +{ + unsigned int actual = __fixunssfsivfp(a); + unsigned int expected = a; + if (actual != expected) + printf("error in test__fixunssfsivfp(%f) = %u, expected %u\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__fixunssfsivfp(0.0)) + return 1; + if (test__fixunssfsivfp(1.0)) + return 1; + if (test__fixunssfsivfp(-1.0)) + return 1; + if (test__fixunssfsivfp(4294967295.0)) + return 1; + if (test__fixunssfsivfp(65536.0)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/floatsidfvfp_test.c b/test/Unit/floatsidfvfp_test.c new file mode 100644 index 00000000..956fe862 --- /dev/null +++ b/test/Unit/floatsidfvfp_test.c @@ -0,0 +1,48 @@ +//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatsidfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern double __floatsidfvfp(int a); + +#if __arm__ +int test__floatsidfvfp(int a) +{ + double actual = __floatsidfvfp(a); + double expected = a; + if (actual != expected) + printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatsidfvfp(0)) + return 1; + if (test__floatsidfvfp(1)) + return 1; + if (test__floatsidfvfp(-1)) + return 1; + if (test__floatsidfvfp(0x7FFFFFFF)) + return 1; + if (test__floatsidfvfp(0x80000000)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/floatsisfvfp_test.c b/test/Unit/floatsisfvfp_test.c new file mode 100644 index 00000000..5642e9ba --- /dev/null +++ b/test/Unit/floatsisfvfp_test.c @@ -0,0 +1,48 @@ +//===-- floatsisfvfp_test.c - Test __floatsisfvfp -------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatsisfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern float __floatsisfvfp(int a); + +#if __arm__ +int test__floatsisfvfp(int a) +{ + float actual = __floatsisfvfp(a); + float expected = a; + if (actual != expected) + printf("error in test__floatsisfvfp(%d) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatsisfvfp(0)) + return 1; + if (test__floatsisfvfp(1)) + return 1; + if (test__floatsisfvfp(-1)) + return 1; + if (test__floatsisfvfp(0x7FFFFFFF)) + return 1; + if (test__floatsisfvfp(0x80000000)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/floatunssidfvfp_test.c b/test/Unit/floatunssidfvfp_test.c new file mode 100644 index 00000000..be0bd078 --- /dev/null +++ b/test/Unit/floatunssidfvfp_test.c @@ -0,0 +1,48 @@ +//===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatunssidfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern double __floatunssidfvfp(unsigned int a); + +#if __arm__ +int test__floatunssidfvfp(unsigned int a) +{ + double actual = __floatunssidfvfp(a); + double expected = a; + if (actual != expected) + printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatunssidfvfp(0)) + return 1; + if (test__floatunssidfvfp(1)) + return 1; + if (test__floatunssidfvfp(0x7FFFFFFF)) + return 1; + if (test__floatunssidfvfp(0x80000000)) + return 1; + if (test__floatunssidfvfp(0xFFFFFFFF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/floatunssisfvfp_test.c b/test/Unit/floatunssisfvfp_test.c new file mode 100644 index 00000000..13cee2f4 --- /dev/null +++ b/test/Unit/floatunssisfvfp_test.c @@ -0,0 +1,48 @@ +//===-- floatunssisfvfp_test.c - Test __floatunssisfvfp -------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __floatunssisfvfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern float __floatunssisfvfp(unsigned int a); + +#if __arm__ +int test__floatunssisfvfp(unsigned int a) +{ + float actual = __floatunssisfvfp(a); + float expected = a; + if (actual != expected) + printf("error in test__floatunssisfvfp(%u) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__floatunssisfvfp(0)) + return 1; + if (test__floatunssisfvfp(1)) + return 1; + if (test__floatunssisfvfp(0x7FFFFFFF)) + return 1; + if (test__floatunssisfvfp(0x80000000)) + return 1; + if (test__floatunssisfvfp(0xFFFFFFFF)) + return 1; +#endif + return 0; +} diff --git a/test/Unit/truncdfsf2vfp_test.c b/test/Unit/truncdfsf2vfp_test.c new file mode 100644 index 00000000..f02b8362 --- /dev/null +++ b/test/Unit/truncdfsf2vfp_test.c @@ -0,0 +1,48 @@ +//===-- truncdfsf2vfp_test.c - Test __truncdfsf2vfp -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __truncdfsf2vfp for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +extern float __truncdfsf2vfp(double a); + +#if __arm__ +int test__truncdfsf2vfp(double a) +{ + float actual = __truncdfsf2vfp(a); + float expected = a; + if (actual != expected) + printf("error in test__truncdfsf2vfp(%f) = %f, expected %f\n", + a, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__truncdfsf2vfp(0.0)) + return 1; + if (test__truncdfsf2vfp(1.0)) + return 1; + if (test__truncdfsf2vfp(-1.0)) + return 1; + if (test__truncdfsf2vfp(3.1415926535)) + return 1; + if (test__truncdfsf2vfp(123.456)) + return 1; +#endif + return 0; +} |