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
cccc8091
Commit
cccc8091
authored
28 years ago
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(exact_real_inverse): New function, if REAL_ARITHMETIC.
From-SVN: r13002
parent
c0eccde6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
gcc/real.c
+62
-0
No files found.
gcc/real.c
View file @
cccc8091
...
...
@@ -1043,6 +1043,68 @@ real_value_truncate (mode, arg)
return
(
r
);
}
/* Try to change R into its exact multiplicative inverse in machine mode
MODE. Return nonzero function value if successful. */
int
exact_real_inverse
(
mode
,
r
)
enum
machine_mode
mode
;
REAL_VALUE_TYPE
*
r
;
{
unsigned
EMUSHORT
e
[
NE
],
einv
[
NE
];
REAL_VALUE_TYPE
rinv
;
int
i
;
GET_REAL
(
r
,
e
);
/* Test for input in range. Don't transform IEEE special values. */
if
(
eisinf
(
e
)
||
eisnan
(
e
)
||
(
ecmp
(
e
,
ezero
)
==
0
))
return
0
;
/* Test for a power of 2: all significand bits zero except the MSB.
We are assuming the target has binary (or hex) arithmetic. */
if
(
e
[
NE
-
2
]
!=
0x8000
)
return
0
;
for
(
i
=
0
;
i
<
NE
-
2
;
i
++
)
{
if
(
e
[
i
]
!=
0
)
return
0
;
}
/* Compute the inverse and truncate it to the required mode. */
ediv
(
e
,
eone
,
einv
);
PUT_REAL
(
einv
,
&
rinv
);
rinv
=
real_value_truncate
(
mode
,
rinv
);
#ifdef CHECK_FLOAT_VALUE
/* This check is not redundant. It may, for example, flush
a supposedly IEEE denormal value to zero. */
i
=
0
;
if
(
CHECK_FLOAT_VALUE
(
mode
,
rinv
,
i
))
return
0
;
#endif
GET_REAL
(
&
rinv
,
einv
);
/* Check the bits again, because the truncation might have
generated an arbitrary saturation value on overflow. */
if
(
einv
[
NE
-
2
]
!=
0x8000
)
return
0
;
for
(
i
=
0
;
i
<
NE
-
2
;
i
++
)
{
if
(
einv
[
i
]
!=
0
)
return
0
;
}
/* Fail if the computed inverse is out of range. */
if
(
eisinf
(
einv
)
||
eisnan
(
einv
)
||
(
ecmp
(
einv
,
ezero
)
==
0
))
return
0
;
/* Output the reciprocal and return success flag. */
PUT_REAL
(
einv
,
r
);
return
1
;
}
#endif
/* REAL_ARITHMETIC defined */
/* Used for debugging--print the value of R in human-readable format
...
...
This diff is collapsed.
Click to expand it.
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