This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] PR rtl-opt/28173: Optimize (X&~1)|1 as X|1


The following patch addresses the RTL optimization aspects of PR 28173, by
implementing RTL-level versions (in simplify-rtx.c) of the tree-level
transformations I describe for PR middle-end/24427 here:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01000.html

The following patch was tested on x86_64-unknown-linux-gnu with a full
"make bootstrap", all default languages including Ada, and regression
tested with a top-level "make -k check" with no new failures.  The new x86
testcase fails on mainline without this patch, but passes with it.

Committed to mainline as revision 122116.


2007-02-18  Roger Sayle  <roger@eyesopen.com>

        PR rtl-optimization/28173
        * simplify-rtx.c (simplify_binary_operation_1) <IOR>:  Optimize
        (X & C1) | C2 as C2 when (C1 & C2) == C1 and X has no side-effects.
        Optimize (X & C1) | C2 as X | C2 when (C1 | C2) == ~0.
        Canonicalize (X & C1) | C2 as (X & (C1 & ~C2)) | C2.
        <AND>: Canonicalize (X | C1) & C2 as (X & C2) | (C1 & C2).

        * gcc.target/i386/andor-1.c: New test case.

Roger
--

Attachment: patchr.txt
Description: Text document

Attachment: andor-1.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]