diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-03-19 19:27:18 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-03-19 19:27:18 +0000 |
commit | 6800ce58c4af36007f5368d04daaf67c8def99d6 (patch) | |
tree | 55df1c77f881cef2e0f99f7e80beca44da88f6f3 /gcc/fold-const.c | |
parent | 514acc40d240e88d6eba1fc4e1dc400ea091967e (diff) | |
download | gcc-6800ce58c4af36007f5368d04daaf67c8def99d6.tar.gz |
* fold-const.c (fold): Replace sign-extension of a zero extended
value by a single zero extension.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18713 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 7 |
1 files changed, 7 insertions, 0 deletions
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 |