Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
d9e1ab8d
Commit
d9e1ab8d
authored
Jun 02, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(__floatdisf): Protect against double-rounding error.
From-SVN: r7431
parent
a473029f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
gcc/libgcc2.c
+35
-0
No files found.
gcc/libgcc2.c
View file @
d9e1ab8d
...
...
@@ -1021,6 +1021,25 @@ __floatdidf (u)
#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
#define DI_SIZE (sizeof (DItype) * BITS_PER_UNIT)
#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
#define DF_SIZE 53
#define SF_SIZE 24
#else
#if TARGET_FLOAT_FORMAT == IBM_FLOAT_FORMAT
#define DF_SIZE 56
#define SF_SIZE 24
#else
#if TARGET_FLOAT_FORMAT == VAX_FLOAT_FORMAT
#define DF_SIZE 56
#define SF_SIZE 24
#else
#define DF_SIZE 0
#define SF_SIZE 0
#endif
#endif
#endif
SFtype
__floatdisf
(
u
)
...
...
@@ -1035,6 +1054,22 @@ __floatdisf (u)
if
(
u
<
0
)
u
=
-
u
,
negate
=
1
;
/* Protect against double-rounding error.
Represent any low-order bits, that might be truncated in DFmode,
by a bit that won't be lost. The bit can go in anywhere below the
rounding position of the SFmode. A fixed mask and bit position
handles all usual configurations. It doesn't handle the case
of 128-bit DImode, however. */
if
(
DF_SIZE
<
DI_SIZE
&&
DF_SIZE
>
(
DI_SIZE
-
DF_SIZE
+
SF_SIZE
))
{
#define REP_BIT ((USItype) 1 << (DI_SIZE - DF_SIZE))
if
(
u
>=
((
UDItype
)
1
<<
DF_SIZE
))
{
if
((
USItype
)
u
&
(
REP_BIT
-
1
))
u
|=
REP_BIT
;
}
}
f
=
(
USItype
)
(
u
>>
WORD_SIZE
);
f
*=
HIGH_HALFWORD_COEFF
;
f
*=
HIGH_HALFWORD_COEFF
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment