00001
00002
00003
00004
00005
#ifndef _EM_HELPER_H
00006
#define _EM_HELPER_H
00007
00008
#include "fepublic.h"
00009
#undef FP_QNAN
00010
#undef FP_SNAN
00011
00012
00013
00014
00015
00016
00017 #define fp_reg_read_hi(arg1) \
00018
fp82_reg_read_hi(EM_state_type *ps, arg1)
00019 #define fp_reg_read_lo(arg1) \
00020
fp82_reg_read_lo(EM_state_type *ps, arg1)
00021
00022 #define fp_decode_environment(arg1, arg2, arg3) \
00023
fp82_fp_decode_environment(EM_state_type *ps, arg1, arg2, arg3)
00024
00025 #define fp_ieee_rnd_to_int(arg1, arg2) \
00026
fp82_fp_ieee_rnd_to_int(EM_state_type *ps, arg1, arg2)
00027
00028 #define fp_ieee_rnd_to_int_sp(arg1, arg2, arg3) \
00029
fp82_fp_ieee_rnd_to_int_sp(EM_state_type *ps, arg1, arg2, arg3)
00030
00031 #define fp_ieee_round_sp(arg1, arg2, arg3) \
00032
fp82_fp_ieee_round_sp(EM_state_type *ps, arg1, arg2, arg3)
00033
00034 #define fp_ieee_round(arg1,arg2) \
00035
fp82_fp_ieee_round(EM_state_type *ps, arg1, arg2)
00036
00037 #define fp_reg_disabled(arg1, arg2, arg3, arg4) \
00038
fp82_fp_reg_disabled(EM_state_type *ps, arg1, arg2, arg3, arg4)
00039
00040 #define fminmax_exception_fault_check(arg1, arg2, arg3, arg4) \
00041
fp82_fminmax_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4)
00042 #define fpminmax_exception_fault_check(arg1, arg2, arg3, arg4) \
00043
fp82_fpminmax_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4)
00044
00045 #define fcmp_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00046
fp82_fcmp_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00047 #define fpcmp_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00048
fp82_fpcmp_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00049
00050 #define fcvt_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00051
fp82_fcvt_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00052
00053 #define fpcvt_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00054
fp82_fpcvt_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00055
00056 #define fpma_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00057
fp82_fpma_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00058
00059 #define fma_exception_fault_check(arg1, arg2, arg3, arg4, arg5, arg6) \
00060
fp82_fma_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5, arg6)
00061
00062 #define fms_fnma_exception_fault_check(arg1, arg2, arg3, arg4, arg5, arg6) \
00063
fp82_fms_fnma_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5, arg6)
00064
00065 #define fpms_fpnma_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00066
fp82_fpms_fpnma_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00067
00068 #define frcpa_exception_fault_check(arg1, arg2, arg3, arg4) \
00069
fp82_frcpa_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4)
00070
00071 #define fprcpa_exception_fault_check(arg1, arg2, arg3, arg4, arg5) \
00072
fp82_fprcpa_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4, arg5)
00073
00074 #define frsqrta_exception_fault_check(arg1, arg2, arg3) \
00075
fp82_frsqrta_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3)
00076
00077 #define fprsqrta_exception_fault_check(arg1, arg2, arg3, arg4) \
00078
fp82_fprsqrta_exception_fault_check(EM_state_type *ps, arg1, arg2, arg3, arg4)
00079
00080 #define fp_update_fpsr(arg1, arg2) fp82_fp_update_fpsr(EM_state_type *ps, arg1, arg2)
00081 #define fp_update_psr(arg1) fp82_fp_update_psr(EM_state_type *ps, arg1)
00082
00083
00084
00085
00086
00087 #define SET_STATUS_FLAG(status_flag) { \
00088
status_flag = 1; \
00089
}
00090
00091 #define CLEAR_STATUS_FLAG(status_flag) { \
00092
status_flag = 0; \
00093
}
00094
00095
00096
00097
00098
00099
EM_uint_t
00100
fp_extract_bits(
00101 EM_uint64_t input_value,
00102
unsigned int hi_bound,
00103
unsigned int lo_bound);
00104
00105
EM_uint64_t
00106
fp_concatenate(EM_uint_t hi_val, EM_uint_t lo_val);
00107
00108
INLINE EM_boolean_t
00109
fp_equal(
00110
EM_fp_reg_type fr1,
EM_fp_reg_type fr2);
00111
00112
INLINE EM_boolean_t
00113
fp_less_than(
00114
EM_fp_reg_type fr1,
00115
EM_fp_reg_type fr2);
00116
00117
INLINE EM_boolean_t
00118
fp_lesser_or_equal(
00119
EM_fp_reg_type fr1,
EM_fp_reg_type fr2);
00120
00121
INLINE EM_boolean_t
00122
fp_unordered(
00123
EM_fp_reg_type fr1,
EM_fp_reg_type fr2);
00124
00125
EM_uint_t
00126
fp82_fp_decode_fault(
00127
EM_tmp_fp_env_type tmp_fp_env);
00128
00129
EM_uint_t
00130
fp82_fp_decode_trap(
00131
EM_tmp_fp_env_type tmp_fp_env);
00132
00133
00134
void
00135
fp_decode_environment(
00136 EM_opcode_pc_type pc,
00137 EM_opcode_sf_type sf,
00138
EM_tmp_fp_env_type *tmp_fp_env);
00139
00140
EM_uint_t
00141
fp_reg_disabled(
00142 EM_uint_t f1,
00143 EM_uint_t f2,
00144 EM_uint_t f3,
00145 EM_uint_t f4);
00146
00147
INLINE EM_boolean_t
00148
fp_is_nan_or_inf(
00149
EM_fp_reg_type tmp_res);
00150
00151
INLINE EM_fp_reg_type
00152
fp_dp_to_fr(
00153
EM_fp_dp_type tmp_res);
00154
00155
INLINE EM_fp_dp_type
00156
fp_add(
00157
EM_fp_dp_type fp_dp,
EM_fp_reg_type fr2,
00158
EM_tmp_fp_env_type tmp_fp_env);
00159
00160
INLINE void
00161
fcmp_exception_fault_check(
00162 EM_fp_reg_specifier f2,
00163 EM_fp_reg_specifier f3,
00164 EM_opcode_frel_type frel,
00165 EM_opcode_sf_type sf,
00166
EM_tmp_fp_env_type *tmp_fp_env);
00167
00168
INLINE void
00169
fpcmp_exception_fault_check(
00170 EM_fp_reg_specifier f2,
00171 EM_fp_reg_specifier f3,
00172 EM_opcode_frel_type frel,
00173 EM_opcode_sf_type sf,
00174
EM_tmp_fp_env_type *tmp_fp_env);
00175
00176
INLINE EM_fp_reg_type
00177
fcvt_exception_fault_check(
00178 EM_fp_reg_specifier f2,
00179 EM_opcode_sf_type sf,
00180 EM_boolean_t signed_form,
00181 EM_boolean_t trunc_form,
00182
EM_tmp_fp_env_type *tmp_fp_env);
00183
00184
EM_pair_fp_reg_type
00185
fpcvt_exception_fault_check(
00186 EM_fp_reg_specifier f2,
00187 EM_opcode_sf_type sf,
00188 EM_boolean_t signed_form,
00189 EM_boolean_t trunc_form,
00190
EM_tmp_fp_env_type *tmp_fp_env);
00191
00192
EM_fp_reg_type
00193
fma_exception_fault_check(
00194 EM_fp_reg_specifier f2,
00195 EM_fp_reg_specifier f3,
00196 EM_fp_reg_specifier f4,
00197 EM_opcode_pc_type pc,
00198 EM_opcode_sf_type sf,
00199
EM_tmp_fp_env_type *tmp_fp_env);
00200
00201
EM_pair_fp_reg_type
00202
fpma_exception_fault_check(
00203 EM_fp_reg_specifier f2,
00204 EM_fp_reg_specifier f3,
00205 EM_fp_reg_specifier f4,
00206 EM_opcode_sf_type sf,
00207
EM_tmp_fp_env_type *tmp_fp_env);
00208
00209
INLINE void
00210
fminmax_exception_fault_check(
00211 EM_fp_reg_specifier f2,
00212 EM_fp_reg_specifier f3,
00213 EM_opcode_sf_type sf,
00214
EM_tmp_fp_env_type *tmp_fp_env);
00215
00216
00217
INLINE void
00218
fpminmax_exception_fault_check(
00219 EM_uint_t f2,
00220 EM_uint_t f3,
00221 EM_opcode_sf_type sf,
00222
EM_tmp_fp_env_type *tmp_fp_env);
00223
00224
EM_fp_reg_type
00225
fms_fnma_exception_fault_check(
00226 EM_fp_reg_specifier f2,
00227 EM_fp_reg_specifier f3,
00228 EM_fp_reg_specifier f4,
00229 EM_opcode_pc_type pc,
00230 EM_opcode_sf_type sf,
00231
EM_tmp_fp_env_type *tmp_fp_env);
00232
00233
00234
EM_pair_fp_reg_type
00235
fpms_fpnma_exception_fault_check(
00236 EM_fp_reg_specifier f2,
00237 EM_fp_reg_specifier f3,
00238 EM_fp_reg_specifier f4,
00239 EM_opcode_sf_type sf,
00240
EM_tmp_fp_env_type *tmp_fp_env);
00241
00242
00243
INLINE EM_boolean_t
00244
fp_flag_set_is_enabled(
00245 EM_uint_t flags, EM_uint_t traps);
00246
00247
INLINE EM_boolean_t
00248
fp_flag_set_is_clear(
00249 EM_uint_t flags, EM_uint_t traps);
00250
00251
INLINE EM_fp_dp_type
00252
fp_max_or_infinity(
00253 EM_uint_t sign,
EM_tmp_fp_env_type *tmp_fp_env,
00254 EM_uint_t e_max,
EM_uint128_t max_significand);
00255
00256
INLINE EM_fp_dp_type
00257
fp_mul(
00258
EM_fp_reg_type fr3,
EM_fp_reg_type fr4);
00259
00260
INLINE EM_fp_reg_type
00261
fp_normalize(
EM_fp_reg_type freg);
00262
00263
INLINE EM_fp_dp_type
00264
fp_normalize_dp(
EM_fp_dp_type fp_dp);
00265
00266
EM_fp_dp_type
00267
fp82_fp_fr_to_dp(
EM_fp_reg_type fr1);
00268
00269
INLINE EM_memory_type
00270
fr_to_mem4_bias_adjust(
EM_fp_reg_type freg);
00271
00272
EM_fp_reg_type
00273
frcpa_exception_fault_check(
00274 EM_fp_reg_specifier f2,
00275 EM_fp_reg_specifier f3,
00276 EM_opcode_sf_type sf,
00277
EM_tmp_fp_env_type *tmp_fp_env);
00278
00279
EM_pair_fp_reg_type
00280
fprcpa_exception_fault_check(
00281 EM_fp_reg_specifier f2,
00282 EM_fp_reg_specifier f3,
00283 EM_opcode_sf_type sf,
00284
EM_tmp_fp_env_type *tmp_fp_env,
00285
EM_limits_check_fprcpa *limits_check);
00286
00287
EM_fp_reg_type
00288
frsqrta_exception_fault_check(
00289 EM_fp_reg_specifier f3,
00290 EM_opcode_sf_type sf,
00291
EM_tmp_fp_env_type *tmp_fp_env);
00292
00293
EM_pair_fp_reg_type
00294
fprsqrta_exception_fault_check(
00295 EM_fp_reg_specifier f3,
00296 EM_opcode_sf_type sf,
00297
EM_tmp_fp_env_type *tmp_fp_env,
00298
EM_limits_check_fprsqrta *limits_check);
00299
00300
EM_fp_reg_type
00301
fp_ieee_rnd_to_int(
00302
EM_fp_reg_type fr1,
00303
EM_tmp_fp_env_type *tmp_fp_env);
00304
00305
EM_fp_reg_type
00306
fp_ieee_rnd_to_int_sp(
00307
EM_fp_reg_type fr2,
00308 EM_simd_hilo hilo,
00309
EM_tmp_fp_env_type *tmp_fp_env);
00310
00311
EM_fp_reg_type
00312
fp_ieee_round(
00313
EM_fp_dp_type fp_dp,
00314
EM_tmp_fp_env_type *tmp_fp_env);
00315
00316
INLINE EM_boolean_t
00317
fp_is_finite(
EM_fp_reg_type freg);
00318
00319
INLINE EM_boolean_t
00320
fp_is_inf(
EM_fp_reg_type freg);
00321
00322
INLINE EM_boolean_t
00323
fp_is_inf_dp(
EM_fp_dp_type tmp_res);
00324
00325
INLINE EM_boolean_t
00326
fp_is_nan(
EM_fp_reg_type freg);
00327
00328
INLINE EM_boolean_t
00329
fp_is_nan_dp(
EM_fp_dp_type tmp_res);
00330
00331
INLINE EM_boolean_t
00332
fp_is_natval(
EM_fp_reg_type freg);
00333
00334
INLINE EM_boolean_t
00335
fp_is_neg_dp(
EM_fp_dp_type tmp_res);
00336
00337
INLINE EM_boolean_t
00338
fp_is_neg_inf(
EM_fp_reg_type freg);
00339
00340
INLINE EM_boolean_t
00341
fp_is_neg_non_zero(
EM_fp_reg_type freg);
00342
00343
INLINE EM_boolean_t
00344
fp_is_normal(
EM_fp_reg_type freg);
00345
00346
INLINE EM_boolean_t
00347
fp_is_normal_dp(
EM_fp_dp_type tmp_res);
00348
00349
INLINE EM_boolean_t
00350
fp_is_pos_dp(
EM_fp_dp_type tmp_res);
00351
00352
INLINE EM_boolean_t
00353
fp_is_pos_inf(
EM_fp_reg_type freg);
00354
00355
INLINE EM_boolean_t
00356
fp_is_pos_non_zero(
EM_fp_reg_type freg);
00357
00358
INLINE EM_boolean_t
00359
fp_is_pseudo_zero(
EM_fp_reg_type freg);
00360
00361
INLINE EM_boolean_t
00362
fp_is_qnan(
EM_fp_reg_type freg);
00363
00364
INLINE EM_boolean_t
00365
fp_is_snan(
EM_fp_reg_type freg);
00366
00367
INLINE EM_boolean_t
00368
fp_is_unorm(
EM_fp_reg_type freg);
00369
00370
INLINE EM_boolean_t
00371
fp_is_unsupported(
EM_fp_reg_type freg);
00372
00373
INLINE EM_boolean_t
00374
fp_is_unsupported_dp(
EM_fp_dp_type tmp_res);
00375
00376
INLINE EM_boolean_t
00377
fp_is_zero(
EM_fp_reg_type freg);
00378
00379
INLINE EM_boolean_t
00380
fp_is_zero_dp(
EM_fp_dp_type tmp_res);
00381
00382
EM_int_t
00383
fp82_fp_U64_lead0(EM_uint64_t value);
00384
00385
INLINE EM_int_t
00386
fp_U128_lead0(
EM_uint128_t value);
00387
00388
EM_int_t
00389
fp82_fp_U256_lead0(
EM_uint256_t value);
00390
00391
EM_fp_reg_type
00392
fp_mem_to_fr_format(
00393
EM_memory_type mem,
00394 EM_uint_t size,
00395 EM_uint_t integer_form);
00396
00397
EM_memory_type
00398
fp_fr_to_mem_format(
00399
EM_fp_reg_type freg,
00400 EM_uint_t size,
00401 EM_uint_t integer_form);
00402
00403
INLINE EM_fp_reg_type
00404
fp_make_quiet_nan(
EM_fp_reg_type freg);
00405
00406
EM_boolean_t
00407
fp82_fp_raise_fault(
EM_tmp_fp_env_type tmp_fp_env);
00408
00409
EM_boolean_t
00410
fp82_fp_raise_traps(
EM_tmp_fp_env_type tmp_fp_env);
00411
00412
INLINE EM_fp_reg_type
00413
fp_reg_read(
EM_fp_reg_type freg);
00414
00415
INLINE EM_fp_reg_type
00416
fp_reg_read_hi(EM_uint_t freg);
00417
00418
INLINE EM_fp_reg_type
00419
fp_reg_read_lo(EM_uint_t freg);
00420
00421
INLINE EM_uint_t
00422
fp_single(
EM_fp_reg_type freg);
00423
00424
EM_uint_t
00425
fp_ieee_round_sp(
00426
EM_fp_dp_type fp_dp,
00427 EM_simd_hilo hilo,
00428
EM_tmp_fp_env_type *tmp_fp_env);
00429
00430
INLINE void
00431
fp_ieee_to_hilo(
00432 EM_simd_hilo hilo,
00433
EM_tmp_fp_env_type *tmp_fp_env);
00434
00435
EM_uint_t fp82_no_bytes(
char *str);
00436
00437
EM_uint_t fp82_not_int(
char *str);
00438
00439
INLINE void
00440
fp_update_fpsr(
00441 EM_opcode_sf_type sf,
00442
EM_tmp_fp_env_type tmp_fp_env);
00443
00444
INLINE void
00445
fp_update_psr(
00446 EM_uint_t dest_freg);
00447
00448
00449
00450
00451
00452
EM_boolean_t
00453
fp82_fp_U128_eq(
EM_uint128_t value1,
EM_uint128_t value2);
00454
00455
static INLINE EM_boolean_t
00456
fp_U128_ge(
EM_uint128_t value1,
EM_uint128_t value2);
00457
00458
static INLINE EM_boolean_t
00459
fp_U128_gt(
EM_uint128_t value1,
EM_uint128_t value2);
00460
00461
static INLINE EM_boolean_t
00462
fp_U128_le(
EM_uint128_t value1,
EM_uint128_t value2);
00463
00464
EM_boolean_t
00465
fp82_fp_U128_lt(
EM_uint128_t value1,
EM_uint128_t value2);
00466
00467
EM_boolean_t
00468
fp82_ne_U128(
EM_uint128_t value1,
EM_uint128_t value2);
00469
00470
static INLINE EM_uint128_t
00471
bld_U128(EM_uint64_t hi, EM_uint64_t lo);
00472
00473
EM_uint128_t
00474
fp82_fp_U128_lsh(
EM_uint128_t value, EM_uint_t count);
00475
00476
EM_uint128_t
00477
fp82_fp_U128_rsh(
EM_uint128_t value, EM_uint_t count);
00478
00479
EM_uint128_t
00480
fp82_fp_U64_x_U64_to_U128(EM_uint64_t value1, EM_uint64_t value2);
00481
00482
INLINE EM_uint128_t
00483
fp_I64_x_I64_to_I128(EM_uint64_t value1, EM_uint64_t value2);
00484
00485
EM_uint128_t
00486
fp82_fp_U128_inc(
EM_uint128_t value1);
00487
00488
static INLINE EM_uint128_t
00489
fp_U128_neg(
EM_uint128_t value);
00490
00491
EM_uint128_t
00492
fp82_fp_U128_add(
EM_uint128_t value1,
EM_uint128_t value2);
00493
00494
EM_uint128_t
00495
fp82_fp_U128_bor(
EM_uint128_t value1,
EM_uint128_t value2);
00496
00497
EM_uint128_t
00498
fp82_fp_U128_band(
EM_uint128_t value1,
EM_uint128_t value2);
00499
00500
00501
00502
EM_boolean_t
00503
fp82_fp_U256_eq(
EM_uint256_t value1,
EM_uint256_t value2);
00504
00505
EM_boolean_t
00506
fp82_ne_U256(
EM_uint256_t value1,
EM_uint256_t value2);
00507
00508
static INLINE EM_uint256_t
00509
bld_U256(
00510 EM_uint64_t hh, EM_uint64_t hl,
00511 EM_uint64_t lh, EM_uint64_t ll);
00512
00513
EM_uint256_t
00514
fp82_fp_U256_lsh(
EM_uint256_t value, EM_uint_t count);
00515
00516
EM_uint256_t
00517
fp82_fp_U256_rsh(
EM_uint256_t value, EM_uint_t count);
00518
00519
EM_uint256_t
00520
fp82_fp_U256_inc(
EM_uint256_t value1);
00521
00522
static INLINE EM_uint256_t
00523
fp_U256_neg(
EM_uint256_t value);
00524
00525
static INLINE EM_uint256_t
00526
fp_U256_add(
EM_uint256_t value1,
00527
EM_uint256_t value2);
00528
00529
00530
00531
INLINE EM_uint128_t
00532
fp_U64_to_U128(EM_uint64_t value);
00533
00534
INLINE EM_uint64_t
00535
fp_U128_to_U64(
EM_uint128_t value);
00536
00537
static INLINE EM_uint256_t
00538
fp_U64_to_U256(EM_uint64_t value);
00539
00540
static INLINE EM_uint64_t
00541
fp_U256_to_U64(
EM_uint256_t value);
00542
00543
EM_uint256_t
00544
fp82_fp_U128_to_U256(
EM_uint128_t value);
00545
00546
static INLINE EM_uint128_t
00547
fp_U256_to_U128(
EM_uint256_t value);
00548
00549
EM_boolean_t
00550
is_reserved_field(
00551 EM_opcode_type calling_instruction,
00552 EM_opcode_sf_type sf,
00553 EM_uint_t val) ;
00554
00555
00556
00557
00558
00559 static const EM_uint64_t U64_0 =
CONST_FORMAT( 0x0000000000000000 );
00560 static const EM_uint64_t U64_1 =
CONST_FORMAT( 0x0000000000000001 );
00561 static const EM_uint64_t U64_0x0000000080000000 =
CONST_FORMAT( 0x0000000080000000 );
00562 static const EM_uint64_t U64_0x2000000000000000 =
CONST_FORMAT( 0x2000000000000000 );
00563 static const EM_uint64_t U64_0x4000000000000000 =
CONST_FORMAT( 0x4000000000000000 );
00564 static const EM_uint64_t U64_0x8000000000000000 =
CONST_FORMAT( 0x8000000000000000 );
00565 static const EM_uint64_t U64_0xC000000000000000 =
CONST_FORMAT( 0xC000000000000000 );
00566 static const EM_uint64_t U64_0x3FFFFFFFFFFFFFFF =
CONST_FORMAT( 0x3FFFFFFFFFFFFFFF );
00567 static const EM_uint64_t U64_0x7FFFFFFFFFFFFFFF =
CONST_FORMAT( 0x7FFFFFFFFFFFFFFF );
00568 static const EM_uint64_t U64_0xFFFFFF0000000000 =
CONST_FORMAT( 0xFFFFFF0000000000 );
00569 static const EM_uint64_t U64_0xFFFFFFFFFFFFF800 =
CONST_FORMAT( 0xFFFFFFFFFFFFF800 );
00570 static const EM_uint64_t U64_0xFFFFFFFFFFFFFFFF =
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF );
00571 static const EM_uint64_t U64_0xFFFFFFFF00000000 =
CONST_FORMAT( 0xFFFFFFFF00000000 );
00572 static const EM_uint64_t U64_0xFFFF000000000000 =
CONST_FORMAT( 0xFFFF000000000000 );
00573 static const EM_uint64_t U64_0xFF00000000000000 =
CONST_FORMAT( 0xFF00000000000000 );
00574
00575
00576
static const EM_uint128_t U128_0
00577 = {
00578
#ifdef BIG_ENDIAN
00579
CONST_FORMAT( 0x0000000000000000 ),
00580
CONST_FORMAT( 0x0000000000000000 ),
00581
#endif
00582
#ifdef LITTLE_ENDIAN
00583
CONST_FORMAT( 0x0000000000000000 ),
00584
CONST_FORMAT( 0x0000000000000000 ),
00585
#endif
00586
};
00587
00588
00589
00590
static const EM_uint128_t U128_0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
00591 = {
00592
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00593
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF )
00594 };
00595
00596
00597
static const EM_uint128_t U128_0x00000000000000000000000000003FFF
00598 = {
00599
#ifdef BIG_ENDIAN
00600
CONST_FORMAT( 0x0000000000000000 ),
00601
CONST_FORMAT( 0x0000000000003FFF ),
00602
#endif
00603
#ifdef LITTLE_ENDIAN
00604
CONST_FORMAT( 0x0000000000003FFF ),
00605
CONST_FORMAT( 0x0000000000000000 ),
00606
#endif
00607
};
00608
00609
00610
static const EM_uint128_t U128_0x00000000000000000000000000007FFF
00611 = {
00612
#ifdef BIG_ENDIAN
00613
CONST_FORMAT( 0x0000000000000000 ),
00614
CONST_FORMAT( 0x0000000000007FFF ),
00615
#endif
00616
#ifdef LITTLE_ENDIAN
00617
CONST_FORMAT( 0x0000000000007FFF ),
00618
CONST_FORMAT( 0x0000000000000000 ),
00619
#endif
00620
};
00621
00622
00623
static const EM_uint128_t U128_0x00000000000000000000000000004000
00624 = {
00625
#ifdef BIG_ENDIAN
00626
CONST_FORMAT( 0x0000000000000000 ),
00627
CONST_FORMAT( 0x0000000000004000 ),
00628
#endif
00629
#ifdef LITTLE_ENDIAN
00630
CONST_FORMAT( 0x0000000000004000 ),
00631
CONST_FORMAT( 0x0000000000000000 ),
00632
#endif
00633
};
00634
00635
00636
static const EM_uint128_t U128_0x00000000000000000000000000008000
00637 = {
00638
#ifdef BIG_ENDIAN
00639
CONST_FORMAT( 0x0000000000000000 ),
00640
CONST_FORMAT( 0x0000000000008000 ),
00641
#endif
00642
#ifdef LITTLE_ENDIAN
00643
CONST_FORMAT( 0x0000000000008000 ),
00644
CONST_FORMAT( 0x0000000000000000 ),
00645
#endif
00646
};
00647
00648
00649
static const EM_uint128_t U128_0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000
00650 = {
00651
#ifdef BIG_ENDIAN
00652
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00653
CONST_FORMAT( 0x0000000000008000 ),
00654
#endif
00655
#ifdef LITTLE_ENDIAN
00656
CONST_FORMAT( 0x0000000000008000 ),
00657
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00658
#endif
00659
};
00660
00661
00662
static const EM_uint128_t U128_0x40000000000000000000000000000000
00663 = {
00664
#ifdef BIG_ENDIAN
00665
CONST_FORMAT( 0x4000000000000000 ),
00666
CONST_FORMAT( 0x0000000000000000 ),
00667
#endif
00668
#ifdef LITTLE_ENDIAN
00669
CONST_FORMAT( 0x0000000000000000 ),
00670
CONST_FORMAT( 0x4000000000000000 ),
00671
#endif
00672
};
00673
00674
00675
static const EM_uint128_t U128_0x00000100000000000000000000000000
00676 = {
00677
#ifdef BIG_ENDIAN
00678
CONST_FORMAT( 0x0000010000000000 ),
00679
CONST_FORMAT( 0x0000000000000000 ),
00680
#endif
00681
#ifdef LITTLE_ENDIAN
00682
CONST_FORMAT( 0x0000000000000000 ),
00683
CONST_FORMAT( 0x0000010000000000 ),
00684
#endif
00685
};
00686
00687
00688
static const EM_uint128_t U128_0x00000080000000000000000000000000
00689 = {
00690
#ifdef BIG_ENDIAN
00691
CONST_FORMAT( 0x0000008000000000 ),
00692
CONST_FORMAT( 0x0000000000000000 ),
00693
#endif
00694
#ifdef LITTLE_ENDIAN
00695
CONST_FORMAT( 0x0000000000000000 ),
00696
CONST_FORMAT( 0x0000008000000000 ),
00697
#endif
00698
};
00699
00700
00701
static const EM_uint128_t U128_0x00000000000008000000000000000000
00702 = {
00703
#ifdef BIG_ENDIAN
00704
CONST_FORMAT( 0x0000000000000800 ),
00705
CONST_FORMAT( 0x0000000000000000 ),
00706
#endif
00707
#ifdef LITTLE_ENDIAN
00708
CONST_FORMAT( 0x0000000000000000 ),
00709
CONST_FORMAT( 0x0000000000000800 ),
00710
#endif
00711
};
00712
00713
00714
static const EM_uint128_t U128_0x00000000000004000000000000000000
00715 = {
00716
#ifdef BIG_ENDIAN
00717
CONST_FORMAT( 0x0000000000000400 ),
00718
CONST_FORMAT( 0x0000000000000000 ),
00719
#endif
00720
#ifdef LITTLE_ENDIAN
00721
CONST_FORMAT( 0x0000000000000000 ),
00722
CONST_FORMAT( 0x0000000000000400 ),
00723
#endif
00724
};
00725
00726
00727
static const EM_uint128_t U128_0x00000000000000010000000000000000
00728 = {
00729
#ifdef BIG_ENDIAN
00730
CONST_FORMAT( 0x0000000000000001 ),
00731
CONST_FORMAT( 0x0000000000000000 ),
00732
#endif
00733
#ifdef LITTLE_ENDIAN
00734
CONST_FORMAT( 0x0000000000000000 ),
00735
CONST_FORMAT( 0x0000000000000001 ),
00736
#endif
00737
};
00738
00739
00740
static const EM_uint128_t U128_0x00000000000000008000000000000000
00741 = {
00742
#ifdef BIG_ENDIAN
00743
CONST_FORMAT( 0x0000000000000000 ),
00744
CONST_FORMAT( 0x8000000000000000 ),
00745
#endif
00746
#ifdef LITTLE_ENDIAN
00747
CONST_FORMAT( 0x8000000000000000 ),
00748
CONST_FORMAT( 0x0000000000000000 ),
00749
#endif
00750
};
00751
00752
00753
static const EM_uint128_t U128_0x00000000000000007FFFFFFFFFFFFFFF
00754 = {
00755
#ifdef BIG_ENDIAN
00756
CONST_FORMAT( 0x0000000000000000 ),
00757
CONST_FORMAT( 0x7FFFFFFFFFFFFFFF ),
00758
#endif
00759
#ifdef LITTLE_ENDIAN
00760
CONST_FORMAT( 0x7FFFFFFFFFFFFFFF ),
00761
CONST_FORMAT( 0x0000000000000000 ),
00762
#endif
00763
};
00764
00765
00766
static const EM_uint128_t U128_0x0000000000000000FFFFFFFFFFFFFFFF
00767 = {
00768
#ifdef BIG_ENDIAN
00769
CONST_FORMAT( 0x0000000000000000 ),
00770
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00771
#endif
00772
#ifdef LITTLE_ENDIAN
00773
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00774
CONST_FORMAT( 0x0000000000000000 ),
00775
#endif
00776
};
00777
00778
00779
static const EM_uint128_t U128_0xFFFFFFFFFFFFFFFF0000000000000000
00780 = {
00781
#ifdef BIG_ENDIAN
00782
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00783
CONST_FORMAT( 0x0000000000000000 ),
00784
#endif
00785
#ifdef LITTLE_ENDIAN
00786
CONST_FORMAT( 0x0000000000000000 ),
00787
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00788
#endif
00789
};
00790
00791
00792
static const EM_uint128_t U128_0xFFFFFFFFFFFFFFFF8000000000000000
00793 = {
00794
#ifdef BIG_ENDIAN
00795
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00796
CONST_FORMAT( 0x8000000000000000 ),
00797
#endif
00798
#ifdef LITTLE_ENDIAN
00799
CONST_FORMAT( 0x8000000000000000 ),
00800
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00801
#endif
00802
};
00803
00804
00805
static const EM_uint128_t U128_0x00000000000003FFFFFFFFFFFFFFFFFF
00806 = {
00807
#ifdef BIG_ENDIAN
00808
CONST_FORMAT( 0x00000000000003FF ),
00809
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00810
#endif
00811
#ifdef LITTLE_ENDIAN
00812
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00813
CONST_FORMAT( 0x00000000000003FF ),
00814
#endif
00815
};
00816
00817
00818
static const EM_uint128_t U128_0x00000000000007FFFFFFFFFFFFFFFFFF
00819 = {
00820
#ifdef BIG_ENDIAN
00821
CONST_FORMAT( 0x00000000000007FF ),
00822
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00823
#endif
00824
#ifdef LITTLE_ENDIAN
00825
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00826
CONST_FORMAT( 0x00000000000007FF ),
00827
#endif
00828
};
00829
00830
00831
static const EM_uint128_t U128_0xFFFFFFFFFFFFF8000000000000000000
00832 = {
00833
#ifdef BIG_ENDIAN
00834
CONST_FORMAT( 0xFFFFFFFFFFFFF800 ),
00835
CONST_FORMAT( 0x0000000000000000 ),
00836
#endif
00837
#ifdef LITTLE_ENDIAN
00838
CONST_FORMAT( 0x0000000000000000 ),
00839
CONST_FORMAT( 0xFFFFFFFFFFFFF800 ),
00840
#endif
00841
};
00842
00843
00844
static const EM_uint128_t U128_0xFFFFFFFFFFFFFC000000000000000000
00845 = {
00846
#ifdef BIG_ENDIAN
00847
CONST_FORMAT( 0xFFFFFFFFFFFFFC00 ),
00848
CONST_FORMAT( 0x0000000000000000 ),
00849
#endif
00850
#ifdef LITTLE_ENDIAN
00851
CONST_FORMAT( 0x0000000000000000 ),
00852
CONST_FORMAT( 0xFFFFFFFFFFFFFC00 ),
00853
#endif
00854
};
00855
00856
00857
static const EM_uint128_t U128_0x0000007FFFFFFFFFFFFFFFFFFFFFFFFF
00858 = {
00859
#ifdef BIG_ENDIAN
00860
CONST_FORMAT( 0x0000007FFFFFFFFF ),
00861
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00862
#endif
00863
#ifdef LITTLE_ENDIAN
00864
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00865
CONST_FORMAT( 0x0000007FFFFFFFFF ),
00866
#endif
00867
};
00868
00869
00870
static const EM_uint128_t U128_0x000000FFFFFFFFFFFFFFFFFFFFFFFFFF
00871 = {
00872
#ifdef BIG_ENDIAN
00873
CONST_FORMAT( 0x000000FFFFFFFFFF ),
00874
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00875
#endif
00876
#ifdef LITTLE_ENDIAN
00877
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00878
CONST_FORMAT( 0x000000FFFFFFFFFF ),
00879
#endif
00880
};
00881
00882
00883
static const EM_uint128_t U128_0xFFFFFF00000000000000000000000000
00884 = {
00885
#ifdef BIG_ENDIAN
00886
CONST_FORMAT( 0xFFFFFF0000000000 ),
00887
CONST_FORMAT( 0x0000000000000000 ),
00888
#endif
00889
#ifdef LITTLE_ENDIAN
00890
CONST_FORMAT( 0x0000000000000000 ),
00891
CONST_FORMAT( 0xFFFFFF0000000000 ),
00892
#endif
00893
};
00894
00895
00896
static const EM_uint128_t U128_0xFFFFFF80000000000000000000000000
00897 = {
00898
#ifdef BIG_ENDIAN
00899
CONST_FORMAT( 0xFFFFFF8000000000 ),
00900
CONST_FORMAT( 0x0000000000000000 ),
00901
#endif
00902
#ifdef LITTLE_ENDIAN
00903
CONST_FORMAT( 0x0000000000000000 ),
00904
CONST_FORMAT( 0xFFFFFF8000000000 ),
00905
#endif
00906
};
00907
00908
00909
static const EM_uint128_t U128_0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
00910 = {
00911
#ifdef BIG_ENDIAN
00912
CONST_FORMAT( 0x7FFFFFFFFFFFFFFF ),
00913
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00914
#endif
00915
#ifdef LITTLE_ENDIAN
00916
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00917
CONST_FORMAT( 0x7FFFFFFFFFFFFFFF ),
00918
#endif
00919
};
00920
00921
00922
static const EM_uint128_t U128_0xC0000000000000000000000000000000
00923 = {
00924
#ifdef BIG_ENDIAN
00925
CONST_FORMAT( 0xC000000000000000 ),
00926
CONST_FORMAT( 0x0000000000000000 ),
00927
#endif
00928
#ifdef LITTLE_ENDIAN
00929
CONST_FORMAT( 0x0000000000000000 ),
00930
CONST_FORMAT( 0xC000000000000000 ),
00931
#endif
00932
};
00933
00934
00935
static const EM_uint128_t U128_0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
00936 = {
00937
#ifdef BIG_ENDIAN
00938
CONST_FORMAT( 0x3FFFFFFFFFFFFFFF ),
00939
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00940
#endif
00941
#ifdef LITTLE_ENDIAN
00942
CONST_FORMAT( 0xFFFFFFFFFFFFFFFF ),
00943
CONST_FORMAT( 0x3FFFFFFFFFFFFFFF ),
00944
#endif
00945
};
00946
00947
00948
static const EM_uint128_t U128_0x80000000000000000000000000000000
00949 = {
00950
#ifdef BIG_ENDIAN
00951
CONST_FORMAT( 0x8000000000000000 ),
00952
CONST_FORMAT( 0x0000000000000000 ),
00953
#endif
00954
#ifdef LITTLE_ENDIAN
00955
CONST_FORMAT( 0x0000000000000000 ),
00956
CONST_FORMAT( 0x8000000000000000 ),
00957
#endif
00958
};
00959
00960
00961
static const EM_uint256_t U256_0
00962 = {
00963
#ifdef BIG_ENDIAN
00964
CONST_FORMAT( 0x0000000000000000 ),
00965
CONST_FORMAT( 0x0000000000000000 ),
00966
CONST_FORMAT( 0x0000000000000000 ),
00967
CONST_FORMAT( 0x0000000000000000 ),
00968
#endif
00969
#ifdef LITTLE_ENDIAN
00970
CONST_FORMAT( 0x0000000000000000 ),
00971
CONST_FORMAT( 0x0000000000000000 ),
00972
CONST_FORMAT( 0x0000000000000000 ),
00973
CONST_FORMAT( 0x0000000000000000 ),
00974
#endif
00975
};
00976
00977
00978
00979
00980 static const EM_uint_t FP_SIGN_POSITIVE = 0;
00981
00982 static const EM_uint_t FP_SIGN_NEGATIVE = 1;
00983
00984
00985
00986 static const EM_uint_t FP_SGL_BIAS = 0x0007F;
00987 static const EM_uint_t FP_DBL_BIAS = 0x003FF;
00988 static const EM_uint_t FP_EXT_BIAS = 0x03FFF;
00989 static const EM_uint_t FP_REG_BIAS = 0x0FFFF;
00990 static const EM_uint_t FP_DP_BIAS = 0x3FFFF;
00991
00992 static const EM_uint_t FP_SGL_EXP_ONES = 0x000FF;
00993 static const EM_uint_t FP_DBL_EXP_ONES = 0x007FF;
00994 static const EM_uint_t FP_EXT_EXP_ONES = 0x07FFF;
00995 static const EM_uint_t FP_REG_EXP_ONES = 0x1FFFF;
00996 static const EM_uint_t FP_DP_EXP_ONES = 0x7FFFF;
00997
00998 static const EM_uint_t FP_SGL_EXP_WIDTH = 8;
00999 static const EM_uint_t FP_DBL_EXP_WIDTH = 11;
01000 static const EM_uint_t FP_EXT_EXP_WIDTH = 15;
01001 static const EM_uint_t FP_REG_EXP_WIDTH = 17;
01002
01003 static const EM_uint_t FP_SGL_SIGNIFICAND_WIDTH = 23;
01004 static const EM_uint_t FP_DBL_SIGNIFICAND_WIDTH = 52;
01005 static const EM_uint_t FP_EXT_SIGNIFICAND_WIDTH = 64;
01006 static const EM_uint_t FP_REG_SIGNIFICAND_WIDTH = 64;
01007
01008 static const EM_uint_t FP_REG_EXP_HALF = 0x0FFFE;
01009
01010 static const EM_uint_t FP_INTEGER_EXP = 0x1003E;
01011
01012 static const EM_uint_t FP_DP_INTEGER_EXP = 0x4003E;
01013
01014
01015
01016
static const EM_fp_reg_type
01017 FP_ZERO = {
CONST_FORMAT( 0x0000000000000000 ), 0x00000, 0x0 };
01018
01019
static const EM_fp_reg_type
01020 FP_NEG_ZERO = {
CONST_FORMAT( 0x0000000000000000 ), 0x00000, 0x1 };
01021
01022
static const EM_fp_reg_type
01023 FP_HALF = {
CONST_FORMAT( 0x8000000000000000 ), 0x0FFFE, 0x0 };
01024
01025
static const EM_fp_reg_type
01026 FP_ONE = {
CONST_FORMAT( 0x8000000000000000 ), 0x0FFFF, 0x0 };
01027
01028
static const EM_fp_reg_type
01029 FP_ONE_PAIR = {
CONST_FORMAT( 0x3F8000003F800000 ), 0x1003E, 0x0 };
01030
01031
01032
static const EM_fp_reg_type
01033 FP_INFINITY = {
CONST_FORMAT( 0x8000000000000000 ), 0x1FFFF, 0x0 };
01034
01035
static const EM_fp_reg_type
01036 FP_QNAN = {
CONST_FORMAT( 0xC000000000000000 ), 0x1FFFF, 0x1 };
01037
01038
static const EM_fp_reg_type
01039 FP_SNAN = {
CONST_FORMAT( 0x8000000000000000 ), 0x1FFFF, 0x0 };
01040
01041
static const EM_fp_reg_type
01042 FP_POS_2_TO_63 = {
CONST_FORMAT( 0x8000000000000000 ), 0x1003E, 0x0 };
01043
01044
static const EM_fp_reg_type
01045 FP_NEG_2_TO_63 = {
CONST_FORMAT( 0x8000000000000000 ), 0x1003E, 0x1 };
01046
01047
static const EM_fp_reg_type
01048 FP_POS_2_TO_64 = {
CONST_FORMAT( 0x8000000000000000 ), 0x1003F, 0x0 };
01049
01050
static const EM_fp_reg_type
01051 FP_NEG_2_TO_64 = {
CONST_FORMAT( 0x8000000000000000 ), 0x1003F, 0x1 };
01052
01053
static const EM_fp_reg_type
01054 FP_POS_2_TO_31 = {
CONST_FORMAT( 0x0000000080000000 ), 0x1003E, 0x0 };
01055
01056
static const EM_fp_reg_type
01057 FP_NEG_2_TO_31 = {
CONST_FORMAT( 0x0000000080000000 ), 0x1003E, 0x1 };
01058
01059
static const EM_fp_reg_type
01060 FP_POS_2_TO_32 = {
CONST_FORMAT( 0x0000000080000000 ), 0x1003F, 0x0 };
01061
01062
static const EM_fp_reg_type
01063 FP_NEQ_2_TO_32 = {
CONST_FORMAT( 0x0000000080000000 ), 0x1003F, 0x1 };
01064
01065
static const EM_fp_reg_type
01066 NATVAL = {
CONST_FORMAT( 0x0000000000000000 ), 0x1FFFE, 0x0 };
01067
01068
static const EM_uint64_t
01069 INTEGER_INDEFINITE =
CONST_FORMAT( 0x8000000000000000 );
01070
01071
static const EM_uint_t
01072 INTEGER_INDEFINITE_32_BIT = 0x80000000;
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
#ifndef FP82_NO_SHORTCUTS
01088 #define fp_U64_x_U64_to_U128 fp82_fp_U64_x_U64_to_U128
01089 #define fp_U128_add fp82_fp_U128_add
01090 #define fp_U128_band fp82_fp_U128_band
01091 #define fp_U128_bor fp82_fp_U128_bor
01092 #define fp_U128_eq fp82_fp_U128_eq
01093 #define fp_U256_eq fp82_fp_U256_eq
01094 #define fp_U128_to_U256 fp82_fp_U128_to_U256
01095 #define fp_U128_lt fp82_fp_U128_lt
01096 #define fp_U128_inc fp82_fp_U128_inc
01097 #define fp_U256_inc fp82_fp_U256_inc
01098 #define fp_U128_rsh fp82_fp_U128_rsh
01099 #define fp_U128_lsh fp82_fp_U128_lsh
01100
#define fp_U256_rsh fp82_fp_U256_rsh
01101 #define fp_U256_lsh fp82_fp_U256_lsh
01102 #define fp_U256_rsh fp82_fp_U256_rsh
01103 #define fp_U64_lead0 fp82_fp_U64_lead0
01104 #define fp_U256_lead0 fp82_fp_U256_lead0
01105 #define fp_raise_fault fp82_fp_raise_fault
01106 #define fp_raise_traps fp82_fp_raise_traps
01107 #define fp_decode_fault fp82_fp_decode_fault
01108 #define fp_decode_trap fp82_fp_decode_trap
01109 #define fp_fr_to_dp fp82_fp_fr_to_dp
01110
#endif
01111
01112
#endif
01113