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
+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 Uros Bizjak <ubizjak@gmail.com>
PR target/46829
&& 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:
+2012-09-01 Andrew Pinski <apinski@cavium.com>
+
+ * gcc.target/mips/truncate-8.c: New testcase.
+
2012-09-01 Uros Bizjak <ubizjak@gmail.com>
PR target/46829
--- /dev/null
+/* { dg-options "-mgp64" } */
+/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
+/* { dg-final { scan-assembler "\tlw\t" } } */
+/* { dg-final { scan-assembler-not "\tsll\t" } } */
+/* { dg-final { scan-assembler-not "\tld\t" } } */
+
+struct s
+{
+ long long a;
+ int b;
+};
+
+int
+foo (struct s *x)
+{
+ return x->a;
+}
+