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
05a0d5ea
Commit
05a0d5ea
authored
Jul 05, 1993
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fold, case EQ_EXPR, LE_EXPR): If comparing results of signed MOD with
zero, use an unsigned MOD. From-SVN: r4852
parent
40083ddf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
gcc/fold-const.c
+19
-0
No files found.
gcc/fold-const.c
View file @
05a0d5ea
...
@@ -4163,6 +4163,25 @@ fold (expr)
...
@@ -4163,6 +4163,25 @@ fold (expr)
arg1
));
arg1
));
}
}
/* If this is an NE or EQ comparison of zero against the result of a
signed MOD operation, make the MOD operation unsigned since it
is simpler and equivalent. */
if
((
code
==
NE_EXPR
||
code
==
EQ_EXPR
)
&&
integer_zerop
(
arg1
)
&&
!
TREE_UNSIGNED
(
TREE_TYPE
(
arg0
))
&&
(
TREE_CODE
(
arg0
)
==
TRUNC_MOD_EXPR
||
TREE_CODE
(
arg0
)
==
CEIL_MOD_EXPR
||
TREE_CODE
(
arg0
)
==
FLOOR_MOD_EXPR
||
TREE_CODE
(
arg0
)
==
ROUND_MOD_EXPR
))
{
tree
newtype
=
unsigned_type
(
TREE_TYPE
(
arg0
));
tree
newmod
=
build
(
TREE_CODE
(
arg0
),
newtype
,
convert
(
newtype
,
TREE_OPERAND
(
arg0
,
0
)),
convert
(
newtype
,
TREE_OPERAND
(
arg0
,
1
)));
return
build
(
code
,
type
,
newmod
,
convert
(
newtype
,
arg1
));
}
/* If this is an NE comparison of zero with an AND of one, remove the
/* If this is an NE comparison of zero with an AND of one, remove the
comparison since the AND will give the correct value. */
comparison since the AND will give the correct value. */
if
(
code
==
NE_EXPR
&&
integer_zerop
(
arg1
)
if
(
code
==
NE_EXPR
&&
integer_zerop
(
arg1
)
...
...
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