aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-12-07 16:44:28 -0800
committerRichard Henderson <rth@gcc.gnu.org>2009-12-07 16:44:28 -0800
commit6c0eaee7d2abf83f42269e5f238025c841a0355f (patch)
tree36f585f9dad663c419f9f6399d5a9a62873998f0 /gcc/combine.c
parent9e7e65a08b1bac45dff11d676bc49a845d4b438e (diff)
downloadgcc-6c0eaee7d2abf83f42269e5f238025c841a0355f.zip
gcc-6c0eaee7d2abf83f42269e5f238025c841a0355f.tar.gz
gcc-6c0eaee7d2abf83f42269e5f238025c841a0355f.tar.bz2
re PR rtl-optimization/42269 (Extra sign extension instructions generated)
PR rtl-opt/42269 * combine.c (setup_incoming_promotions): Improve the conditions under which we respect the promotions applied. From-SVN: r155071
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 7f3f6da..f26b9e5 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1377,19 +1377,23 @@ setup_incoming_promotions (rtx first)
/* Eliminate sign extensions in the callee when possible. Only
do this when:
- (a) a mode promotion has occurred;
- (b) the mode of the register is the same as the mode of
+ (a) A mode promotion has occurred;
+ (b) The mode of the register is the same as the mode of
the argument as it is passed; and
- (c) the signedness does not change across any of the promotions; and
- (d) when no language-level promotions (which we cannot guarantee
+ (c) Either there's no language level extension, or the extension
+ from source to end result is valid. The later case is true
+ when the signedness of the extensions match, or when the
+ language level extension is unsigned. In the later case,
+ a zero extension followed by a sign extension is the same
+ as one big zero extension.
+ (d) When no language-level promotions (which we cannot guarantee
will have been done by an external caller) are necessary,
unless we know that this function is only ever called from
the current compilation unit -- all of whose call sites will
do the mode1 --> mode2 promotion. */
if (mode1 != mode3
&& mode3 == mode4
- && uns1 == uns3
- && (mode1 == mode2 || strictly_local))
+ && (mode1 == mode2 || ((uns1 || !uns3) && strictly_local)))
{
/* Record that the value was promoted from mode1 to mode3,
so that any sign extension at the head of the current