/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifdef __SOFTFP__ // Soft float function declarations extern "C" { extern float __aeabi_fadd(float, float); extern float __aeabi_fsub(float, float); extern double __aeabi_dadd(double, double); extern double __aeabi_dsub(double, double); extern float __aeabi_fadd_extlib(float, float); extern float __aeabi_fsub_extlib(float, float); extern double __aeabi_dadd_extlib(double, double); extern double __aeabi_dsub_extlib(double, double); }; #ifdef SOFTFLOAT_EXTERNAL extern "C" { #include "softfloat.h" } #include static float __aeabi_float_handling(float natA, float natB, bool add) { float32_t libC; libC = add ? f32_add(reinterpret_cast(natA), reinterpret_cast(natB)) : f32_sub(reinterpret_cast(natA), reinterpret_cast(natB)); return reinterpret_cast(libC); } static double __aeabi_double_handling(double natA, double natB, bool add) { float64_t libC; libC = add ? f64_add(reinterpret_cast(natA), reinterpret_cast(natB)) : f64_sub(reinterpret_cast(natA), reinterpret_cast(natB)); return reinterpret_cast(libC); } float __aeabi_fadd_extlib(float a, float b) { return __aeabi_float_handling(a, b, true); } float __aeabi_fsub_extlib(float a, float b) { return __aeabi_float_handling(a, b, false); } double __aeabi_dadd_extlib(double a, double b) { return __aeabi_double_handling(a, b, true); } double __aeabi_dsub_extlib(double a, double b) { return __aeabi_double_handling(a, b, false); } #else float __aeabi_fadd_extlib(float a, float b) { return __aeabi_fadd(a, b); } float __aeabi_fsub_extlib(float a, float b) { return __aeabi_fsub(a, b); } double __aeabi_dadd_extlib(double a, double b) { return __aeabi_dadd(a, b); } double __aeabi_dsub_extlib(double a, double b) { return __aeabi_dsub(a, b); } #endif #endif // __SOFTFP__