blob: f08a0225cd4d2f3c313aaed20c8f7fba674bf4e9 [file] [log] [blame]
# -*- mode:python -*-
# Copyright (c) 2020 StreamComputing Corp.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Kai Ren
import os
Import('main')
env = main.Clone()
if env['GCC']:
env.Append(CCFLAGS=['-Wno-unused-variable',
'-Wno-unused-label',
'-Wno-implicit-fallthrough',
'-g'])
elif env['CLANG']:
env.Append(CCFLAGS=['-Wno-unused-variable',
'-Wno-unused-label',
'-g'])
# Add the appropriate files for the library
softfloat_files = []
def SoftfloatFile(filename):
softfloat_files.append(File('./' + filename))
SoftfloatFile('f128_add.c')
SoftfloatFile('f128_classify.c')
SoftfloatFile('f128_div.c')
SoftfloatFile('f128_eq.c')
SoftfloatFile('f128_eq_signaling.c')
SoftfloatFile('f128_isSignalingNaN.c')
SoftfloatFile('f128_le.c')
SoftfloatFile('f128_le_quiet.c')
SoftfloatFile('f128_lt.c')
SoftfloatFile('f128_lt_quiet.c')
SoftfloatFile('f128_mulAdd.c')
SoftfloatFile('f128_mul.c')
SoftfloatFile('f128_rem.c')
SoftfloatFile('f128_roundToInt.c')
SoftfloatFile('f128_sqrt.c')
SoftfloatFile('f128_sub.c')
SoftfloatFile('f128_to_f16.c')
SoftfloatFile('f128_to_f32.c')
SoftfloatFile('f128_to_f64.c')
SoftfloatFile('f128_to_i32.c')
SoftfloatFile('f128_to_i32_r_minMag.c')
SoftfloatFile('f128_to_i64.c')
SoftfloatFile('f128_to_i64_r_minMag.c')
SoftfloatFile('f128_to_ui32.c')
SoftfloatFile('f128_to_ui32_r_minMag.c')
SoftfloatFile('f128_to_ui64.c')
SoftfloatFile('f128_to_ui64_r_minMag.c')
SoftfloatFile('f16_add.c')
SoftfloatFile('f16_div.c')
SoftfloatFile('f16_eq.c')
SoftfloatFile('f16_eq_signaling.c')
SoftfloatFile('f16_isSignalingNaN.c')
SoftfloatFile('f16_le.c')
SoftfloatFile('f16_le_quiet.c')
SoftfloatFile('f16_lt.c')
SoftfloatFile('f16_lt_quiet.c')
SoftfloatFile('f16_mulAdd.c')
SoftfloatFile('f16_mul.c')
SoftfloatFile('f16_rem.c')
SoftfloatFile('f16_roundToInt.c')
SoftfloatFile('f16_sqrt.c')
SoftfloatFile('f16_sub.c')
SoftfloatFile('f16_to_f128.c')
SoftfloatFile('f16_to_f32.c')
SoftfloatFile('f16_to_f64.c')
SoftfloatFile('f16_to_i32.c')
SoftfloatFile('f16_to_i32_r_minMag.c')
SoftfloatFile('f16_to_i64.c')
SoftfloatFile('f16_to_i64_r_minMag.c')
SoftfloatFile('f16_to_ui32.c')
SoftfloatFile('f16_to_ui32_r_minMag.c')
SoftfloatFile('f16_to_ui64.c')
SoftfloatFile('f16_to_ui64_r_minMag.c')
SoftfloatFile('f32_add.c')
SoftfloatFile('f32_classify.c')
SoftfloatFile('f32_div.c')
SoftfloatFile('f32_eq.c')
SoftfloatFile('f32_eq_signaling.c')
SoftfloatFile('f32_isSignalingNaN.c')
SoftfloatFile('f32_le.c')
SoftfloatFile('f32_le_quiet.c')
SoftfloatFile('f32_lt.c')
SoftfloatFile('f32_lt_quiet.c')
SoftfloatFile('f32_mulAdd.c')
SoftfloatFile('f32_mul.c')
SoftfloatFile('f32_rem.c')
SoftfloatFile('f32_roundToInt.c')
SoftfloatFile('f32_sqrt.c')
SoftfloatFile('f32_sub.c')
SoftfloatFile('f32_to_f128.c')
SoftfloatFile('f32_to_f16.c')
SoftfloatFile('f32_to_f64.c')
SoftfloatFile('f32_to_i32.c')
SoftfloatFile('f32_to_i32_r_minMag.c')
SoftfloatFile('f32_to_i64.c')
SoftfloatFile('f32_to_i64_r_minMag.c')
SoftfloatFile('f32_to_ui32.c')
SoftfloatFile('f32_to_ui32_r_minMag.c')
SoftfloatFile('f32_to_ui64.c')
SoftfloatFile('f32_to_ui64_r_minMag.c')
SoftfloatFile('f64_add.c')
SoftfloatFile('f64_classify.c')
SoftfloatFile('f64_div.c')
SoftfloatFile('f64_eq.c')
SoftfloatFile('f64_eq_signaling.c')
SoftfloatFile('f64_isSignalingNaN.c')
SoftfloatFile('f64_le.c')
SoftfloatFile('f64_le_quiet.c')
SoftfloatFile('f64_lt.c')
SoftfloatFile('f64_lt_quiet.c')
SoftfloatFile('f64_mulAdd.c')
SoftfloatFile('f64_mul.c')
SoftfloatFile('f64_rem.c')
SoftfloatFile('f64_roundToInt.c')
SoftfloatFile('f64_sqrt.c')
SoftfloatFile('f64_sub.c')
SoftfloatFile('f64_to_f128.c')
SoftfloatFile('f64_to_f16.c')
SoftfloatFile('f64_to_f32.c')
SoftfloatFile('f64_to_i32.c')
SoftfloatFile('f64_to_i32_r_minMag.c')
SoftfloatFile('f64_to_i64.c')
SoftfloatFile('f64_to_i64_r_minMag.c')
SoftfloatFile('f64_to_ui32.c')
SoftfloatFile('f64_to_ui32_r_minMag.c')
SoftfloatFile('f64_to_ui64.c')
SoftfloatFile('f64_to_ui64_r_minMag.c')
SoftfloatFile('i32_to_f128.c')
SoftfloatFile('i32_to_f16.c')
SoftfloatFile('i32_to_f32.c')
SoftfloatFile('i32_to_f64.c')
SoftfloatFile('i64_to_f128.c')
SoftfloatFile('i64_to_f16.c')
SoftfloatFile('i64_to_f32.c')
SoftfloatFile('i64_to_f64.c')
SoftfloatFile('s_add128.c')
SoftfloatFile('s_add256M.c')
SoftfloatFile('s_addCarryM.c')
SoftfloatFile('s_addComplCarryM.c')
SoftfloatFile('s_addMagsF128.c')
SoftfloatFile('s_addMagsF16.c')
SoftfloatFile('s_addMagsF32.c')
SoftfloatFile('s_addMagsF64.c')
SoftfloatFile('s_addM.c')
SoftfloatFile('s_approxRecip_1Ks.c')
SoftfloatFile('s_approxRecip32_1.c')
SoftfloatFile('s_approxRecipSqrt_1Ks.c')
SoftfloatFile('s_approxRecipSqrt32_1.c')
SoftfloatFile('s_commonNaNToF128UI.c')
SoftfloatFile('s_commonNaNToF16UI.c')
SoftfloatFile('s_commonNaNToF32UI.c')
SoftfloatFile('s_commonNaNToF64UI.c')
SoftfloatFile('s_compare128M.c')
SoftfloatFile('s_compare96M.c')
SoftfloatFile('s_countLeadingZeros16.c')
SoftfloatFile('s_countLeadingZeros32.c')
SoftfloatFile('s_countLeadingZeros64.c')
SoftfloatFile('s_countLeadingZeros8.c')
SoftfloatFile('s_eq128.c')
SoftfloatFile('s_f128UIToCommonNaN.c')
SoftfloatFile('s_f16UIToCommonNaN.c')
SoftfloatFile('s_f32UIToCommonNaN.c')
SoftfloatFile('s_f64UIToCommonNaN.c')
SoftfloatFile('s_le128.c')
SoftfloatFile('s_lt128.c')
SoftfloatFile('s_mul128By32.c')
SoftfloatFile('s_mul128MTo256M.c')
SoftfloatFile('s_mul128To256M.c')
SoftfloatFile('s_mul64ByShifted32To128.c')
SoftfloatFile('s_mul64To128.c')
SoftfloatFile('s_mul64To128M.c')
SoftfloatFile('s_mulAddF128.c')
SoftfloatFile('s_mulAddF16.c')
SoftfloatFile('s_mulAddF32.c')
SoftfloatFile('s_mulAddF64.c')
SoftfloatFile('s_negXM.c')
SoftfloatFile('s_normRoundPackToF128.c')
SoftfloatFile('s_normRoundPackToF16.c')
SoftfloatFile('s_normRoundPackToF32.c')
SoftfloatFile('s_normRoundPackToF64.c')
SoftfloatFile('s_normSubnormalF128Sig.c')
SoftfloatFile('s_normSubnormalF16Sig.c')
SoftfloatFile('s_normSubnormalF32Sig.c')
SoftfloatFile('s_normSubnormalF64Sig.c')
SoftfloatFile('softfloat_raiseFlags.c')
SoftfloatFile('softfloat_state.c')
SoftfloatFile('s_propagateNaNF128UI.c')
SoftfloatFile('s_propagateNaNF16UI.c')
SoftfloatFile('s_propagateNaNF32UI.c')
SoftfloatFile('s_propagateNaNF64UI.c')
SoftfloatFile('s_remStepMBy32.c')
SoftfloatFile('s_roundMToI64.c')
SoftfloatFile('s_roundMToUI64.c')
SoftfloatFile('s_roundPackMToI64.c')
SoftfloatFile('s_roundPackMToUI64.c')
SoftfloatFile('s_roundPackToF128.c')
SoftfloatFile('s_roundPackToF16.c')
SoftfloatFile('s_roundPackToF32.c')
SoftfloatFile('s_roundPackToF64.c')
SoftfloatFile('s_roundPackToI32.c')
SoftfloatFile('s_roundPackToI64.c')
SoftfloatFile('s_roundPackToUI32.c')
SoftfloatFile('s_roundPackToUI64.c')
SoftfloatFile('s_roundToI32.c')
SoftfloatFile('s_roundToI64.c')
SoftfloatFile('s_roundToUI32.c')
SoftfloatFile('s_roundToUI64.c')
SoftfloatFile('s_shiftRightJam128.c')
SoftfloatFile('s_shiftRightJam128Extra.c')
SoftfloatFile('s_shiftRightJam256M.c')
SoftfloatFile('s_shiftRightJam32.c')
SoftfloatFile('s_shiftRightJam64.c')
SoftfloatFile('s_shiftRightJam64Extra.c')
SoftfloatFile('s_shortShiftLeft128.c')
SoftfloatFile('s_shortShiftLeft64To96M.c')
SoftfloatFile('s_shortShiftRight128.c')
SoftfloatFile('s_shortShiftRightExtendM.c')
SoftfloatFile('s_shortShiftRightJam128.c')
SoftfloatFile('s_shortShiftRightJam128Extra.c')
SoftfloatFile('s_shortShiftRightJam64.c')
SoftfloatFile('s_shortShiftRightJam64Extra.c')
SoftfloatFile('s_shortShiftRightM.c')
SoftfloatFile('s_sub128.c')
SoftfloatFile('s_sub1XM.c')
SoftfloatFile('s_sub256M.c')
SoftfloatFile('s_subMagsF128.c')
SoftfloatFile('s_subMagsF16.c')
SoftfloatFile('s_subMagsF32.c')
SoftfloatFile('s_subMagsF64.c')
SoftfloatFile('s_subM.c')
SoftfloatFile('ui32_to_f128.c')
SoftfloatFile('ui32_to_f16.c')
SoftfloatFile('ui32_to_f32.c')
SoftfloatFile('ui32_to_f64.c')
SoftfloatFile('ui64_to_f128.c')
SoftfloatFile('ui64_to_f16.c')
SoftfloatFile('ui64_to_f32.c')
SoftfloatFile('ui64_to_f64.c')
env.Library('softfloat', [env.SharedObject(f) for f in softfloat_files])
main.Prepend(CPPPATH=Dir('./'))
main.Append(LIBS=['softfloat'])
main.Prepend(LIBPATH=[Dir('.')])