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
d8cfa4ee
Commit
d8cfa4ee
authored
Dec 11, 1992
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(get_condition): Check for overflow when canonicalizing comparison.
From-SVN: r2863
parent
2af69b62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
20 deletions
+29
-20
gcc/loop.c
+29
-20
No files found.
gcc/loop.c
View file @
d8cfa4ee
...
@@ -6386,34 +6386,43 @@ get_condition (jump, earliest)
...
@@ -6386,34 +6386,43 @@ get_condition (jump, earliest)
if
(
GET_MODE_CLASS
(
GET_MODE
(
op0
))
==
MODE_CC
)
if
(
GET_MODE_CLASS
(
GET_MODE
(
op0
))
==
MODE_CC
)
return
0
;
return
0
;
/* Canonicalize any ordered comparison with integers involving equality. */
/* Canonicalize any ordered comparison with integers involving equality
if
(
GET_CODE
(
op1
)
==
CONST_INT
)
if we can do computations in the relevant mode and we do not
overflow. */
if
(
GET_CODE
(
op1
)
==
CONST_INT
&&
GET_MODE
(
op0
)
!=
VOIDmode
&&
GET_MODE_BITSIZE
(
GET_MODE
(
op0
))
<=
HOST_BITS_PER_WIDE_INT
)
{
{
HOST_WIDE_INT
const_val
=
INTVAL
(
op1
);
HOST_WIDE_INT
const_val
=
INTVAL
(
op1
);
unsigned
HOST_WIDE_INT
uconst_val
=
const_val
;
unsigned
HOST_WIDE_INT
uconst_val
=
const_val
;
unsigned
HOST_WIDE_INT
max_val
=
(
unsigned
HOST_WIDE_INT
)
GET_MODE_MASK
(
GET_MODE
(
op0
));
switch
(
code
)
switch
(
code
)
{
{
case
LE
:
case
LE
:
code
=
LT
;
if
(
const_val
!=
max_val
>>
1
)
op1
=
GEN_INT
(
const_val
+
1
);
code
=
LT
,
op1
=
GEN_INT
(
const_val
+
1
);
break
;
break
;
case
GE
:
case
GE
:
code
=
GT
;
if
(
const_val
op1
=
GEN_INT
(
const_val
-
1
);
!=
(((
HOST_WIDE_INT
)
1
break
;
<<
(
GET_MODE_BITSIZE
(
GET_MODE
(
op0
))
-
1
))))
code
=
GT
,
op1
=
GEN_INT
(
const_val
-
1
);
break
;
case
LEU
:
case
LEU
:
code
=
LTU
;
if
(
uconst_val
!=
max_val
)
op1
=
GEN_INT
(
uconst_val
+
1
);
code
=
LTU
,
op1
=
GEN_INT
(
uconst_val
+
1
);
break
;
break
;
case
GEU
:
case
GEU
:
code
=
GTU
;
if
(
uconst_val
!=
0
)
op1
=
GEN_INT
(
uconst_val
-
1
);
code
=
GTU
,
op1
=
GEN_INT
(
uconst_val
-
1
);
break
;
break
;
}
}
}
}
/* If this was floating-point and we reversed anything other than an
/* If this was floating-point and we reversed anything other than an
...
...
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