diff options
author | Philippe De Muyter <phdm@macqel.be> | 1998-03-19 19:27:18 +0000 |
---|---|---|
committer | Jeff Law <law@cygnus.com> | 1998-03-19 19:27:18 +0000 |
commit | 151dbb0e20548664a33a9175d778c06e81c07296 (patch) | |
tree | 55df1c77f881cef2e0f99f7e80beca44da88f6f3 | |
parent | 09f9f877a4a9936501d0bf2edc4e9678786d0c17 (diff) |
* fold-const.c (fold): Replace sign-extension of a zero extended
value by a single zero extension.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@18713 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 391fd9ccbe6..e25b040113e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 19 20:30:31 1998 Philippe De Muyter <phdm@macqel.be> + + * fold-const.c (fold): Replace sign-extension of a zero extended + value by a single zero extension. + Thu Mar 19 00:58:07 1998 Jason Merrill <jason@yorick.cygnus.com> * except.c (init_eh): Do nothing. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3a24e4c2df5..4fcd7448303 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4101,6 +4101,13 @@ fold (expr) && ! final_ptr) return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0)); + /* If we have a sign-extension of a zero-extended value, we can + replace that by a single zero-extension. */ + if (inside_int && inter_int && final_int + && inside_prec < inter_prec && inter_prec < final_prec + && inside_unsignedp && !inter_unsignedp) + return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0)); + /* Two conversions in a row are not needed unless: - some conversion is floating-point (overstrict for now), or - the intermediate type is narrower than both initial and |