[PATCH v2] Add support for SoftFloat library on ARM (original) (raw)

Jakub Vaněk linuxtardis at gmail.com
Fri Nov 30 13:38:26 UTC 2018


Hi David,

I'm sending an alternative patch for handling the problem with _aeabi_glibc on arm softfloat builds. This patch adds integration code for SoftFloat-3e library. It adds appropriate configure options and a switchable implementation of _aeabi_glibc/_aeabi*_extlib functions.

There are now two implementations of the _glibc functions (now renamed to _extlib). The simpler one simply wraps _aeabi* functions. The other one wraps SoftFloat-3 API. By using this mechanism, the building user can choose what happens. The external library is not required - if the path to its static library/include directory is not specified on configure commandline, standard system functions are used automatically.

Thanks,

Jakub

HG changeset patch

User Jakub Vaněk <linuxtardis at gmail.com>

Date 1543498682 -3600

Thu Nov 29 14:38:02 2018 +0100

Node ID bc14ee6f50c73703229f979e78b93bcef12ae106

Parent a96844b3a929cc2eb92fe7963be8aec603f24a83

Add support for SoftFloat library on ARM

diff --git a/doc/building.html b/doc/building.html --- a/doc/building.html +++ b/doc/building.html @@ -53,6 +53,7 @@

  • X11
  • ALSA
  • libffi
  • +
  • SoftFloat
  • Build Tools Requirements

    Use --with-libffi= if configure does not properly locate your libffi files.

    +

    SoftFloat

    +

    Berkeley SoftFloat-3 can be used on ARM processors without FPU to slightly enhance the arithmetic precision of some floating point operations. It is not required, system softfp routines can be used without any problems. The precision loss is extremely small, but the JCK detects it.

    + +

    Use --with-softfloat-lib= and --with-softfloat-include= to specify the path to the softfloat.a archive and the source/include directory. If you omit them or use --without-softfloat-*, standard system libraries will be used instead.

    Build Tools Requirements

    Autoconf

    The JDK requires Autoconf; on all platforms. At least version 2.69 is required.

    @@ -486,6 +493,7 @@
  • --with-x= - Set the path to X11
  • --with-alsa= - Set the path to ALSA
  • --with-libffi= - Set the path to libffi
  • +
  • --with-softfloat-lib=, --with-softfloat-include= - Set the path to SoftFloat library and include directory.
  • --with-jtreg= - Set the path to JTReg. See Running Tests
  • Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms and zlib) are included in the JDK repository. The default behavior of the JDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify system as the option in these arguments. (The default is bundled).

    diff --git a/doc/building.md b/doc/building.md --- a/doc/building.md +++ b/doc/building.md @@ -527,6 +527,24 @@ Use --with-libffi=<path> if configure does not properly locate your libffi files.

    +### SoftFloat + +Berkeley SoftFloat-3 +can be used on ARM processors without FPU to slightly enhance +the arithmetic precision of some floating point operations. It is not +required, system softfp routines can be used without any problems. +The precision loss is extremely small, but the JCK detects it. +

    @@ -694,6 +712,8 @@

    diff --git a/make/autoconf/lib-softfloat.m4 b/make/autoconf/lib-softfloat.m4 new file mode 100644 --- /dev/null +++ b/make/autoconf/lib-softfloat.m4 @@ -0,0 +1,93 @@ +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# + +################################################################################ +# Setup softfloat library +################################################################################ +AC_DEFUN_ONCE([LIB_SETUP_SOFTFLOAT], +[

    ################################################################################

    Determine which libraries are needed for this configuration

    @@ -79,6 +80,13 @@ NEEDS_LIB_ALSA=false fi

    @@ -98,6 +106,7 @@ LIB_SETUP_FONTCONFIG LIB_SETUP_FREETYPE LIB_SETUP_ALSA

    JVM_LIBS +=
    $(JVM_LIBS_FEATURES) \

    These files and directories are always excluded

    diff --git a/make/hotspot/lib/JvmFlags.gmk b/make/hotspot/lib/JvmFlags.gmk --- a/make/hotspot/lib/JvmFlags.gmk +++ b/make/hotspot/lib/JvmFlags.gmk @@ -88,6 +88,7 @@ $(JVM_CFLAGS_TARGET_DEFINES)
    $(JVM_CFLAGS_FEATURES)
    $(JVM_CFLAGS_INCLUDES) \

    diff --git a/src/hotspot/cpu/arm/assembler_arm_32.hpp b/src/hotspot/cpu/arm/assembler_arm_32.hpp --- a/src/hotspot/cpu/arm/assembler_arm_32.hpp +++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp @@ -1242,10 +1242,10 @@

    // Imported code from glibc soft-fp bundle for // calculation accuracy improvement. See CR 6757269. -extern double __aeabi_fadd_glibc(float, float); -extern double __aeabi_fsub_glibc(float, float); -extern double __aeabi_dadd_glibc(double, double); -extern double __aeabi_dsub_glibc(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); }; #endif // SOFTFP

    diff --git a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp --- a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp @@ -490,27 +490,28 @@ // Call function compiled with -msoft-float.

       // __aeabi_XXXX_glibc: Imported code from glibc soft-fp bundle for calculation accuracy improvement. See CR 6757269.

    diff --git a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp --- a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp +++ b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp @@ -804,15 +804,16 @@ #define FUNCTION_CASE(a, f)
    if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f

    diff --git a/src/hotspot/cpu/arm/softfloat_arm.cpp b/src/hotspot/cpu/arm/softfloat_arm.cpp new file mode 100644 --- /dev/null +++ b/src/hotspot/cpu/arm/softfloat_arm.cpp @@ -0,0 +1,112 @@ +/*

    +}; + +#ifdef SOFTFLOAT_EXTERNAL + +extern "C" { +#include "softfloat.h" +} + +#include + +static float __aeabi_float_handling(float natA, float natB, bool add) {

    +} + +static double __aeabi_double_handling(double natA, double natB, bool add) {

    +} + +float __aeabi_fadd_extlib(float a, float b) {

    +} + +float __aeabi_fsub_extlib(float a, float b) {

    +} + +double __aeabi_dadd_extlib(double a, double b) {

    +} + +double __aeabi_dsub_extlib(double a, double b) {

    +} + +#else + +float __aeabi_fadd_extlib(float a, float b) {

    +} + +float __aeabi_fsub_extlib(float a, float b) {

    +} + +double __aeabi_dadd_extlib(double a, double b) {

    +} + +double __aeabi_dsub_extlib(double a, double b) {

    +} + +#endif + +#endif // SOFTFP diff --git a/src/hotspot/cpu/arm/templateTable_arm.cpp b/src/hotspot/cpu/arm/templateTable_arm.cpp --- a/src/hotspot/cpu/arm/templateTable_arm.cpp +++ b/src/hotspot/cpu/arm/templateTable_arm.cpp @@ -1610,8 +1610,10 @@ __ mov(R1, R0_tos); __ pop_i(R0); switch (op) {



    More information about the build-dev mailing list