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

Jakub Vaněk linuxtardis at gmail.com
Sat Dec 8 13:34:08 UTC 2018


Hi,

I'm sending an updated patch. Changes:

I have sent a jdk author request to Mark Reinhold, but I haven't got a reply yet.

However the patch can be found also here: https://github.com/ev3dev-lang-java/openjdk-ev3/blob/9eab3db7c865d763bf518fe0110bc81c14fd42e6/upstream/softfloat.patch

The patch was successfully built here: https://ci.adoptopenjdk.net/view/ev3dev/job/openjdk12_build_ev3_linux/56/

Thanks,

Jakub

HG changeset patch

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

Date 1544273385 -3600

Sat Dec 08 13:49:45 2018 +0100

Node ID 2dda78cf712d402b53df779325e8b8f23b487be2

Parent 583fd71c47d60dea883b1f03d9f1b2c267c0a891

Add support for compiling with SoftFloat-3e on arm sflt builds

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 --enable-softfloat to enable the use of this library. You can then use --with-softfloat-lib= and --with-softfloat-include= to specify the path to the softfloat.a archive and the source/include directory. Alternatively, if you install the library and its headers to a prefix, you can pass its path to --with-softfloat=.

    +

    If you do not enable this library, 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 +495,8 @@
  • --with-x= - Set the path to X11
  • --with-alsa= - Set the path to ALSA
  • --with-libffi= - Set the path to libffi
  • +
  • --enable-softfloat - Enable the use of external SoftFloat library on sflt builds.
  • +
  • --with-softfloat= or --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,28 @@ 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 +716,10 @@

    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,149 @@ +# +# 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

    +ifeq ($(SOFTFLOAT_LIBS), )

    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) {

    +``` +License for Berkeley SoftFloat Release 3e + +John R. Hauser +2018 January 20 + +The following applies to the whole of SoftFloat Release 3e as well as to +each source file individually. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +



    More information about the build-dev mailing list