summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-23 01:53:56 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-23 01:53:56 +0000
commit32e79ae6f9944488b6c360e3d2d233a3ca41cb70 (patch)
tree4513c5254a2c57ebf8614052ec61b449af5ec70e /gcc/expr.c
parent85fdb7fe0e95f8ecefe1ed7211dda2016f08e440 (diff)
downloadgcc-32e79ae6f9944488b6c360e3d2d233a3ca41cb70.tar.gz
2007-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/31448 * expr.c (reduce_to_bit_field_precision): Handle CONST_INT rtx's. 2007-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/31448 * gcc.c-torture/execute/pr31448.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124054 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c644933c0ba..e239f4c69b5 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8962,7 +8962,14 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type)
HOST_WIDE_INT prec = TYPE_PRECISION (type);
if (target && GET_MODE (target) != GET_MODE (exp))
target = 0;
- if (TYPE_UNSIGNED (type))
+ /* For constant values, reduce using build_int_cst_type. */
+ if (GET_CODE (exp) == CONST_INT)
+ {
+ HOST_WIDE_INT value = INTVAL (exp);
+ tree t = build_int_cst_type (type, value);
+ return expand_expr (t, target, VOIDmode, EXPAND_NORMAL);
+ }
+ else if (TYPE_UNSIGNED (type))
{
rtx mask;
if (prec < HOST_BITS_PER_WIDE_INT)