Changeset 1cc4a09 in mainline for uspace/lib/softfloat/include


Ignore:
Timestamp:
2011-08-14T00:19:31Z (14 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b705ecc
Parents:
6d100fd (diff), e0e922d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix changes.

Location:
uspace/lib/softfloat/include
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/softfloat/include/add.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Addition functions.
    3334 */
    3435
     
    3839extern float32 addFloat32(float32, float32);
    3940extern float64 addFloat64(float64, float64);
     41extern float128 addFloat128(float128, float128);
    4042
    4143#endif
  • uspace/lib/softfloat/include/common.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Common helper operations.
    3334 */
    3435
     
    3940
    4041extern float64 finishFloat64(int32_t, uint64_t, char);
     42extern float128 finishFloat128(int32_t, uint64_t, uint64_t, char, uint64_t);
    4143
     44extern int countZeroes8(uint8_t);
     45extern int countZeroes32(uint32_t);
    4246extern int countZeroes64(uint64_t);
    43 extern int countZeroes32(uint32_t);
    44 extern int countZeroes8(uint8_t);
    4547
    4648extern void roundFloat32(int32_t *, uint32_t *);
    4749extern void roundFloat64(int32_t *, uint64_t *);
     50extern void roundFloat128(int32_t *, uint64_t *, uint64_t *);
     51
     52extern void lshift128(uint64_t, uint64_t, int, uint64_t *, uint64_t *);
     53extern void rshift128(uint64_t, uint64_t, int, uint64_t *, uint64_t *);
     54
     55extern void and128(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *);
     56extern void or128(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *);
     57extern void xor128(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *);
     58extern void not128(uint64_t, uint64_t, uint64_t *, uint64_t *);
     59
     60extern int eq128(uint64_t, uint64_t, uint64_t, uint64_t);
     61extern int le128(uint64_t, uint64_t, uint64_t, uint64_t);
     62extern int lt128(uint64_t, uint64_t, uint64_t, uint64_t);
     63
     64extern void add128(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *);
     65extern void sub128(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *);
     66
     67extern void mul64(uint64_t, uint64_t, uint64_t *, uint64_t *);
     68extern void mul128(uint64_t, uint64_t, uint64_t, uint64_t,
     69    uint64_t *, uint64_t *, uint64_t *, uint64_t *);
     70
     71extern uint64_t div128est(uint64_t, uint64_t, uint64_t);
    4872
    4973#endif
  • uspace/lib/softfloat/include/comparison.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Comparison functions.
    3334 */
    3435
     
    4243extern int isFloat32Zero(float32);
    4344
     45extern int isFloat32eq(float32, float32);
     46extern int isFloat32lt(float32, float32);
     47extern int isFloat32gt(float32, float32);
     48
    4449extern int isFloat64NaN(float64);
    4550extern int isFloat64SigNaN(float64);
     
    4853extern int isFloat64Zero(float64);
    4954
    50 extern int isFloat32eq(float32, float32);
    51 extern int isFloat32lt(float32, float32);
    52 extern int isFloat32gt(float32, float32);
     55extern int isFloat64eq(float64, float64);
     56extern int isFloat64lt(float64, float64);
     57extern int isFloat64gt(float64, float64);
     58
     59extern int isFloat128NaN(float128);
     60extern int isFloat128SigNaN(float128);
     61
     62extern int isFloat128Infinity(float128);
     63extern int isFloat128Zero(float128);
     64
     65extern int isFloat128eq(float128, float128);
     66extern int isFloat128lt(float128, float128);
     67extern int isFloat128gt(float128, float128);
    5368
    5469#endif
  • uspace/lib/softfloat/include/conversion.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Conversion of precision and conversion between integers and floats.
    3334 */
    3435
     
    3738
    3839extern float64 convertFloat32ToFloat64(float32);
     40extern float128 convertFloat32ToFloat128(float32);
     41extern float128 convertFloat64ToFloat128(float64);
     42
     43
    3944extern float32 convertFloat64ToFloat32(float64);
     45extern float32 convertFloat128ToFloat32(float128);
     46extern float64 convertFloat128ToFloat64(float128);
     47
    4048
    4149extern uint32_t float32_to_uint32(float32);
     
    4553extern int64_t float32_to_int64(float32);
    4654
     55extern uint32_t float64_to_uint32(float64);
     56extern int32_t float64_to_int32(float64);
     57
    4758extern uint64_t float64_to_uint64(float64);
    4859extern int64_t float64_to_int64(float64);
    4960
    50 extern uint32_t float64_to_uint32(float64);
    51 extern int32_t float64_to_int32(float64);
     61extern uint32_t float128_to_uint32(float128);
     62extern int32_t float128_to_int32(float128);
     63
     64extern uint64_t float128_to_uint64(float128);
     65extern int64_t float128_to_int64(float128);
     66
    5267
    5368extern float32 uint32_to_float32(uint32_t);
     
    6378extern float64 int64_to_float64(int64_t);
    6479
     80extern float128 uint32_to_float128(uint32_t);
     81extern float128 int32_to_float128(int32_t);
     82
     83extern float128 uint64_to_float128(uint64_t);
     84extern float128 int64_to_float128(int64_t);
     85
    6586#endif
    6687
  • uspace/lib/softfloat/include/div.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Division functions.
    3334 */
    3435
     
    3839extern float32 divFloat32(float32, float32);
    3940extern float64 divFloat64(float64, float64);
    40 
    41 extern uint64_t divFloat64estim(uint64_t, uint64_t);
     41extern float128 divFloat128(float128, float128);
    4242
    4343#endif
  • uspace/lib/softfloat/include/mul.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Multiplication functions.
    3334 */
    3435
     
    3839extern float32 mulFloat32(float32, float32);
    3940extern float64 mulFloat64(float64, float64);
    40 
    41 extern void mul64integers(uint64_t, uint64_t, uint64_t *, uint64_t *);
     41extern float128 mulFloat128(float128, float128);
    4242
    4343#endif
  • uspace/lib/softfloat/include/other.h

    r6d100fd r1cc4a09  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Other functions (power, complex).
    3333 */
    3434
  • uspace/lib/softfloat/include/sftypes.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Floating point types and constants.
    3334 */
    3435
     
    7778} float64;
    7879
    79 #define FLOAT32_MAX  0x7f800000
    80 #define FLOAT32_MIN  0xff800000
    81 #define FLOAT64_MAX
    82 #define FLOAT64_MIN
     80typedef union {
     81        long double ld;
     82        struct {
     83#if defined(__BE__)
     84                uint64_t hi;
     85                uint64_t lo;
     86#elif defined(__LE__)
     87                uint64_t lo;
     88                uint64_t hi;
     89#else
     90        #error Unknown endianess
     91#endif
     92        } binary;
     93
     94        struct {
     95#if defined(__BE__)
     96                uint64_t sign : 1;
     97                uint64_t exp : 15;
     98                uint64_t frac_hi : 48;
     99                uint64_t frac_lo : 64;
     100#elif defined(__LE__)
     101                uint64_t frac_lo : 64;
     102                uint64_t frac_hi : 48;
     103                uint64_t exp : 15;
     104                uint64_t sign : 1;
     105#else
     106        #error Unknown endianess
     107#endif
     108        } parts __attribute__ ((packed));
     109} float128;
    83110
    84111/*
    85  * For recognizing NaNs or infinity use isFloat32NaN and is Float32Inf,
     112 * For recognizing NaNs or infinity use specialized comparison functions,
    86113 * comparing with these constants is not sufficient.
    87114 */
     
    95122#define FLOAT64_INF     0x7FF0000000000000ll
    96123
    97 #define FLOAT32_FRACTION_SIZE  23
    98 #define FLOAT64_FRACTION_SIZE  52
     124#define FLOAT128_NAN_HI     0x7FFF800000000000ll
     125#define FLOAT128_NAN_LO     0x0000000000000001ll
     126#define FLOAT128_SIGNAN_HI  0x7FFF000000000000ll
     127#define FLOAT128_SIGNAN_LO  0x0000000000000001ll
     128#define FLOAT128_INF_HI     0x7FFF000000000000ll
     129#define FLOAT128_INF_LO     0x0000000000000000ll
    99130
    100 #define FLOAT32_HIDDEN_BIT_MASK  0x800000
    101 #define FLOAT64_HIDDEN_BIT_MASK  0x10000000000000ll
     131#define FLOAT32_FRACTION_SIZE   23
     132#define FLOAT64_FRACTION_SIZE   52
     133#define FLOAT128_FRACTION_SIZE 112
     134#define FLOAT128_FRAC_HI_SIZE   48
     135#define FLOAT128_FRAC_LO_SIZE   64
     136
     137#define FLOAT32_HIDDEN_BIT_MASK      0x800000
     138#define FLOAT64_HIDDEN_BIT_MASK      0x10000000000000ll
     139#define FLOAT128_HIDDEN_BIT_MASK_HI  0x1000000000000ll
     140#define FLOAT128_HIDDEN_BIT_MASK_LO  0x0000000000000000ll
    102141
    103142#define FLOAT32_MAX_EXPONENT  0xFF
    104143#define FLOAT64_MAX_EXPONENT  0x7FF
     144#define FLOAT128_MAX_EXPONENT 0x7FFF
    105145
    106146#define FLOAT32_BIAS  0x7F
    107147#define FLOAT64_BIAS  0x3FF
    108148#define FLOAT80_BIAS  0x3FFF
     149#define FLOAT128_BIAS 0x3FFF
    109150
    110151#endif
  • uspace/lib/softfloat/include/softfloat.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Softfloat API.
    3334 */
    3435
     
    156157extern int __ltdf2(double, double);
    157158extern int __lttf2(long double, long double);
     159
    158160extern int __lesf2(float, float);
    159161extern int __ledf2(double, double);
     
    166168/* Not implemented yet */
    167169extern float __powisf2(float, int);
     170extern double __powidf2 (double, int);
     171extern long double __powitf2 (long double, int);
     172extern long double __powixf2 (long double, int);
     173
     174
     175
     176/* SPARC quadruple-precision wrappers */
     177
     178extern void _Qp_add(long double *, long double *, long double *);
     179extern void _Qp_sub(long double *, long double *, long double *);
     180extern void _Qp_mul(long double *, long double *, long double *);
     181extern void _Qp_div(long double *, long double *, long double *);
     182extern void _Qp_neg(long double *, long double *);
     183
     184extern void _Qp_stoq(long double *, float);
     185extern void _Qp_dtoq(long double *, double);
     186extern float _Qp_qtos(long double *);
     187extern double _Qp_qtod(long double *);
     188
     189extern int _Qp_qtoi(long double *);
     190extern unsigned int _Qp_qtoui(long double *);
     191extern long _Qp_qtox(long double *);
     192extern unsigned long _Qp_qtoux(long double *);
     193
     194extern void _Qp_itoq(long double *, int);
     195extern void _Qp_uitoq(long double *, unsigned int);
     196extern void _Qp_xtoq(long double *, long);
     197extern void _Qp_uxtoq(long double *, unsigned long);
     198
     199extern int _Qp_cmp(long double *, long double *);
     200extern int _Qp_cmpe(long double *, long double *);
     201extern int _Qp_feq(long double *, long double *);
     202extern int _Qp_fge(long double *, long double *);
     203extern int _Qp_fgt(long double *, long double *);
     204extern int _Qp_fle(long double*, long double *);
     205extern int _Qp_flt(long double *, long double *);
     206extern int _Qp_fne(long double *, long double *);
     207
     208/* Not implemented yet */
     209extern void _Qp_sqrt(long double *, long double *);
    168210
    169211#endif
  • uspace/lib/softfloat/include/sub.h

    r6d100fd r1cc4a09  
    11/*
    22 * Copyright (c) 2005 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Substraction functions.
    3334 */
    3435
     
    3839extern float32 subFloat32(float32, float32);
    3940extern float64 subFloat64(float64, float64);
     41extern float128 subFloat128(float128, float128);
    4042
    4143#endif
Note: See TracChangeset for help on using the changeset viewer.