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
e627f0b6
Commit
e627f0b6
authored
Jun 15, 1994
by
Torbjorn Granlund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert last patch: (fold, case *_DIV_EXPR): Optimize (x / C << y)...
From-SVN: r7475
parent
ebc75e94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
47 deletions
+0
-47
gcc/fold-const.c
+0
-47
No files found.
gcc/fold-const.c
View file @
e627f0b6
...
...
@@ -3994,53 +3994,6 @@ fold (expr)
}
}
/* Note that this transformation might sometimes cause division-by-zero
to pass unnoticed. For example when C=2 and y=31. If that is unacceptable,
we could restrict the optimization to the case when log == 0. */
if
((
code
==
FLOOR_DIV_EXPR
||
code
==
TRUNC_DIV_EXPR
)
&&
TREE_CODE
(
arg1
)
==
LSHIFT_EXPR
)
{
int
log
;
if
(
TREE_CODE
(
TREE_OPERAND
(
arg1
,
0
))
==
INTEGER_CST
&&
(
log
=
exact_log2
(
TREE_INT_CST_LOW
(
TREE_OPERAND
(
arg1
,
0
))))
>=
0
&&
TREE_INT_CST_HIGH
(
TREE_OPERAND
(
arg1
,
0
))
==
0
)
{
tree
cnt
;
cnt
=
log
==
0
?
TREE_OPERAND
(
arg1
,
1
)
:
fold
(
build
(
PLUS_EXPR
,
TREE_TYPE
(
TREE_OPERAND
(
arg1
,
1
)),
TREE_OPERAND
(
arg1
,
1
),
build_int_2
(
log
,
0
)));
if
(
TREE_UNSIGNED
(
type
)
||
code
==
FLOOR_DIV_EXPR
)
{
/* (x / (C << y)) where C = 1 << log => x >> (y + log) */
/* BUG: First TYPE here should always be unsigned to get logical
shift. How do we do that? */
return
fold
(
build
(
RSHIFT_EXPR
,
type
,
arg0
,
cnt
));
}
/* (x / (C << y)) when C = 1 << log =>
=> (ashiftrt (plus x (and (ashiftrt x 31)
(not (lshift -1 cnt)))) cnt),
where cnt is y + log */
/* BUG: Several TYPE arguments here might be wrong. */
return
fold
(
build
(
RSHIFT_EXPR
,
type
,
fold
(
build
(
PLUS_EXPR
,
type
,
arg0
,
fold
(
build
(
BIT_AND_EXPR
,
type
,
fold
(
build
(
RSHIFT_EXPR
,
type
,
arg0
,
build_int_2
(
TYPE_PRECISION
(
type
)
-
1
,
0
))),
fold
(
build1
(
BIT_NOT_EXPR
,
type
,
fold
(
build
(
LSHIFT_EXPR
,
type
,
build_int_2
(
~
0
,
~
0
),
cnt
)))))))),
cnt
));
}
}
goto
binary
;
case
CEIL_MOD_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