summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-01 18:52:19 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-01 18:52:19 +0000
commit0400917b78f2606c724615cfbe6a3ff6ccae9492 (patch)
treebe556f5593c16ed2a60e57ca2ab1b9d6e738f2be /gcc/simplify-rtx.c
parent55760e6b1e157d6b7d0456993856f41ace841d2b (diff)
downloadgcc-0400917b78f2606c724615cfbe6a3ff6ccae9492.tar.gz
2012-09-01 Andrew Pinski <apinski@cavium.com>
* simplify-rtx.c (simplify_unary_operation_1 <case TRUNCATE>): A truncate of a memory is just loading the low part of the memory. 2012-09-01 Andrew Pinski <apinski@cavium.com> * gcc.target/mips/truncate-8.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190848 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index a878048ac97..f59150ee2c1 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -869,6 +869,14 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
&& COMPARISON_P (op)
&& (STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0)
return rtl_hooks.gen_lowpart_no_emit (mode, op);
+
+ /* A truncate of a memory is just loading the low part of the memory
+ if we are not changing the meaning of the address. */
+ if (GET_CODE (op) == MEM
+ && !MEM_VOLATILE_P (op)
+ && !mode_dependent_address_p (XEXP (op, 0)))
+ return rtl_hooks.gen_lowpart_no_emit (mode, op);
+
break;
case FLOAT_TRUNCATE: