blob: 689cbcf925a94c8ad6bd7e8d5809e9b451218022 [file] [log] [blame]
kai.ren3a9d0de2021-01-21 15:53:33 +08001
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
32import os
33
Gabe Black64d12972022-02-10 21:52:51 -080034Import('env')
kai.ren3a9d0de2021-01-21 15:53:33 +080035
Gabe Black64d12972022-02-10 21:52:51 -080036sf_env = env.Clone()
37if sf_env['GCC']:
38 sf_env.Append(CCFLAGS=['-Wno-unused-variable',
39 '-Wno-unused-label',
40 '-Wno-implicit-fallthrough',
41 '-g'])
kai.ren3a9d0de2021-01-21 15:53:33 +080042
Gabe Black64d12972022-02-10 21:52:51 -080043elif sf_env['CLANG']:
44 sf_env.Append(CCFLAGS=['-Wno-unused-variable',
45 '-Wno-unused-label',
46 '-g'])
kai.ren3a9d0de2021-01-21 15:53:33 +080047
48# Add the appropriate files for the library
49softfloat_files = []
50
51
52def SoftfloatFile(filename):
53 softfloat_files.append(File('./' + filename))
54
55SoftfloatFile('f128_add.c')
56SoftfloatFile('f128_classify.c')
57SoftfloatFile('f128_div.c')
58SoftfloatFile('f128_eq.c')
59SoftfloatFile('f128_eq_signaling.c')
60SoftfloatFile('f128_isSignalingNaN.c')
61SoftfloatFile('f128_le.c')
62SoftfloatFile('f128_le_quiet.c')
63SoftfloatFile('f128_lt.c')
64SoftfloatFile('f128_lt_quiet.c')
65SoftfloatFile('f128_mulAdd.c')
66SoftfloatFile('f128_mul.c')
67SoftfloatFile('f128_rem.c')
68SoftfloatFile('f128_roundToInt.c')
69SoftfloatFile('f128_sqrt.c')
70SoftfloatFile('f128_sub.c')
71SoftfloatFile('f128_to_f16.c')
72SoftfloatFile('f128_to_f32.c')
73SoftfloatFile('f128_to_f64.c')
74SoftfloatFile('f128_to_i32.c')
75SoftfloatFile('f128_to_i32_r_minMag.c')
76SoftfloatFile('f128_to_i64.c')
77SoftfloatFile('f128_to_i64_r_minMag.c')
78SoftfloatFile('f128_to_ui32.c')
79SoftfloatFile('f128_to_ui32_r_minMag.c')
80SoftfloatFile('f128_to_ui64.c')
81SoftfloatFile('f128_to_ui64_r_minMag.c')
82SoftfloatFile('f16_add.c')
ksco53009f92022-05-26 02:57:50 +080083SoftfloatFile('f16_classify.c')
kai.ren3a9d0de2021-01-21 15:53:33 +080084SoftfloatFile('f16_div.c')
85SoftfloatFile('f16_eq.c')
86SoftfloatFile('f16_eq_signaling.c')
87SoftfloatFile('f16_isSignalingNaN.c')
88SoftfloatFile('f16_le.c')
89SoftfloatFile('f16_le_quiet.c')
90SoftfloatFile('f16_lt.c')
91SoftfloatFile('f16_lt_quiet.c')
92SoftfloatFile('f16_mulAdd.c')
93SoftfloatFile('f16_mul.c')
94SoftfloatFile('f16_rem.c')
95SoftfloatFile('f16_roundToInt.c')
96SoftfloatFile('f16_sqrt.c')
97SoftfloatFile('f16_sub.c')
98SoftfloatFile('f16_to_f128.c')
99SoftfloatFile('f16_to_f32.c')
100SoftfloatFile('f16_to_f64.c')
101SoftfloatFile('f16_to_i32.c')
102SoftfloatFile('f16_to_i32_r_minMag.c')
103SoftfloatFile('f16_to_i64.c')
104SoftfloatFile('f16_to_i64_r_minMag.c')
105SoftfloatFile('f16_to_ui32.c')
106SoftfloatFile('f16_to_ui32_r_minMag.c')
107SoftfloatFile('f16_to_ui64.c')
108SoftfloatFile('f16_to_ui64_r_minMag.c')
109SoftfloatFile('f32_add.c')
110SoftfloatFile('f32_classify.c')
111SoftfloatFile('f32_div.c')
112SoftfloatFile('f32_eq.c')
113SoftfloatFile('f32_eq_signaling.c')
114SoftfloatFile('f32_isSignalingNaN.c')
115SoftfloatFile('f32_le.c')
116SoftfloatFile('f32_le_quiet.c')
117SoftfloatFile('f32_lt.c')
118SoftfloatFile('f32_lt_quiet.c')
119SoftfloatFile('f32_mulAdd.c')
120SoftfloatFile('f32_mul.c')
121SoftfloatFile('f32_rem.c')
122SoftfloatFile('f32_roundToInt.c')
123SoftfloatFile('f32_sqrt.c')
124SoftfloatFile('f32_sub.c')
125SoftfloatFile('f32_to_f128.c')
126SoftfloatFile('f32_to_f16.c')
127SoftfloatFile('f32_to_f64.c')
128SoftfloatFile('f32_to_i32.c')
129SoftfloatFile('f32_to_i32_r_minMag.c')
130SoftfloatFile('f32_to_i64.c')
131SoftfloatFile('f32_to_i64_r_minMag.c')
132SoftfloatFile('f32_to_ui32.c')
133SoftfloatFile('f32_to_ui32_r_minMag.c')
134SoftfloatFile('f32_to_ui64.c')
135SoftfloatFile('f32_to_ui64_r_minMag.c')
136SoftfloatFile('f64_add.c')
137SoftfloatFile('f64_classify.c')
138SoftfloatFile('f64_div.c')
139SoftfloatFile('f64_eq.c')
140SoftfloatFile('f64_eq_signaling.c')
141SoftfloatFile('f64_isSignalingNaN.c')
142SoftfloatFile('f64_le.c')
143SoftfloatFile('f64_le_quiet.c')
144SoftfloatFile('f64_lt.c')
145SoftfloatFile('f64_lt_quiet.c')
146SoftfloatFile('f64_mulAdd.c')
147SoftfloatFile('f64_mul.c')
148SoftfloatFile('f64_rem.c')
149SoftfloatFile('f64_roundToInt.c')
150SoftfloatFile('f64_sqrt.c')
151SoftfloatFile('f64_sub.c')
152SoftfloatFile('f64_to_f128.c')
153SoftfloatFile('f64_to_f16.c')
154SoftfloatFile('f64_to_f32.c')
155SoftfloatFile('f64_to_i32.c')
156SoftfloatFile('f64_to_i32_r_minMag.c')
157SoftfloatFile('f64_to_i64.c')
158SoftfloatFile('f64_to_i64_r_minMag.c')
159SoftfloatFile('f64_to_ui32.c')
160SoftfloatFile('f64_to_ui32_r_minMag.c')
161SoftfloatFile('f64_to_ui64.c')
162SoftfloatFile('f64_to_ui64_r_minMag.c')
163SoftfloatFile('i32_to_f128.c')
164SoftfloatFile('i32_to_f16.c')
165SoftfloatFile('i32_to_f32.c')
166SoftfloatFile('i32_to_f64.c')
167SoftfloatFile('i64_to_f128.c')
168SoftfloatFile('i64_to_f16.c')
169SoftfloatFile('i64_to_f32.c')
170SoftfloatFile('i64_to_f64.c')
171SoftfloatFile('s_add128.c')
172SoftfloatFile('s_add256M.c')
173SoftfloatFile('s_addCarryM.c')
174SoftfloatFile('s_addComplCarryM.c')
175SoftfloatFile('s_addMagsF128.c')
176SoftfloatFile('s_addMagsF16.c')
177SoftfloatFile('s_addMagsF32.c')
178SoftfloatFile('s_addMagsF64.c')
179SoftfloatFile('s_addM.c')
180SoftfloatFile('s_approxRecip_1Ks.c')
181SoftfloatFile('s_approxRecip32_1.c')
182SoftfloatFile('s_approxRecipSqrt_1Ks.c')
183SoftfloatFile('s_approxRecipSqrt32_1.c')
184SoftfloatFile('s_commonNaNToF128UI.c')
185SoftfloatFile('s_commonNaNToF16UI.c')
186SoftfloatFile('s_commonNaNToF32UI.c')
187SoftfloatFile('s_commonNaNToF64UI.c')
188SoftfloatFile('s_compare128M.c')
189SoftfloatFile('s_compare96M.c')
190SoftfloatFile('s_countLeadingZeros16.c')
191SoftfloatFile('s_countLeadingZeros32.c')
192SoftfloatFile('s_countLeadingZeros64.c')
193SoftfloatFile('s_countLeadingZeros8.c')
194SoftfloatFile('s_eq128.c')
195SoftfloatFile('s_f128UIToCommonNaN.c')
196SoftfloatFile('s_f16UIToCommonNaN.c')
197SoftfloatFile('s_f32UIToCommonNaN.c')
198SoftfloatFile('s_f64UIToCommonNaN.c')
199SoftfloatFile('s_le128.c')
200SoftfloatFile('s_lt128.c')
201SoftfloatFile('s_mul128By32.c')
202SoftfloatFile('s_mul128MTo256M.c')
203SoftfloatFile('s_mul128To256M.c')
204SoftfloatFile('s_mul64ByShifted32To128.c')
205SoftfloatFile('s_mul64To128.c')
206SoftfloatFile('s_mul64To128M.c')
207SoftfloatFile('s_mulAddF128.c')
208SoftfloatFile('s_mulAddF16.c')
209SoftfloatFile('s_mulAddF32.c')
210SoftfloatFile('s_mulAddF64.c')
211SoftfloatFile('s_negXM.c')
212SoftfloatFile('s_normRoundPackToF128.c')
213SoftfloatFile('s_normRoundPackToF16.c')
214SoftfloatFile('s_normRoundPackToF32.c')
215SoftfloatFile('s_normRoundPackToF64.c')
216SoftfloatFile('s_normSubnormalF128Sig.c')
217SoftfloatFile('s_normSubnormalF16Sig.c')
218SoftfloatFile('s_normSubnormalF32Sig.c')
219SoftfloatFile('s_normSubnormalF64Sig.c')
220SoftfloatFile('softfloat_raiseFlags.c')
221SoftfloatFile('softfloat_state.c')
222SoftfloatFile('s_propagateNaNF128UI.c')
223SoftfloatFile('s_propagateNaNF16UI.c')
224SoftfloatFile('s_propagateNaNF32UI.c')
225SoftfloatFile('s_propagateNaNF64UI.c')
226SoftfloatFile('s_remStepMBy32.c')
227SoftfloatFile('s_roundMToI64.c')
228SoftfloatFile('s_roundMToUI64.c')
229SoftfloatFile('s_roundPackMToI64.c')
230SoftfloatFile('s_roundPackMToUI64.c')
231SoftfloatFile('s_roundPackToF128.c')
232SoftfloatFile('s_roundPackToF16.c')
233SoftfloatFile('s_roundPackToF32.c')
234SoftfloatFile('s_roundPackToF64.c')
235SoftfloatFile('s_roundPackToI32.c')
236SoftfloatFile('s_roundPackToI64.c')
237SoftfloatFile('s_roundPackToUI32.c')
238SoftfloatFile('s_roundPackToUI64.c')
239SoftfloatFile('s_roundToI32.c')
240SoftfloatFile('s_roundToI64.c')
241SoftfloatFile('s_roundToUI32.c')
242SoftfloatFile('s_roundToUI64.c')
243SoftfloatFile('s_shiftRightJam128.c')
244SoftfloatFile('s_shiftRightJam128Extra.c')
245SoftfloatFile('s_shiftRightJam256M.c')
246SoftfloatFile('s_shiftRightJam32.c')
247SoftfloatFile('s_shiftRightJam64.c')
248SoftfloatFile('s_shiftRightJam64Extra.c')
249SoftfloatFile('s_shortShiftLeft128.c')
250SoftfloatFile('s_shortShiftLeft64To96M.c')
251SoftfloatFile('s_shortShiftRight128.c')
252SoftfloatFile('s_shortShiftRightExtendM.c')
253SoftfloatFile('s_shortShiftRightJam128.c')
254SoftfloatFile('s_shortShiftRightJam128Extra.c')
255SoftfloatFile('s_shortShiftRightJam64.c')
256SoftfloatFile('s_shortShiftRightJam64Extra.c')
257SoftfloatFile('s_shortShiftRightM.c')
258SoftfloatFile('s_sub128.c')
259SoftfloatFile('s_sub1XM.c')
260SoftfloatFile('s_sub256M.c')
261SoftfloatFile('s_subMagsF128.c')
262SoftfloatFile('s_subMagsF16.c')
263SoftfloatFile('s_subMagsF32.c')
264SoftfloatFile('s_subMagsF64.c')
265SoftfloatFile('s_subM.c')
266SoftfloatFile('ui32_to_f128.c')
267SoftfloatFile('ui32_to_f16.c')
268SoftfloatFile('ui32_to_f32.c')
269SoftfloatFile('ui32_to_f64.c')
270SoftfloatFile('ui64_to_f128.c')
271SoftfloatFile('ui64_to_f16.c')
272SoftfloatFile('ui64_to_f32.c')
273SoftfloatFile('ui64_to_f64.c')
274
Gabe Black64d12972022-02-10 21:52:51 -0800275sf_env.Library('softfloat', [sf_env.SharedObject(f) for f in softfloat_files])
kai.ren3a9d0de2021-01-21 15:53:33 +0800276
Gabe Black64d12972022-02-10 21:52:51 -0800277env.Prepend(CPPPATH=Dir('./'))
278env.Append(LIBS=['softfloat'])
279env.Prepend(LIBPATH=[Dir('.')])