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
ab29fdfc
Commit
ab29fdfc
authored
Mar 14, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(convert_to_integer): Convert integer_one_node to proper type before
tree_int_cst_lt call. From-SVN: r6777
parent
ff3225e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
gcc/convert.c
+23
-21
No files found.
gcc/convert.c
View file @
ab29fdfc
...
...
@@ -170,25 +170,25 @@ convert_to_integer (type, expr)
else
if
(
outprec
>=
inprec
)
return
build1
(
NOP_EXPR
,
type
,
expr
);
/* Here detect when we can distribute the truncation down past some arithmetic.
For example, if adding two longs and converting to an int,
we can equally well convert both to ints and then add.
For the operations handled here, such truncation distribution
is always safe.
It is desirable in these cases:
1) when truncating down to full-word from a larger size
2) when truncating takes no work.
3) when at least one operand of the arithmetic has been extended
(as by C's default conversions). In this case we need two conversions
if we do the arithmetic as already requested, so we might as well
truncate both and then combine. Perhaps that way we need only one.
Note that in general we cannot do the arithmetic in a type
shorter than the desired result of conversion, even if the operands
are both extended from a shorter type, because they might overflow
if combined in that type. The exceptions to this--the times when
two narrow values can be combined in their narrow type even to
make a wider result--are handled by "shorten" in build_binary_op. */
/* Here detect when we can distribute the truncation down past some
arithmetic. For example, if adding two longs and converting to an
int,
we can equally well convert both to ints and then add.
For the operations handled here, such truncation distribution
is always safe.
It is desirable in these cases:
1) when truncating down to full-word from a larger size
2) when truncating takes no work.
3) when at least one operand of the arithmetic has been extended
(as by C's default conversions). In this case we need two conversions
if we do the arithmetic as already requested, so we might as well
truncate both and then combine. Perhaps that way we need only one.
Note that in general we cannot do the arithmetic in a type
shorter than the desired result of conversion, even if the operands
are both extended from a shorter type, because they might overflow
if combined in that type. The exceptions to this--the times when
two narrow values can be combined in their narrow type even to
make a wider result--are handled by "shorten" in build_binary_op. */
switch
(
ex_form
)
{
...
...
@@ -196,7 +196,9 @@ convert_to_integer (type, expr)
/* We can pass truncation down through right shifting
when the shift count is a nonpositive constant. */
if
(
TREE_CODE
(
TREE_OPERAND
(
expr
,
1
))
==
INTEGER_CST
&&
tree_int_cst_lt
(
TREE_OPERAND
(
expr
,
1
),
integer_one_node
))
&&
tree_int_cst_lt
(
TREE_OPERAND
(
expr
,
1
),
convert
(
TREE_TYPE
(
TREE_OPERAND
(
expr
,
1
)),
integer_one_node
)))
goto
trunc1
;
break
;
...
...
@@ -204,7 +206,7 @@ convert_to_integer (type, expr)
/* We can pass truncation down through left shifting
when the shift count is a nonnegative constant. */
if
(
TREE_CODE
(
TREE_OPERAND
(
expr
,
1
))
==
INTEGER_CST
&&
!
tree_int_cst_lt
(
TREE_OPERAND
(
expr
,
1
),
integer_zero_node
)
&&
tree_int_cst_sgn
(
TREE_OPERAND
(
expr
,
1
))
>=
0
&&
TREE_CODE
(
TYPE_SIZE
(
type
))
==
INTEGER_CST
)
{
/* If shift count is less than the width of the truncated type,
...
...
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