1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
# -*- mode: python -*-
import sys
Import("env")
Import("has_option")
Import("debugBuild")
env = env.Clone()
files = [
"LIBRARY/float128/dpml_exception.c",
"LIBRARY/float128/dpml_four_over_pi.c",
"LIBRARY/float128/dpml_ux_bessel.c",
"LIBRARY/float128/dpml_ux_bid.c",
"LIBRARY/float128/dpml_ux_cbrt.c",
"LIBRARY/float128/dpml_ux_erf.c",
"LIBRARY/float128/dpml_ux_exp.c",
"LIBRARY/float128/dpml_ux_int.c",
"LIBRARY/float128/dpml_ux_inv_hyper.c",
"LIBRARY/float128/dpml_ux_inv_trig.c",
"LIBRARY/float128/dpml_ux_lgamma.c",
"LIBRARY/float128/dpml_ux_log.c",
"LIBRARY/float128/dpml_ux_mod.c",
"LIBRARY/float128/dpml_ux_ops.c",
"LIBRARY/float128/dpml_ux_ops_64.c",
"LIBRARY/float128/dpml_ux_pow.c",
"LIBRARY/float128/dpml_ux_powi.c",
"LIBRARY/float128/dpml_ux_sqrt.c",
"LIBRARY/float128/dpml_ux_trig.c",
"LIBRARY/float128/sqrt_tab_t.c",
"LIBRARY/src/bid128.c",
"LIBRARY/src/bid128_2_str_tables.c",
"LIBRARY/src/bid128_acos.c",
"LIBRARY/src/bid128_acosh.c",
"LIBRARY/src/bid128_add.c",
"LIBRARY/src/bid128_asin.c",
"LIBRARY/src/bid128_asinh.c",
"LIBRARY/src/bid128_atan.c",
"LIBRARY/src/bid128_atan2.c",
"LIBRARY/src/bid128_atanh.c",
"LIBRARY/src/bid128_cbrt.c",
"LIBRARY/src/bid128_compare.c",
"LIBRARY/src/bid128_cos.c",
"LIBRARY/src/bid128_cosh.c",
"LIBRARY/src/bid128_div.c",
"LIBRARY/src/bid128_erf.c",
"LIBRARY/src/bid128_erfc.c",
"LIBRARY/src/bid128_exp.c",
"LIBRARY/src/bid128_exp10.c",
"LIBRARY/src/bid128_exp2.c",
"LIBRARY/src/bid128_expm1.c",
"LIBRARY/src/bid128_fdimd.c",
"LIBRARY/src/bid128_fma.c",
"LIBRARY/src/bid128_fmod.c",
"LIBRARY/src/bid128_frexp.c",
"LIBRARY/src/bid128_hypot.c",
"LIBRARY/src/bid128_ldexp.c",
"LIBRARY/src/bid128_lgamma.c",
"LIBRARY/src/bid128_llrintd.c",
"LIBRARY/src/bid128_log.c",
"LIBRARY/src/bid128_log10.c",
"LIBRARY/src/bid128_log1p.c",
"LIBRARY/src/bid128_log2.c",
"LIBRARY/src/bid128_logb.c",
"LIBRARY/src/bid128_logbd.c",
"LIBRARY/src/bid128_lrintd.c",
"LIBRARY/src/bid128_lround.c",
"LIBRARY/src/bid128_minmax.c",
"LIBRARY/src/bid128_modf.c",
"LIBRARY/src/bid128_mul.c",
"LIBRARY/src/bid128_nearbyintd.c",
"LIBRARY/src/bid128_next.c",
"LIBRARY/src/bid128_nexttowardd.c",
"LIBRARY/src/bid128_noncomp.c",
"LIBRARY/src/bid128_pow.c",
"LIBRARY/src/bid128_quantexpd.c",
"LIBRARY/src/bid128_quantize.c",
"LIBRARY/src/bid128_rem.c",
"LIBRARY/src/bid128_round_integral.c",
"LIBRARY/src/bid128_scalb.c",
"LIBRARY/src/bid128_scalbl.c",
"LIBRARY/src/bid128_sin.c",
"LIBRARY/src/bid128_sinh.c",
"LIBRARY/src/bid128_sqrt.c",
"LIBRARY/src/bid128_string.c",
"LIBRARY/src/bid128_tan.c",
"LIBRARY/src/bid128_tanh.c",
"LIBRARY/src/bid128_tgamma.c",
"LIBRARY/src/bid128_to_int16.c",
"LIBRARY/src/bid128_to_int32.c",
"LIBRARY/src/bid128_to_int64.c",
"LIBRARY/src/bid128_to_int8.c",
"LIBRARY/src/bid128_to_uint16.c",
"LIBRARY/src/bid128_to_uint32.c",
"LIBRARY/src/bid128_to_uint64.c",
"LIBRARY/src/bid128_to_uint8.c",
"LIBRARY/src/bid32_acos.c",
"LIBRARY/src/bid32_acosh.c",
"LIBRARY/src/bid32_add.c",
"LIBRARY/src/bid32_asin.c",
"LIBRARY/src/bid32_asinh.c",
"LIBRARY/src/bid32_atan.c",
"LIBRARY/src/bid32_atan2.c",
"LIBRARY/src/bid32_atanh.c",
"LIBRARY/src/bid32_cbrt.c",
"LIBRARY/src/bid32_compare.c",
"LIBRARY/src/bid32_cos.c",
"LIBRARY/src/bid32_cosh.c",
"LIBRARY/src/bid32_div.c",
"LIBRARY/src/bid32_erf.c",
"LIBRARY/src/bid32_erfc.c",
"LIBRARY/src/bid32_exp.c",
"LIBRARY/src/bid32_exp10.c",
"LIBRARY/src/bid32_exp2.c",
"LIBRARY/src/bid32_expm1.c",
"LIBRARY/src/bid32_fdimd.c",
"LIBRARY/src/bid32_fma.c",
"LIBRARY/src/bid32_fmod.c",
"LIBRARY/src/bid32_frexp.c",
"LIBRARY/src/bid32_hypot.c",
"LIBRARY/src/bid32_ldexp.c",
"LIBRARY/src/bid32_lgamma.c",
"LIBRARY/src/bid32_llrintd.c",
"LIBRARY/src/bid32_log.c",
"LIBRARY/src/bid32_log10.c",
"LIBRARY/src/bid32_log1p.c",
"LIBRARY/src/bid32_log2.c",
"LIBRARY/src/bid32_logb.c",
"LIBRARY/src/bid32_logbd.c",
"LIBRARY/src/bid32_lrintd.c",
"LIBRARY/src/bid32_lround.c",
"LIBRARY/src/bid32_minmax.c",
"LIBRARY/src/bid32_modf.c",
"LIBRARY/src/bid32_mul.c",
"LIBRARY/src/bid32_nearbyintd.c",
"LIBRARY/src/bid32_next.c",
"LIBRARY/src/bid32_nexttowardd.c",
"LIBRARY/src/bid32_noncomp.c",
"LIBRARY/src/bid32_pow.c",
"LIBRARY/src/bid32_quantexpd.c",
"LIBRARY/src/bid32_quantize.c",
"LIBRARY/src/bid32_rem.c",
"LIBRARY/src/bid32_round_integral.c",
"LIBRARY/src/bid32_scalb.c",
"LIBRARY/src/bid32_scalbl.c",
"LIBRARY/src/bid32_sin.c",
"LIBRARY/src/bid32_sinh.c",
"LIBRARY/src/bid32_sqrt.c",
"LIBRARY/src/bid32_string.c",
"LIBRARY/src/bid32_sub.c",
"LIBRARY/src/bid32_tan.c",
"LIBRARY/src/bid32_tanh.c",
"LIBRARY/src/bid32_tgamma.c",
"LIBRARY/src/bid32_to_bid128.c",
"LIBRARY/src/bid32_to_bid64.c",
"LIBRARY/src/bid32_to_int16.c",
"LIBRARY/src/bid32_to_int32.c",
"LIBRARY/src/bid32_to_int64.c",
"LIBRARY/src/bid32_to_int8.c",
"LIBRARY/src/bid32_to_uint16.c",
"LIBRARY/src/bid32_to_uint32.c",
"LIBRARY/src/bid32_to_uint64.c",
"LIBRARY/src/bid32_to_uint8.c",
"LIBRARY/src/bid64_acos.c",
"LIBRARY/src/bid64_acosh.c",
"LIBRARY/src/bid64_add.c",
"LIBRARY/src/bid64_asin.c",
"LIBRARY/src/bid64_asinh.c",
"LIBRARY/src/bid64_atan.c",
"LIBRARY/src/bid64_atan2.c",
"LIBRARY/src/bid64_atanh.c",
"LIBRARY/src/bid64_cbrt.c",
"LIBRARY/src/bid64_compare.c",
"LIBRARY/src/bid64_cos.c",
"LIBRARY/src/bid64_cosh.c",
"LIBRARY/src/bid64_div.c",
"LIBRARY/src/bid64_erf.c",
"LIBRARY/src/bid64_erfc.c",
"LIBRARY/src/bid64_exp.c",
"LIBRARY/src/bid64_exp10.c",
"LIBRARY/src/bid64_exp2.c",
"LIBRARY/src/bid64_expm1.c",
"LIBRARY/src/bid64_fdimd.c",
"LIBRARY/src/bid64_fma.c",
"LIBRARY/src/bid64_fmod.c",
"LIBRARY/src/bid64_frexp.c",
"LIBRARY/src/bid64_hypot.c",
"LIBRARY/src/bid64_ldexp.c",
"LIBRARY/src/bid64_lgamma.c",
"LIBRARY/src/bid64_llrintd.c",
"LIBRARY/src/bid64_log.c",
"LIBRARY/src/bid64_log10.c",
"LIBRARY/src/bid64_log1p.c",
"LIBRARY/src/bid64_log2.c",
"LIBRARY/src/bid64_logb.c",
"LIBRARY/src/bid64_logbd.c",
"LIBRARY/src/bid64_lrintd.c",
"LIBRARY/src/bid64_lround.c",
"LIBRARY/src/bid64_minmax.c",
"LIBRARY/src/bid64_modf.c",
"LIBRARY/src/bid64_mul.c",
"LIBRARY/src/bid64_nearbyintd.c",
"LIBRARY/src/bid64_next.c",
"LIBRARY/src/bid64_nexttowardd.c",
"LIBRARY/src/bid64_noncomp.c",
"LIBRARY/src/bid64_pow.c",
"LIBRARY/src/bid64_quantexpd.c",
"LIBRARY/src/bid64_quantize.c",
"LIBRARY/src/bid64_rem.c",
"LIBRARY/src/bid64_round_integral.c",
"LIBRARY/src/bid64_scalb.c",
"LIBRARY/src/bid64_scalbl.c",
"LIBRARY/src/bid64_sin.c",
"LIBRARY/src/bid64_sinh.c",
"LIBRARY/src/bid64_sqrt.c",
"LIBRARY/src/bid64_string.c",
"LIBRARY/src/bid64_tan.c",
"LIBRARY/src/bid64_tanh.c",
"LIBRARY/src/bid64_tgamma.c",
"LIBRARY/src/bid64_to_bid128.c",
"LIBRARY/src/bid64_to_int16.c",
"LIBRARY/src/bid64_to_int32.c",
"LIBRARY/src/bid64_to_int64.c",
"LIBRARY/src/bid64_to_int8.c",
"LIBRARY/src/bid64_to_uint16.c",
"LIBRARY/src/bid64_to_uint32.c",
"LIBRARY/src/bid64_to_uint64.c",
"LIBRARY/src/bid64_to_uint8.c",
"LIBRARY/src/bid_binarydecimal.c",
"LIBRARY/src/bid_convert_data.c",
"LIBRARY/src/bid_decimal_data.c",
"LIBRARY/src/bid_decimal_globals.c",
"LIBRARY/src/bid_dpd.c",
"LIBRARY/src/bid_feclearexcept.c",
"LIBRARY/src/bid_fegetexceptflag.c",
"LIBRARY/src/bid_feraiseexcept.c",
"LIBRARY/src/bid_fesetexceptflag.c",
"LIBRARY/src/bid_fetestexcept.c",
"LIBRARY/src/bid_flag_operations.c",
"LIBRARY/src/bid_from_int.c",
"LIBRARY/src/bid_round.c",
"LIBRARY/src/strtod128.c",
"LIBRARY/src/strtod32.c",
"LIBRARY/src/strtod64.c",
"LIBRARY/src/wcstod128.c",
"LIBRARY/src/wcstod32.c",
"LIBRARY/src/wcstod64.c",
]
# Define Intel decimal128 library build variables
cpp_defines = {
'DECIMAL_CALL_BY_REFERENCE': '0',
'DECIMAL_GLOBAL_ROUNDING': '0',
'DECIMAL_GLOBAL_EXCEPTION_FLAGS': '0',
'UNCHANGED_BINARY_STATUS_FLAGS': '0',
'USE_COMPILER_F128_TYPE': '0',
'USE_COMPILER_F80_TYPE': '0',
'USE_NATIVE_QUAD_TYPE': '0',
}
libs = []
def removeIfPresent(lst, item):
try:
lst.remove(item)
except ValueError:
pass
def float53_object(target, source, extra_defines=None):
source = "LIBRARY/float128/" + source + ".c"
obj_env = env.Clone()
defines = (extra_defines or []) + ['T_FLOAT']
obj_env.Append(CPPDEFINES=defines)
if env.ToolchainIs('msvc'):
removeIfPresent(obj_env['CCFLAGS'], '/W3')
else:
obj_env.Append(CCFLAGS='-w')
return obj_env.LibraryObject(target, source)
# Set OS Defines
if env.TargetOSIs('darwin'):
cpp_defines['LINUX'] = '1'
cpp_defines['mach'] = '1'
extra_objects = [
float53_object('dpml_log1p_t', 'dpml_log',
[('LOG1P', '1'), ('efi2', '1'), ('EFI2', '1')])
]
files += extra_objects
if env.TargetOSIs('linux') or env.TargetOSIs('solaris'):
cpp_defines['LINUX'] = '1'
cpp_defines['linux'] = '1'
libs.append('m')
if env.TargetOSIs('freebsd') or env.TargetOSIs('openbsd'):
cpp_defines['LINUX'] = '1'
cpp_defines['freebsd'] = '1'
libs.append('m')
# Set Architecture Defines
processor = env['TARGET_ARCH']
# Using 32 bit
if processor == 'i386' or processor == 'emscripten':
cpp_defines['IA32'] = '1'
cpp_defines['ia32'] = '1'
elif processor == 'arm':
cpp_defines['IA32'] = '1'
cpp_defines['ia32'] = '1'
elif processor == "aarch64":
cpp_defines['efi2'] = '1'
cpp_defines['EFI2'] = '1'
# Using 64 bit little endian
elif processor == 'x86_64' or processor == 'ppc64le':
cpp_defines['efi2'] = '1'
cpp_defines['EFI2'] = '1'
# Using 64 bit big endian
elif processor == 's390x':
cpp_defines['s390x'] = '1'
cpp_defines['BID_BIG_ENDIAN'] = '1'
else:
assert False, "Unsupported architecture: " + processor
# Set Compiler Defines
if env.ToolchainIs('MSVC'):
cpp_defines['cl'] = '1'
else:
cpp_defines['gcc'] = '1'
source_files = files
env.Append(CPPDEFINES=cpp_defines)
if env.TargetOSIs('windows'):
extra_defines = ['WINDOWS', 'WNT', 'winnt']
env.Append(CPPDEFINES=extra_defines)
# C4273: '...': inconsistent dll linkage
env.Append(CCFLAGS=['/wd4273'])
# C4477: incorrect scanf format string
env.Append(CCFLAGS=['/wd4477'])
if env.ToolchainIs('msvc'):
removeIfPresent(env['CCFLAGS'], '/W3')
else:
env.Append(CCFLAGS='-w')
env.Library(
target='intel_decimal128',
source=source_files,
LIBS=libs,
LIBDEPS_TAGS=[
'init-no-global-side-effects',
]
)
readtest = env.Program(
target='intel_decimal128_readtest',
source=[
'TESTS/readtest.c',
],
LIBDEPS=[
'intel_decimal128',
],
LIBS=libs,
)
readtest_input = env.Install(
'.',
source=['TESTS/readtest.in'],
)
readtest_dict = {
'@readtest_python_interpreter@' : sys.executable.replace('\\', r'\\'),
'@readtest_program@' : readtest[0].name,
'@readtest_input@' : readtest_input[0].name,
}
readtest_wrapper = env.Substfile(
'intel_decimal128_readtest_wrapper.py.in',
SUBST_DICT=readtest_dict,
)
env.Depends(readtest_wrapper, [readtest, readtest_input])
if env.TargetOSIs('windows'):
readtest_wrapper_bat = env.Substfile(
'intel_decimal128_readtest_wrapper.bat.in',
SUBST_DICT=readtest_dict,
)
env.Depends(readtest_wrapper_bat, readtest_wrapper)
env.RegisterUnitTest(readtest_wrapper_bat[0])
else:
env.AddPostAction(readtest_wrapper[0], Chmod(readtest_wrapper[0], 'oug+x'))
env.RegisterUnitTest(readtest_wrapper[0])
|