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
aae67841
Commit
aae67841
authored
Dec 08, 1993
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fold, case *_{DIV,MOD}_EXPR): When using distributive law, take care
when C2 is negative. From-SVN: r6194
parent
a03f67cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
gcc/fold-const.c
+13
-5
No files found.
gcc/fold-const.c
View file @
aae67841
...
...
@@ -3922,7 +3922,7 @@ fold (expr)
where C1 % C3 == 0 or C3 % C1 == 0. We can simplify these
expressions, which often appear in the offsets or sizes of
objects with a varying size. Only deal with positive divisors
and multiplicands.
and multiplicands.
If C2 is negative, we must have C2 % C3 == 0.
Look for NOPs and SAVE_EXPRs inside. */
...
...
@@ -3942,7 +3942,10 @@ fold (expr)
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
)
c2
=
TREE_OPERAND
(
xarg0
,
1
),
xarg0
=
TREE_OPERAND
(
xarg0
,
0
);
else
if
(
TREE_CODE
(
xarg0
)
==
MINUS_EXPR
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
)
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
/* If we are doing this computation unsigned, the negate
is incorrect. */
&&
!
TREE_UNSIGNED
(
type
))
{
c2
=
fold
(
build1
(
NEGATE_EXPR
,
type
,
TREE_OPERAND
(
xarg0
,
1
)));
xarg0
=
TREE_OPERAND
(
xarg0
,
0
);
...
...
@@ -3959,7 +3962,10 @@ fold (expr)
&&
(
integer_zerop
(
const_binop
(
TRUNC_MOD_EXPR
,
TREE_OPERAND
(
xarg0
,
1
),
arg1
,
1
))
||
integer_zerop
(
const_binop
(
TRUNC_MOD_EXPR
,
arg1
,
TREE_OPERAND
(
xarg0
,
1
),
1
))))
TREE_OPERAND
(
xarg0
,
1
),
1
)))
&&
(
tree_int_cst_lt
(
integer_zero_node
,
c2
)
||
integer_zerop
(
const_binop
(
TRUNC_MOD_EXPR
,
c2
,
arg1
,
1
))))
{
tree
outer_div
=
integer_one_node
;
tree
c1
=
TREE_OPERAND
(
xarg0
,
1
);
...
...
@@ -4020,7 +4026,8 @@ fold (expr)
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
)
c2
=
TREE_OPERAND
(
xarg0
,
1
),
xarg0
=
TREE_OPERAND
(
xarg0
,
0
);
else
if
(
TREE_CODE
(
xarg0
)
==
MINUS_EXPR
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
)
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
&&
!
TREE_UNSIGNED
(
type
))
{
c2
=
fold
(
build1
(
NEGATE_EXPR
,
type
,
TREE_OPERAND
(
xarg0
,
1
)));
xarg0
=
TREE_OPERAND
(
xarg0
,
0
);
...
...
@@ -4032,7 +4039,8 @@ fold (expr)
&&
TREE_CODE
(
TREE_OPERAND
(
xarg0
,
1
))
==
INTEGER_CST
&&
integer_zerop
(
const_binop
(
TRUNC_MOD_EXPR
,
TREE_OPERAND
(
xarg0
,
1
),
arg1
,
1
)))
arg1
,
1
))
&&
tree_int_cst_lt
(
integer_zero_node
,
c2
))
/* The result is (C2%C3). */
return
omit_one_operand
(
type
,
const_binop
(
code
,
c2
,
arg1
,
1
),
TREE_OPERAND
(
xarg0
,
0
));
...
...
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