Files
gem5/ext/softfloat/SConscript
Alex Richardson 5e096f5b5d scons: allow building without duplicating source files
This adds a new scons flag --no-duplicate-sources to build without
linking source files to the build directory.

I find this very helpful when using CLion, since I can now generate a
compilation database using
`bear scons build/ALL/gem5.debug --no-duplicate-sources` and CLion will
now correctly semantically analyze all the files inside src/.
It also ensures that clicking on a build warning/error now opens the
real source file rather than a symlink.

This is not enabled by default since it's possible that certain use
cases are not working correctly, but the basic testing I've done so
far appears to work just fine.

It appears that with this change the `<root>/src` directory is no longer
added to `PYTHONPATH` when running `tests/main.py`, so this change
depends on https://gem5-review.git.corp.google.com/c/public/gem5/+/68757

Change-Id: Iddc9bf9c8211e68e5432c0a07f5c95f427c1ca16
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68518
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-04-05 22:00:07 +00:00

426 lines
15 KiB
Python

# -*- 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('env')
# You can change it to undefine SOFTFLOAT_FAST_INT64
use_fast_int64 = True
sf_env = env.Clone()
if sf_env['GCC']:
sf_env.Append(CCFLAGS=['-Wno-unused-variable',
'-Wno-unused-label',
'-Wno-implicit-fallthrough',
'-Wno-implicit-function-declaration',
'-g'])
elif sf_env['CLANG']:
sf_env.Append(CCFLAGS=['-Wno-unused-variable',
'-Wno-unused-label',
'-Wno-implicit-function-declaration',
'-g'])
if use_fast_int64:
sf_env.Prepend(CXXFLAGS=['-DSOFTFLOAT_FAST_INT64'])
sf_env.Prepend(CFLAGS=['-DSOFTFLOAT_FAST_INT64'])
# Add the appropriate files for the library
softfloat_files = []
def SoftfloatFile(filename):
softfloat_files.append(File('./' + filename))
SoftfloatFile('f16_add.c')
SoftfloatFile('f16_classify.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_f32.c')
SoftfloatFile('f16_to_f64.c')
SoftfloatFile('f16_to_i16.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_i8.c')
SoftfloatFile('f16_to_ui16.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('f16_to_ui8.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_f16.c')
SoftfloatFile('f32_to_f64.c')
SoftfloatFile('f32_to_i16.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_ui16.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('f16_to_extF80M.c')
SoftfloatFile('f16_to_f128M.c')
SoftfloatFile('f32_to_extF80M.c')
SoftfloatFile('f32_to_f128M.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_extF80M.c')
SoftfloatFile('f64_to_f128M.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('fall_maxmin.c')
SoftfloatFile('fall_reciprocal.c')
SoftfloatFile('i32_to_extF80M.c')
SoftfloatFile('i32_to_f128M.c')
SoftfloatFile('i32_to_f16.c')
SoftfloatFile('i32_to_f32.c')
SoftfloatFile('i32_to_f64.c')
SoftfloatFile('i64_to_extF80M.c')
SoftfloatFile('i64_to_f128M.c')
SoftfloatFile('i64_to_f16.c')
SoftfloatFile('i64_to_f32.c')
SoftfloatFile('i64_to_f64.c')
SoftfloatFile('s_addMagsF16.c')
SoftfloatFile('s_addMagsF32.c')
SoftfloatFile('s_addMagsF64.c')
SoftfloatFile('s_approxRecip_1Ks.c')
SoftfloatFile('s_approxRecip32_1.c')
SoftfloatFile('s_approxRecipSqrt_1Ks.c')
SoftfloatFile('s_approxRecipSqrt32_1.c')
SoftfloatFile('s_commonNaNToF16UI.c')
SoftfloatFile('s_commonNaNToF32UI.c')
SoftfloatFile('s_commonNaNToF64UI.c')
SoftfloatFile('s_countLeadingZeros16.c')
SoftfloatFile('s_countLeadingZeros32.c')
SoftfloatFile('s_countLeadingZeros64.c')
SoftfloatFile('s_countLeadingZeros8.c')
SoftfloatFile('s_f128UIToCommonNaN.c')
SoftfloatFile('s_f16UIToCommonNaN.c')
SoftfloatFile('s_f32UIToCommonNaN.c')
SoftfloatFile('s_f64UIToCommonNaN.c')
SoftfloatFile('s_mulAddF16.c')
SoftfloatFile('s_mulAddF32.c')
SoftfloatFile('s_mulAddF64.c')
SoftfloatFile('s_normRoundPackToF16.c')
SoftfloatFile('s_normRoundPackToF32.c')
SoftfloatFile('s_normRoundPackToF64.c')
SoftfloatFile('s_normSubnormalF16Sig.c')
SoftfloatFile('s_normSubnormalF32Sig.c')
SoftfloatFile('s_normSubnormalF64Sig.c')
SoftfloatFile('s_propagateNaNF16UI.c')
SoftfloatFile('s_propagateNaNF32UI.c')
SoftfloatFile('s_propagateNaNF64UI.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_shiftRightJam32.c')
SoftfloatFile('s_shiftRightJam64.c')
SoftfloatFile('s_shortShiftRightExtendM.c')
SoftfloatFile('s_shortShiftRightJam64.c')
SoftfloatFile('s_subMagsF16.c')
SoftfloatFile('s_subMagsF32.c')
SoftfloatFile('s_subMagsF64.c')
SoftfloatFile('softfloat_raiseFlags.c')
SoftfloatFile('softfloat_state.c')
SoftfloatFile('ui32_to_f16.c')
SoftfloatFile('ui32_to_f32.c')
SoftfloatFile('ui32_to_f64.c')
SoftfloatFile('ui64_to_f16.c')
SoftfloatFile('ui64_to_f32.c')
SoftfloatFile('ui64_to_f64.c')
if use_fast_int64:
SoftfloatFile('extF80_add.c')
SoftfloatFile('extF80_div.c')
SoftfloatFile('extF80_eq.c')
SoftfloatFile('extF80_eq_signaling.c')
SoftfloatFile('extF80_isSignalingNaN.c')
SoftfloatFile('extF80_le.c')
SoftfloatFile('extF80_le_quiet.c')
SoftfloatFile('extF80_lt.c')
SoftfloatFile('extF80_lt_quiet.c')
SoftfloatFile('extF80_mul.c')
SoftfloatFile('extF80_rem.c')
SoftfloatFile('extF80_roundToInt.c')
SoftfloatFile('extF80_sqrt.c')
SoftfloatFile('extF80_sub.c')
SoftfloatFile('extF80_to_f128.c')
SoftfloatFile('extF80_to_f16.c')
SoftfloatFile('extF80_to_f32.c')
SoftfloatFile('extF80_to_f64.c')
SoftfloatFile('extF80_to_i32.c')
SoftfloatFile('extF80_to_i32_r_minMag.c')
SoftfloatFile('extF80_to_i64.c')
SoftfloatFile('extF80_to_i64_r_minMag.c')
SoftfloatFile('extF80_to_ui32.c')
SoftfloatFile('extF80_to_ui32_r_minMag.c')
SoftfloatFile('extF80_to_ui64.c')
SoftfloatFile('extF80_to_ui64_r_minMag.c')
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_extF80.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_to_extF80.c')
SoftfloatFile('f16_to_f128.c')
SoftfloatFile('f32_to_extF80.c')
SoftfloatFile('f32_to_f128.c')
SoftfloatFile('f64_to_extF80.c')
SoftfloatFile('f64_to_f128.c')
SoftfloatFile('i32_to_extF80.c')
SoftfloatFile('i32_to_f128.c')
SoftfloatFile('i64_to_extF80.c')
SoftfloatFile('i64_to_f128.c')
SoftfloatFile('s_addMagsExtF80.c')
SoftfloatFile('s_addMagsF128.c')
SoftfloatFile('s_add128.c')
SoftfloatFile('s_add256M.c')
SoftfloatFile('s_commonNaNToF128UI.c')
SoftfloatFile('s_eq128.c')
SoftfloatFile('s_le128.c')
SoftfloatFile('s_lt128.c')
SoftfloatFile('s_mulAddF128.c')
SoftfloatFile('s_mul64ByShifted32To128.c')
SoftfloatFile('s_mul64To128.c')
SoftfloatFile('s_mul128By32.c')
SoftfloatFile('s_mul128To256M.c')
SoftfloatFile('s_normRoundPackToExtF80.c')
SoftfloatFile('s_normRoundPackToF128.c')
SoftfloatFile('s_normSubnormalExtF80Sig.c')
SoftfloatFile('s_normSubnormalF128Sig.c')
SoftfloatFile('s_propagateNaNF128UI.c')
SoftfloatFile('s_roundPackToExtF80.c')
SoftfloatFile('s_roundPackToF128.c')
SoftfloatFile('s_roundToUI64.c')
SoftfloatFile('s_shiftRightJam128.c')
SoftfloatFile('s_shiftRightJam128Extra.c')
SoftfloatFile('s_shiftRightJam256M.c')
SoftfloatFile('s_shiftRightJam64Extra.c')
SoftfloatFile('s_shortShiftLeft128.c')
SoftfloatFile('s_shortShiftRight128.c')
SoftfloatFile('s_shortShiftRightJam64Extra.c')
SoftfloatFile('s_shortShiftRightJam128.c')
SoftfloatFile('s_shortShiftRightJam128Extra.c')
SoftfloatFile('s_subMagsExtF80.c')
SoftfloatFile('s_subMagsF128.c')
SoftfloatFile('s_sub128.c')
SoftfloatFile('s_sub256M.c')
SoftfloatFile('ui32_to_extF80.c')
SoftfloatFile('ui32_to_f128.c')
SoftfloatFile('ui64_to_extF80.c')
SoftfloatFile('ui64_to_f128.c')
else:
SoftfloatFile('extF80M_add.c')
SoftfloatFile('extF80M_div.c')
SoftfloatFile('extF80M_eq.c')
SoftfloatFile('extF80M_eq_signaling.c')
SoftfloatFile('extF80M_le.c')
SoftfloatFile('extF80M_le_quiet.c')
SoftfloatFile('extF80M_lt.c')
SoftfloatFile('extF80M_lt_quiet.c')
SoftfloatFile('extF80M_mul.c')
SoftfloatFile('extF80M_rem.c')
SoftfloatFile('extF80M_roundToInt.c')
SoftfloatFile('extF80M_sqrt.c')
SoftfloatFile('extF80M_sub.c')
SoftfloatFile('extF80M_to_f128M.c')
SoftfloatFile('extF80M_to_f16.c')
SoftfloatFile('extF80M_to_f32.c')
SoftfloatFile('extF80M_to_f64.c')
SoftfloatFile('extF80M_to_i32.c')
SoftfloatFile('extF80M_to_i32_r_minMag.c')
SoftfloatFile('extF80M_to_i64.c')
SoftfloatFile('extF80M_to_i64_r_minMag.c')
SoftfloatFile('extF80M_to_ui32.c')
SoftfloatFile('extF80M_to_ui32_r_minMag.c')
SoftfloatFile('extF80M_to_ui64.c')
SoftfloatFile('extF80M_to_ui64_r_minMag.c')
SoftfloatFile('f128M_add.c')
SoftfloatFile('f128M_div.c')
SoftfloatFile('f128M_eq.c')
SoftfloatFile('f128M_eq_signaling.c')
SoftfloatFile('f128M_le.c')
SoftfloatFile('f128M_le_quiet.c')
SoftfloatFile('f128M_lt.c')
SoftfloatFile('f128M_lt_quiet.c')
SoftfloatFile('f128M_mulAdd.c')
SoftfloatFile('f128M_mul.c')
SoftfloatFile('f128M_rem.c')
SoftfloatFile('f128M_roundToInt.c')
SoftfloatFile('f128M_sqrt.c')
SoftfloatFile('f128M_sub.c')
SoftfloatFile('f128M_to_extF80M.c')
SoftfloatFile('f128M_to_f16.c')
SoftfloatFile('f128M_to_f32.c')
SoftfloatFile('f128M_to_f64.c')
SoftfloatFile('f128M_to_i32.c')
SoftfloatFile('f128M_to_i32_r_minMag.c')
SoftfloatFile('f128M_to_i64.c')
SoftfloatFile('f128M_to_i64_r_minMag.c')
SoftfloatFile('f128M_to_ui32.c')
SoftfloatFile('f128M_to_ui32_r_minMag.c')
SoftfloatFile('f128M_to_ui64.c')
SoftfloatFile('f128M_to_ui64_r_minMag.c')
SoftfloatFile('s_addM.c')
SoftfloatFile('s_addCarryM.c')
SoftfloatFile('s_addComplCarryM.c')
SoftfloatFile('s_addExtF80M.c')
SoftfloatFile('s_addF128M.c')
SoftfloatFile('s_compareNonnormExtF80M.c')
SoftfloatFile('s_compare128M.c')
SoftfloatFile('s_compare96M.c')
SoftfloatFile('s_invalidExtF80M.c')
SoftfloatFile('s_invalidF128M.c')
SoftfloatFile('s_isNaNF128M.c')
SoftfloatFile('s_mulAddF128M.c')
SoftfloatFile('s_mul128MTo256M.c')
SoftfloatFile('s_mul64To128M.c')
SoftfloatFile('s_negXM.c')
SoftfloatFile('s_normExtF80SigM.c')
SoftfloatFile('s_normRoundPackMToExtF80M.c')
SoftfloatFile('s_normRoundPackMToF128M.c')
SoftfloatFile('s_normSubnormalF128SigM.c')
SoftfloatFile('s_remStepMBy32.c')
SoftfloatFile('s_roundMToI64.c')
SoftfloatFile('s_roundMToUI64.c')
SoftfloatFile('s_roundPackMToExtF80M.c')
SoftfloatFile('s_roundPackMToF128M.c')
SoftfloatFile('s_roundPackMToI64.c')
SoftfloatFile('s_roundPackMToUI64.c')
SoftfloatFile('s_shiftLeftM.c')
SoftfloatFile('s_shiftNormSigF128M.c')
SoftfloatFile('s_shiftRightJamM.c')
SoftfloatFile('s_shiftRightM.c')
SoftfloatFile('s_shortShiftLeftM.c')
SoftfloatFile('s_shortShiftLeft64To96M.c')
SoftfloatFile('s_shortShiftRightJamM.c')
SoftfloatFile('s_shortShiftRightM.c')
SoftfloatFile('s_subM.c')
SoftfloatFile('s_sub1XM.c')
SoftfloatFile('s_tryPropagateNaNExtF80M.c')
SoftfloatFile('s_tryPropagateNaNF128M.c')
SoftfloatFile('ui32_to_extF80M.c')
SoftfloatFile('ui32_to_f128M.c')
SoftfloatFile('ui64_to_extF80M.c')
SoftfloatFile('ui64_to_f128M.c')
sf_env.Library('softfloat', [sf_env.SharedObject(f) for f in softfloat_files])
env.Prepend(CPPPATH=Dir('.').srcnode())
env.Append(LIBS=['softfloat'])
env.Prepend(LIBPATH=[Dir('.')])