forked from OSchip/llvm-project
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 llvm-svn: 245321
This commit is contained in:
parent
9ae6adfa3b
commit
b5226576ea
|
@ -191,7 +191,9 @@ set(arm_SOURCES
|
|||
arm/addsf3vfp.S
|
||||
arm/aeabi_dcmp.S
|
||||
arm/aeabi_div0.c
|
||||
arm/aeabi_drsub.c
|
||||
arm/aeabi_fcmp.S
|
||||
arm/aeabi_frsub.c
|
||||
arm/aeabi_idivmod.S
|
||||
arm/aeabi_ldivmod.S
|
||||
arm/aeabi_memcmp.S
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
//===-- lib/arm/aeabi_drsub.c - Double-precision subtraction --------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DOUBLE_PRECISION
|
||||
#include "../fp_lib.h"
|
||||
|
||||
COMPILER_RT_ABI fp_t
|
||||
__aeabi_dsub(fp_t, fp_t);
|
||||
|
||||
COMPILER_RT_ABI fp_t
|
||||
__aeabi_drsub(fp_t a, fp_t b) {
|
||||
return __aeabi_dsub(b, a);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
//===-- lib/arm/aeabi_frsub.c - Single-precision subtraction --------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define SINGLE_PRECISION
|
||||
#include "../fp_lib.h"
|
||||
|
||||
COMPILER_RT_ABI fp_t
|
||||
__aeabi_fsub(fp_t, fp_t);
|
||||
|
||||
COMPILER_RT_ABI fp_t
|
||||
__aeabi_frsub(fp_t a, fp_t b) {
|
||||
return __aeabi_fsub(b, a);
|
||||
}
|
|
@ -23,4 +23,3 @@ __subdf3(fp_t a, fp_t b) {
|
|||
return __adddf3(a, fromRep(toRep(b) ^ signBit));
|
||||
}
|
||||
|
||||
/* FIXME: rsub for ARM EABI */
|
||||
|
|
|
@ -23,4 +23,3 @@ __subsf3(fp_t a, fp_t b) {
|
|||
return __addsf3(a, fromRep(toRep(b) ^ signBit));
|
||||
}
|
||||
|
||||
/* FIXME: rsub for ARM EABI */
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue