提交 48471bfa 编写于 作者: B Bucky Kittinger

Added softfloat as a submodule from EOSIO fork

上级 1aeeb715
......@@ -21,3 +21,6 @@
path = externals/binaryen
url = https://github.com/EOSIO/binaryen
[submodule "libraries/softfloat"]
path = libraries/softfloat
url = https://github.com/eosio/berkeley-softfloat-3
......@@ -191,7 +191,6 @@ endif()
add_subdirectory( externals )
include(wasm)
include(softfloat)
add_subdirectory( libraries )
add_subdirectory( contracts )
......
# - Try to find SOFTFLOAT
# TODO: Check if compiler is able to generate wasm32
if ("${SOFTFLOAT_ROOT}" STREQUAL "")
if (NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
set(SOFTFLOAT_ROOT $ENV{SOFTFLOAT_ROOT})
elseif (APPLE)
set(SOFTFLOAT_ROOT "/usr/local/berkeley-softfloat-3")
elseif(UNIX AND NOT APPLE)
set(SOFTFLOAT_ROOT "/opt/berkeley-softfloat-3")
else()
message(FATAL_ERROR "softfloat not found and don't know where to look, please specify SOFTFLOAT_ROOT")
endif()
endif()
message( STATUS "Looking for softfloat library" )
find_library( SOFTFLOAT_LIB libsoftfloat.a PATHS ${SOFTFLOAT_ROOT} NO_DEFAULT_PATH )
find_package(Softfloat)
if ( ${SOFTFLOAT_LIB} STREQUAL "SOFTFLOAT_LIB-NOTFOUND" )
message( FATAL_ERROR "Unable to find softfloat library" )
return()
else()
message( STATUS "Found softfloat library " ${SOFTFLOAT_LIB} )
set( SOFTFLOAT_INC, ${SOFTFLOAT_ROOT}/include )
add_library(softfloat_lib STATIC IMPORTED )
set_target_properties( softfloat_lib PROPERTIES
IMPORTED_LOCATION "${SOFTFLOAT_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${SOFTFLOAT_INC}"
)
endif()
......@@ -107,7 +107,6 @@
export OPENSSL_ROOT_DIR=/usr/include/openssl
export OPENSSL_LIBRARIES=/usr/include/openssl
export WASM_ROOT=${HOME}/opt/wasm
export SOFTFLOAT_ROOT=${HOME}/opt/berkeley-softfloat-3
. $FILE
......@@ -117,7 +116,6 @@
OPENSSL_ROOT_DIR=/usr/local/opt/openssl
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib
export WASM_ROOT=/usr/local/wasm
export SOFTFLOAT_ROOT=/usr/local/berkeley-softfloat-3
CXX_COMPILER=clang++
C_COMPILER=clang
BUILD_MONGO_DB_PLUGIN=false
......@@ -140,7 +138,7 @@
fi
$CMAKE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} -DSOFTFLOAT_ROOT=${SOFTFLOAT_ROOT} \
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DBUILD_MONGO_DB_PLUGIN=${BUILD_MONGO_DB_PLUGIN} \
-DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} ..
......
add_subdirectory( fc )
add_subdirectory( softfloat )
add_subdirectory( chainbase )
add_subdirectory( wasm-jit )
add_subdirectory( egenesis )
......
......@@ -34,13 +34,12 @@ add_library( eosio_chain
transaction_metadata.cpp)
target_link_libraries( eosio_chain eos_utilities fc chainbase Logging IR WAST WASM Runtime
wasm asmjs passes cfg ast emscripten-optimizer support ${SOFTFLOAT_LIB}
wasm asmjs passes cfg ast emscripten-optimizer support softfloat
)
target_include_directories( eosio_chain
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../wasm-jit/Include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../externals/binaryen/src"
"${SOFTFLOAT_ROOT}/include"
)
if(MSVC)
......
......@@ -6,7 +6,7 @@
#include <eosio/chain/contracts/types.hpp>
#include <eosio/chain/multi_index_includes.hpp>
#include <eosio/chain/softfloat.hpp>
#include <softfloat.hpp>
#include <chainbase/chainbase.hpp>
......
#pragma once
#include <softfloat_types.h>
#ifndef THREAD_LOCAL
#define THREAD_LOCAL __thread
#endif
extern "C" {
/*----------------------------------------------------------------------------
| Integer-to-floating-point conversion routines.
*----------------------------------------------------------------------------*/
float16_t ui32_to_f16( uint32_t );
float32_t ui32_to_f32( uint32_t );
float64_t ui32_to_f64( uint32_t );
float128_t ui32_to_f128( uint32_t );
void ui32_to_f128M( uint32_t, float128_t * );
float16_t ui64_to_f16( uint64_t );
float32_t ui64_to_f32( uint64_t );
float64_t ui64_to_f64( uint64_t );
float128_t ui64_to_f128( uint64_t );
void ui64_to_f128M( uint64_t, float128_t * );
float16_t i32_to_f16( int32_t );
float32_t i32_to_f32( int32_t );
float64_t i32_to_f64( int32_t );
float128_t i32_to_f128( int32_t );
void i32_to_f128M( int32_t, float128_t * );
float16_t i64_to_f16( int64_t );
float32_t i64_to_f32( int64_t );
float64_t i64_to_f64( int64_t );
float128_t i64_to_f128( int64_t );
void i64_to_f128M( int64_t, float128_t * );
/*----------------------------------------------------------------------------
| 16-bit (half-precision) floating-point operations.
*----------------------------------------------------------------------------*/
uint_fast32_t f16_to_ui32( float16_t, uint_fast8_t, bool );
uint_fast64_t f16_to_ui64( float16_t, uint_fast8_t, bool );
int_fast32_t f16_to_i32( float16_t, uint_fast8_t, bool );
int_fast64_t f16_to_i64( float16_t, uint_fast8_t, bool );
uint_fast32_t f16_to_ui32_r_minMag( float16_t, bool );
uint_fast64_t f16_to_ui64_r_minMag( float16_t, bool );
int_fast32_t f16_to_i32_r_minMag( float16_t, bool );
int_fast64_t f16_to_i64_r_minMag( float16_t, bool );
float32_t f16_to_f32( float16_t );
float64_t f16_to_f64( float16_t );
float128_t f16_to_f128( float16_t );
void f16_to_f128M( float16_t, float128_t * );
float16_t f16_roundToInt( float16_t, uint_fast8_t, bool );
float16_t f16_add( float16_t, float16_t );
float16_t f16_sub( float16_t, float16_t );
float16_t f16_mul( float16_t, float16_t );
float16_t f16_mulAdd( float16_t, float16_t, float16_t );
float16_t f16_div( float16_t, float16_t );
float16_t f16_rem( float16_t, float16_t );
float16_t f16_sqrt( float16_t );
bool f16_eq( float16_t, float16_t );
bool f16_le( float16_t, float16_t );
bool f16_lt( float16_t, float16_t );
bool f16_eq_signaling( float16_t, float16_t );
bool f16_le_quiet( float16_t, float16_t );
bool f16_lt_quiet( float16_t, float16_t );
bool f16_isSignalingNaN( float16_t );
/*----------------------------------------------------------------------------
| 32-bit (single-precision) floating-point operations.
*----------------------------------------------------------------------------*/
uint_fast32_t f32_to_ui32( float32_t, uint_fast8_t, bool );
uint_fast64_t f32_to_ui64( float32_t, uint_fast8_t, bool );
int_fast32_t f32_to_i32( float32_t, uint_fast8_t, bool );
int_fast64_t f32_to_i64( float32_t, uint_fast8_t, bool );
uint_fast32_t f32_to_ui32_r_minMag( float32_t, bool );
uint_fast64_t f32_to_ui64_r_minMag( float32_t, bool );
int_fast32_t f32_to_i32_r_minMag( float32_t, bool );
int_fast64_t f32_to_i64_r_minMag( float32_t, bool );
float16_t f32_to_f16( float32_t );
float64_t f32_to_f64( float32_t );
float128_t f32_to_f128( float32_t );
void f32_to_f128M( float32_t, float128_t * );
float32_t f32_roundToInt( float32_t, uint_fast8_t, bool );
float32_t f32_add( float32_t, float32_t );
float32_t f32_sub( float32_t, float32_t );
float32_t f32_mul( float32_t, float32_t );
float32_t f32_mulAdd( float32_t, float32_t, float32_t );
float32_t f32_div( float32_t, float32_t );
float32_t f32_rem( float32_t, float32_t );
float32_t f32_sqrt( float32_t );
bool f32_eq( float32_t, float32_t );
bool f32_le( float32_t, float32_t );
bool f32_lt( float32_t, float32_t );
bool f32_eq_signaling( float32_t, float32_t );
bool f32_le_quiet( float32_t, float32_t );
bool f32_lt_quiet( float32_t, float32_t );
bool f32_isSignalingNaN( float32_t );
/*----------------------------------------------------------------------------
| 64-bit (double-precision) floating-point operations.
*----------------------------------------------------------------------------*/
uint_fast32_t f64_to_ui32( float64_t, uint_fast8_t, bool );
uint_fast64_t f64_to_ui64( float64_t, uint_fast8_t, bool );
int_fast32_t f64_to_i32( float64_t, uint_fast8_t, bool );
int_fast64_t f64_to_i64( float64_t, uint_fast8_t, bool );
uint_fast32_t f64_to_ui32_r_minMag( float64_t, bool );
uint_fast64_t f64_to_ui64_r_minMag( float64_t, bool );
int_fast32_t f64_to_i32_r_minMag( float64_t, bool );
int_fast64_t f64_to_i64_r_minMag( float64_t, bool );
float16_t f64_to_f16( float64_t );
float32_t f64_to_f32( float64_t );
float128_t f64_to_f128( float64_t );
void f64_to_f128M( float64_t, float128_t * );
float64_t f64_roundToInt( float64_t, uint_fast8_t, bool );
float64_t f64_add( float64_t, float64_t );
float64_t f64_sub( float64_t, float64_t );
float64_t f64_mul( float64_t, float64_t );
float64_t f64_mulAdd( float64_t, float64_t, float64_t );
float64_t f64_div( float64_t, float64_t );
float64_t f64_rem( float64_t, float64_t );
float64_t f64_sqrt( float64_t );
bool f64_eq( float64_t, float64_t );
bool f64_le( float64_t, float64_t );
bool f64_lt( float64_t, float64_t );
bool f64_eq_signaling( float64_t, float64_t );
bool f64_le_quiet( float64_t, float64_t );
bool f64_lt_quiet( float64_t, float64_t );
bool f64_isSignalingNaN( float64_t );
/*----------------------------------------------------------------------------
| 128-bit (quadruple-precision) floating-point operations.
*----------------------------------------------------------------------------*/
uint_fast32_t f128_to_ui32( float128_t, uint_fast8_t, bool );
uint_fast64_t f128_to_ui64( float128_t, uint_fast8_t, bool );
int_fast32_t f128_to_i32( float128_t, uint_fast8_t, bool );
int_fast64_t f128_to_i64( float128_t, uint_fast8_t, bool );
uint_fast32_t f128_to_ui32_r_minMag( float128_t, bool );
uint_fast64_t f128_to_ui64_r_minMag( float128_t, bool );
int_fast32_t f128_to_i32_r_minMag( float128_t, bool );
int_fast64_t f128_to_i64_r_minMag( float128_t, bool );
float16_t f128_to_f16( float128_t );
float32_t f128_to_f32( float128_t );
float64_t f128_to_f64( float128_t );
float128_t f128_roundToInt( float128_t, uint_fast8_t, bool );
float128_t f128_add( float128_t, float128_t );
float128_t f128_sub( float128_t, float128_t );
float128_t f128_mul( float128_t, float128_t );
float128_t f128_mulAdd( float128_t, float128_t, float128_t );
float128_t f128_div( float128_t, float128_t );
float128_t f128_rem( float128_t, float128_t );
float128_t f128_sqrt( float128_t );
bool f128_eq( float128_t, float128_t );
bool f128_le( float128_t, float128_t );
bool f128_lt( float128_t, float128_t );
bool f128_eq_signaling( float128_t, float128_t );
bool f128_le_quiet( float128_t, float128_t );
bool f128_lt_quiet( float128_t, float128_t );
bool f128_isSignalingNaN( float128_t );
uint_fast32_t f128M_to_ui32( const float128_t *, uint_fast8_t, bool );
uint_fast64_t f128M_to_ui64( const float128_t *, uint_fast8_t, bool );
int_fast32_t f128M_to_i32( const float128_t *, uint_fast8_t, bool );
int_fast64_t f128M_to_i64( const float128_t *, uint_fast8_t, bool );
uint_fast32_t f128M_to_ui32_r_minMag( const float128_t *, bool );
uint_fast64_t f128M_to_ui64_r_minMag( const float128_t *, bool );
int_fast32_t f128M_to_i32_r_minMag( const float128_t *, bool );
int_fast64_t f128M_to_i64_r_minMag( const float128_t *, bool );
float16_t f128M_to_f16( const float128_t * );
float32_t f128M_to_f32( const float128_t * );
float64_t f128M_to_f64( const float128_t * );
void f128M_roundToInt( const float128_t *, uint_fast8_t, bool, float128_t * );
void f128M_add( const float128_t *, const float128_t *, float128_t * );
void f128M_sub( const float128_t *, const float128_t *, float128_t * );
void f128M_mul( const float128_t *, const float128_t *, float128_t * );
void
f128M_mulAdd(
const float128_t *, const float128_t *, const float128_t *, float128_t *
);
void f128M_div( const float128_t *, const float128_t *, float128_t * );
void f128M_rem( const float128_t *, const float128_t *, float128_t * );
void f128M_sqrt( const float128_t *, float128_t * );
bool f128M_eq( const float128_t *, const float128_t * );
bool f128M_le( const float128_t *, const float128_t * );
bool f128M_lt( const float128_t *, const float128_t * );
bool f128M_eq_signaling( const float128_t *, const float128_t * );
bool f128M_le_quiet( const float128_t *, const float128_t * );
bool f128M_lt_quiet( const float128_t *, const float128_t * );
bool f128M_isSignalingNaN( const float128_t * );
};
#pragma once
#include <eosio/chain/webassembly/common.hpp>
#include <eosio/chain/softfloat.hpp>
#include <softfloat.hpp>
#include "Runtime/Runtime.h"
#include "IR/Types.h"
......
Subproject commit 4f0bb0ded7a5024d20d53827a81fe92473bf6058
......@@ -172,29 +172,6 @@
printf "\tsecp256k1 found\n"
fi
printf "\n\tChecking for SoftFloat\n"
if [ ! -d ${HOME}/opt/berkeley-softfloat-3 ]; then
# clone the library
cd ${TEMP_DIR}
mkdir softfloat
cd softfloat
git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-x86_64-GCC
make -j${CPU_CORE} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32"
if [ $? -ne 0 ]; then
printf "\tError compiling softfloat.\n"
printf "\tExiting now.\n\n"
exit;
fi
# no install target defined for this library
mkdir -p ${HOME}/opt/berkeley-softfloat-3
cp softfloat.a ${HOME}/opt/berkeley-softfloat-3/libsoftfloat.a
mv ${TEMP_DIR}/softfloat/berkeley-softfloat-3/source/include ${HOME}/opt/berkeley-softfloat-3/include
rm -rf ${TEMP_DIR}/softfloat
else
printf "\tsoftfloat found at /usr/local/berkeley-softfloat-3/\n"
fi
printf "\n\tChecking for LLVM with WASM support.\n"
if [ ! -d ${HOME}/opt/wasm/bin ]; then
# Build LLVM and clang with EXPERIMENTAL WASM support:
......
......@@ -239,29 +239,6 @@
printf "\tBinaryen found at ${HOME}/opt/binaryen\n"
fi
printf "\n\tChecking for SoftFloat\n"
if [ ! -d ${HOME}/opt/berkeley-softfloat-3 ]; then
# clone the library
cd ${TEMP_DIR}
mkdir softfloat
cd softfloat
git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-x86_64-GCC
make -j${CPU_CORE} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32"
if [ $? -ne 0 ]; then
printf "\tError compiling softfloat.\n"
printf "\tExiting now.\n\n"
exit;
fi
# no install target defined for this library
mkdir -p ${HOME}/opt/berkeley-softfloat-3
cp softfloat.a ${HOME}/opt/berkeley-softfloat-3/libsoftfloat.a
mv ${TEMP_DIR}/softfloat/berkeley-softfloat-3/source/include ${HOME}/opt/berkeley-softfloat-3/include
rm -rf ${TEMP_DIR}/softfloat
else
printf "\tsoftfloat found at /usr/local/berkeley-softfloat-3/\n"
fi
printf "\n\tChecking for LLVM with WASM support.\n"
if [ ! -d ${HOME}/opt/wasm/bin ]; then
# Build LLVM and clang with EXPERIMENTAL WASM support:
......
......@@ -255,30 +255,7 @@
else
printf "\tsecp256k1 found at /usr/local/lib/\n"
fi
printf "\n\tChecking for SoftFloat\n"
if [ ! -d /usr/local/berkeley-softfloat-3 ]; then
# clone the library
cd ${TEMP_DIR}
mkdir softfloat
cd softfloat
git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-x86_64-GCC
make -j${CPU_CORE} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32"
if [ $? -ne 0 ]; then
printf "\tError compiling softfloat.\n"
printf "\tExiting now.\n\n"
exit;
fi
# no install target defined for this library
sudo mkdir -p /usr/local/berkeley-softfloat-3
sudo cp softfloat.a /usr/local/berkeley-softfloat-3/libsoftfloat.a
sudo mv ${TEMP_DIR}/softfloat/berkeley-softfloat-3/source/include /usr/local/berkeley-softfloat-3/include
sudo rm -rf ${TEMP_DIR}/softfloat
else
printf "\tsoftfloat found at /usr/local/berkeley-softfloat-3/\n"
fi
printf "\n\tChecking for WASM\n"
if [ ! -d /usr/local/wasm/bin ]; then
# Build LLVM and clang for WASM:
......@@ -303,4 +280,4 @@
sudo rm -rf ${TEMP_DIR}/wasm-compiler
else
printf "\tWASM found at /usr/local/wasm/bin/\n"
fi
\ No newline at end of file
fi
......@@ -145,29 +145,6 @@
printf "\tsecp256k1 found\n"
fi
printf "\n\tChecking for SoftFloat\n"
if [ ! -d ${HOME}/opt/berkeley-softfloat-3 ]; then
# clone the library
cd ${TEMP_DIR}
mkdir softfloat
cd softfloat
git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-x86_64-GCC
make -j${CPU_CORE} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32"
if [ $? -ne 0 ]; then
printf "\tError compiling softfloat.\n"
printf "\tExiting now.\n\n"
exit;
fi
# no install target defined for this library
mkdir -p ${HOME}/opt/berkeley-softfloat-3
cp softfloat.a ${HOME}/opt/berkeley-softfloat-3/libsoftfloat.a
mv ${TEMP_DIR}/softfloat/berkeley-softfloat-3/source/include ${HOME}/opt/berkeley-softfloat-3/include
rm -rf ${TEMP_DIR}/softfloat
else
printf "\tsoftfloat found at /usr/local/berkeley-softfloat-3/\n"
fi
printf "\n\tChecking for LLVM with WASM support.\n"
if [ ! -d ${HOME}/opt/wasm/bin ]; then
# Build LLVM and clang with EXPERIMENTAL WASM support:
......
......@@ -205,29 +205,6 @@
printf "\tsecp256k1 found\n"
fi
printf "\n\tChecking for SoftFloat\n"
if [ ! -d ${HOME}/opt/berkeley-softfloat-3 ]; then
# clone the library
cd ${TEMP_DIR}
mkdir softfloat
cd softfloat
git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-x86_64-GCC
make -j${CPU_CORE} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32"
if [ $? -ne 0 ]; then
printf "\tError compiling softfloat.\n"
printf "\tExiting now.\n\n"
exit;
fi
# no install target defined for this library
mkdir -p ${HOME}/opt/berkeley-softfloat-3
cp softfloat.a ${HOME}/opt/berkeley-softfloat-3/libsoftfloat.a
mv ${TEMP_DIR}/softfloat/berkeley-softfloat-3/source/include ${HOME}/opt/berkeley-softfloat-3/include
rm -rf ${TEMP_DIR}/softfloat
else
printf "\tsoftfloat found at /usr/local/berkeley-softfloat-3/\n"
fi
printf "\n\tChecking for LLVM with WASM support.\n"
if [ ! -d ${HOME}/opt/wasm/bin ]; then
# Build LLVM and clang for WASM:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册