diff options
author | Andrew Pinski <apinski@cavium.com> | 2012-09-01 18:52:19 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2012-09-01 11:52:19 -0700 |
commit | dcf8468f1cad977c1f82aa008aecc74f5c858161 (patch) | |
tree | be556f5593c16ed2a60e57ca2ab1b9d6e738f2be /gcc/simplify-rtx.c | |
parent | 2caf633d4f8d4281dd428a1cfeac28b92bc9b6f8 (diff) | |
download | gcc-dcf8468f1cad977c1f82aa008aecc74f5c858161.zip gcc-dcf8468f1cad977c1f82aa008aecc74f5c858161.tar.gz gcc-dcf8468f1cad977c1f82aa008aecc74f5c858161.tar.bz2 |
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>
* 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.
From-SVN: r190848
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index a878048..f59150e 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: |