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
b7de5864
Commit
b7de5864
authored
Jul 31, 2003
by
Zdenek Dvorak
Committed by
Zdenek Dvorak
Jul 31, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* fold-const.c (fold): Fold some comparisons of bit operations.
From-SVN: r70009
parent
049d2251
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
gcc/ChangeLog
+4
-0
gcc/fold-const.c
+28
-0
No files found.
gcc/ChangeLog
View file @
b7de5864
2003-07-31 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* fold-const.c (fold): Fold some comparisons of bit operations.
Thu Jul 31 19:49:53 CEST 2003 Jan Hubicka <jh@suse.cz>
* cgraph.c (create_edge): Fix typo.
...
...
gcc/fold-const.c
View file @
b7de5864
...
...
@@ -7182,6 +7182,34 @@ fold (tree expr)
if
(
tem
)
return
tem
;
/* If we have (A & C) == D where D & ~C != 0, convert this into 0.
Similarly for NE_EXPR. */
if
((
code
==
EQ_EXPR
||
code
==
NE_EXPR
)
&&
TREE_CODE
(
arg0
)
==
BIT_AND_EXPR
&&
TREE_CODE
(
arg1
)
==
INTEGER_CST
&&
TREE_CODE
(
TREE_OPERAND
(
arg0
,
1
))
==
INTEGER_CST
)
{
tree
dandnotc
=
fold
(
build
(
BIT_ANDTC_EXPR
,
TREE_TYPE
(
arg0
),
arg1
,
TREE_OPERAND
(
arg0
,
1
)));
tree
rslt
=
code
==
EQ_EXPR
?
integer_zero_node
:
integer_one_node
;
if
(
!
integer_zerop
(
dandnotc
))
return
omit_one_operand
(
type
,
rslt
,
arg0
);
}
/* If we have (A | C) == D where C & ~D != 0, convert this into 0.
Similarly for NE_EXPR. */
if
((
code
==
EQ_EXPR
||
code
==
NE_EXPR
)
&&
TREE_CODE
(
arg0
)
==
BIT_IOR_EXPR
&&
TREE_CODE
(
arg1
)
==
INTEGER_CST
&&
TREE_CODE
(
TREE_OPERAND
(
arg0
,
1
))
==
INTEGER_CST
)
{
tree
candnotd
=
fold
(
build
(
BIT_ANDTC_EXPR
,
TREE_TYPE
(
arg0
),
TREE_OPERAND
(
arg0
,
1
),
arg1
));
tree
rslt
=
code
==
EQ_EXPR
?
integer_zero_node
:
integer_one_node
;
if
(
!
integer_zerop
(
candnotd
))
return
omit_one_operand
(
type
,
rslt
,
arg0
);
}
/* If X is unsigned, convert X < (1 << Y) into X >> Y == 0
and similarly for >= into !=. */
if
((
code
==
LT_EXPR
||
code
==
GE_EXPR
)
...
...
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