diff options
author | Dan Albert <danalbert@google.com> | 2015-08-18 18:10:33 +0000 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-08-18 18:10:33 +0000 |
commit | 7fcc1595598f1f7c9cd94f0f2e891e2fbd257ece (patch) | |
tree | 94ed54f14d296528bc15ea2e05b9731a753aadb4 /test/builtins | |
parent | 607a4f74727d6e4140e3a957aaaaf9d0666ce667 (diff) |
Implement __aeabi_{f,d}rsub.
Summary: Implement the missing ARM EABI functions _aeabi_frsub and __aeabi_drsub.
Reviewers: rengolin, compnerd
Subscribers: pirama, srhines, danalbert, aemerson, llvm-commits
Differential Revision: http://reviews.llvm.org/D12088
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/builtins')
-rw-r--r-- | test/builtins/Unit/arm/aeabi_drsub_test.c | 47 | ||||
-rw-r--r-- | test/builtins/Unit/arm/aeabi_frsub_test.c | 47 |
2 files changed, 94 insertions, 0 deletions
diff --git a/test/builtins/Unit/arm/aeabi_drsub_test.c b/test/builtins/Unit/arm/aeabi_drsub_test.c new file mode 100644 index 000000000..7d867ef2c --- /dev/null +++ b/test/builtins/Unit/arm/aeabi_drsub_test.c @@ -0,0 +1,47 @@ +//===-- aeabi_drsub.c - Test __aeabi_drsub --------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __aeabi_drsub for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +#if __arm__ +extern __attribute__((pcs("aapcs"))) double __aeabi_drsub(double a, double b); + +int test__aeabi_drsub(double a, double b, double expected) +{ + double actual = __aeabi_drsub(a, b); + if (actual != expected) + printf("error in __aeabi_drsub(%f, %f) = %f, expected %f\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__aeabi_drsub(1.0, 1.0, 0.0)) + return 1; + if (test__aeabi_drsub(1234.567, 765.4321, -469.134900)) + return 1; + if (test__aeabi_drsub(-123.0, -678.0, -555.0)) + return 1; + if (test__aeabi_drsub(0.0, -0.0, 0.0)) + return 1; +#else + printf("skipped\n"); +#endif + return 0; +} diff --git a/test/builtins/Unit/arm/aeabi_frsub_test.c b/test/builtins/Unit/arm/aeabi_frsub_test.c new file mode 100644 index 000000000..b8b21b96e --- /dev/null +++ b/test/builtins/Unit/arm/aeabi_frsub_test.c @@ -0,0 +1,47 @@ +//===-- aeabi_frsub.c - Test __aeabi_frsub --------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file tests __aeabi_frsub for the compiler_rt library. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +#if __arm__ +extern __attribute__((pcs("aapcs"))) float __aeabi_frsub(float a, float b); + +int test__aeabi_frsub(float a, float b, float expected) +{ + float actual = __aeabi_frsub(a, b); + if (actual != expected) + printf("error in __aeabi_frsub(%f, %f) = %f, expected %f\n", + a, b, actual, expected); + return actual != expected; +} +#endif + +int main() +{ +#if __arm__ + if (test__aeabi_frsub(1.0, 1.0, 0.0)) + return 1; + if (test__aeabi_frsub(1234.567, 765.4321, -469.134900)) + return 1; + if (test__aeabi_frsub(-123.0, -678.0, -555.0)) + return 1; + if (test__aeabi_frsub(0.0, -0.0, 0.0)) + return 1; +#else + printf("skipped\n"); +#endif + return 0; +} |