simplify-rtx.c (simplify_binary_operation_1): Transform (and (truncate)) into (truncate (and)).
* simplify-rtx.c (simplify_binary_operation_1) <AND>: Transform (and (truncate)) into (truncate (and)). testsuite/ * gcc.target/mips/truncate-5.c: New test. From-SVN: r149402
This commit is contained in:
parent
3f36bac24b
commit
fcaf7e1250
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -2336,6 +2336,18 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
|
||||
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)
|
||||
|
@ -1,9 +1,13 @@
|
||||
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
|
||||
@ -24,7 +28,7 @@
|
||||
* 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.
|
||||
|
14
gcc/testsuite/gcc.target/mips/truncate-5.c
Normal file
14
gcc/testsuite/gcc.target/mips/truncate-5.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user