aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-03-01 06:39:01 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1995-03-01 06:39:01 -0500
commitf635a84d96e160cf99e6e310e9caf6de0b889986 (patch)
treef16467982b7a9f35c237fd7925f518ac1b915c5a /gcc
parentd72471fd1a739031934cd0e4b6064759ccfc7b16 (diff)
downloadgcc-f635a84d96e160cf99e6e310e9caf6de0b889986.zip
gcc-f635a84d96e160cf99e6e310e9caf6de0b889986.tar.gz
gcc-f635a84d96e160cf99e6e310e9caf6de0b889986.tar.bz2
(store_expr): Do conversion in two steps for promoted lhs.
From-SVN: r9098
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 7787593..1ee0480 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2743,11 +2743,23 @@ store_expr (exp, target, want_value)
expression. */
{
/* If we don't want a value, we can do the conversion inside EXP,
- which will often result in some optimizations. */
+ which will often result in some optimizations. Do the conversion
+ in two steps: first change the signedness, if needed, then
+ the extend. */
if (! want_value)
- exp = convert (type_for_mode (GET_MODE (SUBREG_REG (target)),
- SUBREG_PROMOTED_UNSIGNED_P (target)),
- exp);
+ {
+ if (TREE_UNSIGNED (TREE_TYPE (exp))
+ != SUBREG_PROMOTED_UNSIGNED_P (target))
+ exp
+ = convert
+ (signed_or_unsigned_type (SUBREG_PROMOTED_UNSIGNED_P (target),
+ TREE_TYPE (exp)),
+ exp);
+
+ exp = convert (type_for_mode (GET_MODE (SUBREG_REG (target)),
+ SUBREG_PROMOTED_UNSIGNED_P (target)),
+ exp);
+ }
temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);