kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 1 | |
| 2 | # -*- mode:python -*- |
| 3 | |
| 4 | # Copyright (c) 2020 StreamComputing Corp. |
| 5 | # All rights reserved. |
| 6 | # |
| 7 | # Redistribution and use in source and binary forms, with or without |
| 8 | # modification, are permitted provided that the following conditions are |
| 9 | # met: redistributions of source code must retain the above copyright |
| 10 | # notice, this list of conditions and the following disclaimer; |
| 11 | # redistributions in binary form must reproduce the above copyright |
| 12 | # notice, this list of conditions and the following disclaimer in the |
| 13 | # documentation and/or other materials provided with the distribution; |
| 14 | # neither the name of the copyright holders nor the names of its |
| 15 | # contributors may be used to endorse or promote products derived from |
| 16 | # this software without specific prior written permission. |
| 17 | # |
| 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | # |
| 30 | # Authors: Kai Ren |
| 31 | |
| 32 | import os |
| 33 | |
Gabe Black | 64d1297 | 2022-02-10 21:52:51 -0800 | [diff] [blame] | 34 | Import('env') |
kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 35 | |
Gabe Black | 64d1297 | 2022-02-10 21:52:51 -0800 | [diff] [blame] | 36 | sf_env = env.Clone() |
| 37 | if sf_env['GCC']: |
| 38 | sf_env.Append(CCFLAGS=['-Wno-unused-variable', |
| 39 | '-Wno-unused-label', |
| 40 | '-Wno-implicit-fallthrough', |
| 41 | '-g']) |
kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 42 | |
Gabe Black | 64d1297 | 2022-02-10 21:52:51 -0800 | [diff] [blame] | 43 | elif sf_env['CLANG']: |
| 44 | sf_env.Append(CCFLAGS=['-Wno-unused-variable', |
| 45 | '-Wno-unused-label', |
| 46 | '-g']) |
kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 47 | |
| 48 | # Add the appropriate files for the library |
| 49 | softfloat_files = [] |
| 50 | |
| 51 | |
| 52 | def SoftfloatFile(filename): |
| 53 | softfloat_files.append(File('./' + filename)) |
| 54 | |
| 55 | SoftfloatFile('f128_add.c') |
| 56 | SoftfloatFile('f128_classify.c') |
| 57 | SoftfloatFile('f128_div.c') |
| 58 | SoftfloatFile('f128_eq.c') |
| 59 | SoftfloatFile('f128_eq_signaling.c') |
| 60 | SoftfloatFile('f128_isSignalingNaN.c') |
| 61 | SoftfloatFile('f128_le.c') |
| 62 | SoftfloatFile('f128_le_quiet.c') |
| 63 | SoftfloatFile('f128_lt.c') |
| 64 | SoftfloatFile('f128_lt_quiet.c') |
| 65 | SoftfloatFile('f128_mulAdd.c') |
| 66 | SoftfloatFile('f128_mul.c') |
| 67 | SoftfloatFile('f128_rem.c') |
| 68 | SoftfloatFile('f128_roundToInt.c') |
| 69 | SoftfloatFile('f128_sqrt.c') |
| 70 | SoftfloatFile('f128_sub.c') |
| 71 | SoftfloatFile('f128_to_f16.c') |
| 72 | SoftfloatFile('f128_to_f32.c') |
| 73 | SoftfloatFile('f128_to_f64.c') |
| 74 | SoftfloatFile('f128_to_i32.c') |
| 75 | SoftfloatFile('f128_to_i32_r_minMag.c') |
| 76 | SoftfloatFile('f128_to_i64.c') |
| 77 | SoftfloatFile('f128_to_i64_r_minMag.c') |
| 78 | SoftfloatFile('f128_to_ui32.c') |
| 79 | SoftfloatFile('f128_to_ui32_r_minMag.c') |
| 80 | SoftfloatFile('f128_to_ui64.c') |
| 81 | SoftfloatFile('f128_to_ui64_r_minMag.c') |
| 82 | SoftfloatFile('f16_add.c') |
ksco | 53009f9 | 2022-05-26 02:57:50 +0800 | [diff] [blame] | 83 | SoftfloatFile('f16_classify.c') |
kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 84 | SoftfloatFile('f16_div.c') |
| 85 | SoftfloatFile('f16_eq.c') |
| 86 | SoftfloatFile('f16_eq_signaling.c') |
| 87 | SoftfloatFile('f16_isSignalingNaN.c') |
| 88 | SoftfloatFile('f16_le.c') |
| 89 | SoftfloatFile('f16_le_quiet.c') |
| 90 | SoftfloatFile('f16_lt.c') |
| 91 | SoftfloatFile('f16_lt_quiet.c') |
| 92 | SoftfloatFile('f16_mulAdd.c') |
| 93 | SoftfloatFile('f16_mul.c') |
| 94 | SoftfloatFile('f16_rem.c') |
| 95 | SoftfloatFile('f16_roundToInt.c') |
| 96 | SoftfloatFile('f16_sqrt.c') |
| 97 | SoftfloatFile('f16_sub.c') |
| 98 | SoftfloatFile('f16_to_f128.c') |
| 99 | SoftfloatFile('f16_to_f32.c') |
| 100 | SoftfloatFile('f16_to_f64.c') |
| 101 | SoftfloatFile('f16_to_i32.c') |
| 102 | SoftfloatFile('f16_to_i32_r_minMag.c') |
| 103 | SoftfloatFile('f16_to_i64.c') |
| 104 | SoftfloatFile('f16_to_i64_r_minMag.c') |
| 105 | SoftfloatFile('f16_to_ui32.c') |
| 106 | SoftfloatFile('f16_to_ui32_r_minMag.c') |
| 107 | SoftfloatFile('f16_to_ui64.c') |
| 108 | SoftfloatFile('f16_to_ui64_r_minMag.c') |
| 109 | SoftfloatFile('f32_add.c') |
| 110 | SoftfloatFile('f32_classify.c') |
| 111 | SoftfloatFile('f32_div.c') |
| 112 | SoftfloatFile('f32_eq.c') |
| 113 | SoftfloatFile('f32_eq_signaling.c') |
| 114 | SoftfloatFile('f32_isSignalingNaN.c') |
| 115 | SoftfloatFile('f32_le.c') |
| 116 | SoftfloatFile('f32_le_quiet.c') |
| 117 | SoftfloatFile('f32_lt.c') |
| 118 | SoftfloatFile('f32_lt_quiet.c') |
| 119 | SoftfloatFile('f32_mulAdd.c') |
| 120 | SoftfloatFile('f32_mul.c') |
| 121 | SoftfloatFile('f32_rem.c') |
| 122 | SoftfloatFile('f32_roundToInt.c') |
| 123 | SoftfloatFile('f32_sqrt.c') |
| 124 | SoftfloatFile('f32_sub.c') |
| 125 | SoftfloatFile('f32_to_f128.c') |
| 126 | SoftfloatFile('f32_to_f16.c') |
| 127 | SoftfloatFile('f32_to_f64.c') |
| 128 | SoftfloatFile('f32_to_i32.c') |
| 129 | SoftfloatFile('f32_to_i32_r_minMag.c') |
| 130 | SoftfloatFile('f32_to_i64.c') |
| 131 | SoftfloatFile('f32_to_i64_r_minMag.c') |
| 132 | SoftfloatFile('f32_to_ui32.c') |
| 133 | SoftfloatFile('f32_to_ui32_r_minMag.c') |
| 134 | SoftfloatFile('f32_to_ui64.c') |
| 135 | SoftfloatFile('f32_to_ui64_r_minMag.c') |
| 136 | SoftfloatFile('f64_add.c') |
| 137 | SoftfloatFile('f64_classify.c') |
| 138 | SoftfloatFile('f64_div.c') |
| 139 | SoftfloatFile('f64_eq.c') |
| 140 | SoftfloatFile('f64_eq_signaling.c') |
| 141 | SoftfloatFile('f64_isSignalingNaN.c') |
| 142 | SoftfloatFile('f64_le.c') |
| 143 | SoftfloatFile('f64_le_quiet.c') |
| 144 | SoftfloatFile('f64_lt.c') |
| 145 | SoftfloatFile('f64_lt_quiet.c') |
| 146 | SoftfloatFile('f64_mulAdd.c') |
| 147 | SoftfloatFile('f64_mul.c') |
| 148 | SoftfloatFile('f64_rem.c') |
| 149 | SoftfloatFile('f64_roundToInt.c') |
| 150 | SoftfloatFile('f64_sqrt.c') |
| 151 | SoftfloatFile('f64_sub.c') |
| 152 | SoftfloatFile('f64_to_f128.c') |
| 153 | SoftfloatFile('f64_to_f16.c') |
| 154 | SoftfloatFile('f64_to_f32.c') |
| 155 | SoftfloatFile('f64_to_i32.c') |
| 156 | SoftfloatFile('f64_to_i32_r_minMag.c') |
| 157 | SoftfloatFile('f64_to_i64.c') |
| 158 | SoftfloatFile('f64_to_i64_r_minMag.c') |
| 159 | SoftfloatFile('f64_to_ui32.c') |
| 160 | SoftfloatFile('f64_to_ui32_r_minMag.c') |
| 161 | SoftfloatFile('f64_to_ui64.c') |
| 162 | SoftfloatFile('f64_to_ui64_r_minMag.c') |
| 163 | SoftfloatFile('i32_to_f128.c') |
| 164 | SoftfloatFile('i32_to_f16.c') |
| 165 | SoftfloatFile('i32_to_f32.c') |
| 166 | SoftfloatFile('i32_to_f64.c') |
| 167 | SoftfloatFile('i64_to_f128.c') |
| 168 | SoftfloatFile('i64_to_f16.c') |
| 169 | SoftfloatFile('i64_to_f32.c') |
| 170 | SoftfloatFile('i64_to_f64.c') |
| 171 | SoftfloatFile('s_add128.c') |
| 172 | SoftfloatFile('s_add256M.c') |
| 173 | SoftfloatFile('s_addCarryM.c') |
| 174 | SoftfloatFile('s_addComplCarryM.c') |
| 175 | SoftfloatFile('s_addMagsF128.c') |
| 176 | SoftfloatFile('s_addMagsF16.c') |
| 177 | SoftfloatFile('s_addMagsF32.c') |
| 178 | SoftfloatFile('s_addMagsF64.c') |
| 179 | SoftfloatFile('s_addM.c') |
| 180 | SoftfloatFile('s_approxRecip_1Ks.c') |
| 181 | SoftfloatFile('s_approxRecip32_1.c') |
| 182 | SoftfloatFile('s_approxRecipSqrt_1Ks.c') |
| 183 | SoftfloatFile('s_approxRecipSqrt32_1.c') |
| 184 | SoftfloatFile('s_commonNaNToF128UI.c') |
| 185 | SoftfloatFile('s_commonNaNToF16UI.c') |
| 186 | SoftfloatFile('s_commonNaNToF32UI.c') |
| 187 | SoftfloatFile('s_commonNaNToF64UI.c') |
| 188 | SoftfloatFile('s_compare128M.c') |
| 189 | SoftfloatFile('s_compare96M.c') |
| 190 | SoftfloatFile('s_countLeadingZeros16.c') |
| 191 | SoftfloatFile('s_countLeadingZeros32.c') |
| 192 | SoftfloatFile('s_countLeadingZeros64.c') |
| 193 | SoftfloatFile('s_countLeadingZeros8.c') |
| 194 | SoftfloatFile('s_eq128.c') |
| 195 | SoftfloatFile('s_f128UIToCommonNaN.c') |
| 196 | SoftfloatFile('s_f16UIToCommonNaN.c') |
| 197 | SoftfloatFile('s_f32UIToCommonNaN.c') |
| 198 | SoftfloatFile('s_f64UIToCommonNaN.c') |
| 199 | SoftfloatFile('s_le128.c') |
| 200 | SoftfloatFile('s_lt128.c') |
| 201 | SoftfloatFile('s_mul128By32.c') |
| 202 | SoftfloatFile('s_mul128MTo256M.c') |
| 203 | SoftfloatFile('s_mul128To256M.c') |
| 204 | SoftfloatFile('s_mul64ByShifted32To128.c') |
| 205 | SoftfloatFile('s_mul64To128.c') |
| 206 | SoftfloatFile('s_mul64To128M.c') |
| 207 | SoftfloatFile('s_mulAddF128.c') |
| 208 | SoftfloatFile('s_mulAddF16.c') |
| 209 | SoftfloatFile('s_mulAddF32.c') |
| 210 | SoftfloatFile('s_mulAddF64.c') |
| 211 | SoftfloatFile('s_negXM.c') |
| 212 | SoftfloatFile('s_normRoundPackToF128.c') |
| 213 | SoftfloatFile('s_normRoundPackToF16.c') |
| 214 | SoftfloatFile('s_normRoundPackToF32.c') |
| 215 | SoftfloatFile('s_normRoundPackToF64.c') |
| 216 | SoftfloatFile('s_normSubnormalF128Sig.c') |
| 217 | SoftfloatFile('s_normSubnormalF16Sig.c') |
| 218 | SoftfloatFile('s_normSubnormalF32Sig.c') |
| 219 | SoftfloatFile('s_normSubnormalF64Sig.c') |
| 220 | SoftfloatFile('softfloat_raiseFlags.c') |
| 221 | SoftfloatFile('softfloat_state.c') |
| 222 | SoftfloatFile('s_propagateNaNF128UI.c') |
| 223 | SoftfloatFile('s_propagateNaNF16UI.c') |
| 224 | SoftfloatFile('s_propagateNaNF32UI.c') |
| 225 | SoftfloatFile('s_propagateNaNF64UI.c') |
| 226 | SoftfloatFile('s_remStepMBy32.c') |
| 227 | SoftfloatFile('s_roundMToI64.c') |
| 228 | SoftfloatFile('s_roundMToUI64.c') |
| 229 | SoftfloatFile('s_roundPackMToI64.c') |
| 230 | SoftfloatFile('s_roundPackMToUI64.c') |
| 231 | SoftfloatFile('s_roundPackToF128.c') |
| 232 | SoftfloatFile('s_roundPackToF16.c') |
| 233 | SoftfloatFile('s_roundPackToF32.c') |
| 234 | SoftfloatFile('s_roundPackToF64.c') |
| 235 | SoftfloatFile('s_roundPackToI32.c') |
| 236 | SoftfloatFile('s_roundPackToI64.c') |
| 237 | SoftfloatFile('s_roundPackToUI32.c') |
| 238 | SoftfloatFile('s_roundPackToUI64.c') |
| 239 | SoftfloatFile('s_roundToI32.c') |
| 240 | SoftfloatFile('s_roundToI64.c') |
| 241 | SoftfloatFile('s_roundToUI32.c') |
| 242 | SoftfloatFile('s_roundToUI64.c') |
| 243 | SoftfloatFile('s_shiftRightJam128.c') |
| 244 | SoftfloatFile('s_shiftRightJam128Extra.c') |
| 245 | SoftfloatFile('s_shiftRightJam256M.c') |
| 246 | SoftfloatFile('s_shiftRightJam32.c') |
| 247 | SoftfloatFile('s_shiftRightJam64.c') |
| 248 | SoftfloatFile('s_shiftRightJam64Extra.c') |
| 249 | SoftfloatFile('s_shortShiftLeft128.c') |
| 250 | SoftfloatFile('s_shortShiftLeft64To96M.c') |
| 251 | SoftfloatFile('s_shortShiftRight128.c') |
| 252 | SoftfloatFile('s_shortShiftRightExtendM.c') |
| 253 | SoftfloatFile('s_shortShiftRightJam128.c') |
| 254 | SoftfloatFile('s_shortShiftRightJam128Extra.c') |
| 255 | SoftfloatFile('s_shortShiftRightJam64.c') |
| 256 | SoftfloatFile('s_shortShiftRightJam64Extra.c') |
| 257 | SoftfloatFile('s_shortShiftRightM.c') |
| 258 | SoftfloatFile('s_sub128.c') |
| 259 | SoftfloatFile('s_sub1XM.c') |
| 260 | SoftfloatFile('s_sub256M.c') |
| 261 | SoftfloatFile('s_subMagsF128.c') |
| 262 | SoftfloatFile('s_subMagsF16.c') |
| 263 | SoftfloatFile('s_subMagsF32.c') |
| 264 | SoftfloatFile('s_subMagsF64.c') |
| 265 | SoftfloatFile('s_subM.c') |
| 266 | SoftfloatFile('ui32_to_f128.c') |
| 267 | SoftfloatFile('ui32_to_f16.c') |
| 268 | SoftfloatFile('ui32_to_f32.c') |
| 269 | SoftfloatFile('ui32_to_f64.c') |
| 270 | SoftfloatFile('ui64_to_f128.c') |
| 271 | SoftfloatFile('ui64_to_f16.c') |
| 272 | SoftfloatFile('ui64_to_f32.c') |
| 273 | SoftfloatFile('ui64_to_f64.c') |
| 274 | |
Gabe Black | 64d1297 | 2022-02-10 21:52:51 -0800 | [diff] [blame] | 275 | sf_env.Library('softfloat', [sf_env.SharedObject(f) for f in softfloat_files]) |
kai.ren | 3a9d0de | 2021-01-21 15:53:33 +0800 | [diff] [blame] | 276 | |
Gabe Black | 64d1297 | 2022-02-10 21:52:51 -0800 | [diff] [blame] | 277 | env.Prepend(CPPPATH=Dir('./')) |
| 278 | env.Append(LIBS=['softfloat']) |
| 279 | env.Prepend(LIBPATH=[Dir('.')]) |