diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-12 17:13:25 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-12 17:13:25 +0000 |
commit | 72227be3c12711d72770652228fe52122b35c71d (patch) | |
tree | 6af686cdfe6c11c549f23151dfd216cd90b4573f /gcc/real.c | |
parent | 3f7bb88fb8f0c3240002abab71c03edfd2d608fa (diff) | |
download | gcc-72227be3c12711d72770652228fe52122b35c71d.tar.gz |
* version.c: Bump version to "gcc-3.0.0 970802 experimental".
* gcc.info*: Rebuilt.
* COPYING.g77, README.g77: New files.
* real.c (ereal_unto_float, ereal_unto_double): New functions.
* real.h (ereal_unto_float, ereal_unto_double): Declare them.
(REAL_VALUE_UNTO_TARGET_DOUBLE, REAL_VALUE_UNTO_TARGET_SINGLE): Define.
Get g77 to work with gcc3.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14776 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/gcc/real.c b/gcc/real.c index f7e22eae3bb..b1bb94e2e2d 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -5799,11 +5799,77 @@ make_nan (nan, sign, mode) *nan = (sign << 15) | *p; } -/* Convert an SFmode target `float' value to a REAL_VALUE_TYPE. - This is the inverse of the function `etarsingle' invoked by +/* This is the inverse of the function `etarsingle' invoked by REAL_VALUE_TO_TARGET_SINGLE. */ REAL_VALUE_TYPE +ereal_unto_float (f) + long f; +{ + REAL_VALUE_TYPE r; + unsigned EMUSHORT s[2]; + unsigned EMUSHORT e[NE]; + + /* Convert 32 bit integer to array of 16 bit pieces in target machine order. + This is the inverse operation to what the function `endian' does. */ + if (REAL_WORDS_BIG_ENDIAN) + { + s[0] = (unsigned EMUSHORT) (f >> 16); + s[1] = (unsigned EMUSHORT) f; + } + else + { + s[0] = (unsigned EMUSHORT) f; + s[1] = (unsigned EMUSHORT) (f >> 16); + } + /* Convert and promote the target float to E-type. */ + e24toe (s, e); + /* Output E-type to REAL_VALUE_TYPE. */ + PUT_REAL (e, &r); + return r; +} + + +/* This is the inverse of the function `etardouble' invoked by + REAL_VALUE_TO_TARGET_DOUBLE. */ + +REAL_VALUE_TYPE +ereal_unto_double (d) + long d[]; +{ + REAL_VALUE_TYPE r; + unsigned EMUSHORT s[4]; + unsigned EMUSHORT e[NE]; + + /* Convert array of HOST_WIDE_INT to equivalent array of 16-bit pieces. */ + if (REAL_WORDS_BIG_ENDIAN) + { + s[0] = (unsigned EMUSHORT) (d[0] >> 16); + s[1] = (unsigned EMUSHORT) d[0]; + s[2] = (unsigned EMUSHORT) (d[1] >> 16); + s[3] = (unsigned EMUSHORT) d[1]; + } + else + { + /* Target float words are little-endian. */ + s[0] = (unsigned EMUSHORT) d[0]; + s[1] = (unsigned EMUSHORT) (d[0] >> 16); + s[2] = (unsigned EMUSHORT) d[1]; + s[3] = (unsigned EMUSHORT) (d[1] >> 16); + } + /* Convert target double to E-type. */ + e53toe (s, e); + /* Output E-type to REAL_VALUE_TYPE. */ + PUT_REAL (e, &r); + return r; +} + + +/* Convert an SFmode target `float' value to a REAL_VALUE_TYPE. + This is somewhat like ereal_unto_float, but the input types + for these are different. */ + +REAL_VALUE_TYPE ereal_from_float (f) HOST_WIDE_INT f; { @@ -5832,8 +5898,8 @@ ereal_from_float (f) /* Convert a DFmode target `double' value to a REAL_VALUE_TYPE. - This is the inverse of the function `etardouble' invoked by - REAL_VALUE_TO_TARGET_DOUBLE. + This is somewhat like ereal_unto_double, but the input types + for these are different. The DFmode is stored as an array of HOST_WIDE_INT in the target's data format, with no holes in the bit packing. The first element |