(truncate)) into (truncate (and)).
testsuite/
* gcc.target/mips/truncate-5.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149402
138bc75d-0d04-0410-961f-
82ee72b054a4
2009-07-08 Adam Nemet <anemet@caviumnetworks.com>
+ * simplify-rtx.c (simplify_binary_operation_1) <AND>: Transform (and
+ (truncate)) into (truncate (and)).
+
+2009-07-08 Adam Nemet <anemet@caviumnetworks.com>
+
* combine.c (make_extraction): Check TRULY_NOOP_TRUNCATION before
creating LHS paradoxical subregs. Fix surrounding returns to
use NULL_RTX rather than 0.
return simplify_gen_unary (ZERO_EXTEND, mode, tem, imode);
}
+ /* Transform (and (truncate X) C) into (truncate (and X C)). This way
+ we might be able to further simplify the AND with X and potentially
+ remove the truncation altogether. */
+ if (GET_CODE (op0) == TRUNCATE && CONST_INT_P (trueop1))
+ {
+ rtx x = XEXP (op0, 0);
+ enum machine_mode xmode = GET_MODE (x);
+ tem = simplify_gen_binary (AND, xmode, x,
+ gen_int_mode (INTVAL (trueop1), xmode));
+ return simplify_gen_unary (TRUNCATE, mode, tem, xmode);
+ }
+
/* Canonicalize (A | C1) & C2 as (A & C2) | (C1 & C2). */
if (GET_CODE (op0) == IOR
&& CONST_INT_P (trueop1)
+2009-07-08 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/truncate-5.c: New test.
+
2009-07-08 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/40330
PR libfortran/40662
* gfortran.dg/fmt_cache_1.f: New test.
-
+
2009-07-08 Tobias Burnus <burnus@net-b.de>
PR fortran/40675
* gfortran.dg/proc_ptr_21.f90: New test.
2009-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org>
-
+
PR c++/31246
* g++.dg/warn/pr31246.C: New.
* g++.dg/warn/pr31246-2.C: New.
--- /dev/null
+/* If we AND in DI mode (i.e. replace the order of TRUNCATE and AND) then we
+ can remove the TRUNCATE. */
+/* { dg-options "-O -mgp64" } */
+/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */
+
+struct s
+{
+ unsigned a:5;
+};
+
+f (struct s *s, unsigned long long a)
+{
+ s->a = a & 0x3;
+}