From dcf8468f1cad977c1f82aa008aecc74f5c858161 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Sat, 1 Sep 2012 18:52:19 +0000 Subject: simplify-rtx.c (simplify_unary_operation_1 ): A truncate of a memory is just loading the low part of the memory. 2012-09-01 Andrew Pinski * simplify-rtx.c (simplify_unary_operation_1 ): A truncate of a memory is just loading the low part of the memory. 2012-09-01 Andrew Pinski * gcc.target/mips/truncate-8.c: New testcase. From-SVN: r190848 --- gcc/simplify-rtx.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/simplify-rtx.c') 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: -- cgit v1.1