[PATCH] Improve combining of conditionals
Maxim Kuvyrkov
maxim@codesourcery.com
Mon Apr 25 15:32:00 GMT 2011
On Apr 15, 2011, at 4:38 PM, Maxim Kuvyrkov wrote:
> On Apr 15, 2011, at 3:34 PM, Eric Botcazou wrote:
>
>>> The problem this patch fixes is that combine_simplify_rtx() prefers to
>>> return an expression (say, <xor (a) (b)>) even when a comparison is
>>> prefered (say, <neq (xor (a) (b)) 0>). Expressions are not recognized as
>>> valid conditions of if_then_else for most targets, so combiner misses a
>>> potential optimization. This patch makes combine_simplify_rtx() aware of
>>> the context it was invoked in, and, when appropriate, does not discourage
>>> it from returning a conditional.
>>
>> Btw, this is very likely also valid for targets with STORE_FLAG_VALUE == -1 so
>> the same IN_COND short-circuit would need to be added a few lines below in
>> combine_simplify_rtx. But this would need to be tested. Do you happen to
>> have access to such a target, e.g. m68k?
>
> Hm, I didn't notice that one, thanks! I have access to m68k (ColdFire, tbp) and will test this change there before committing.
I've successfully tested the following trivial patch on m68k-linux (cross-compiler, gcc, g++ and libstdc++ testsuites).
Checked in as obvious.
--
Maxim Kuvyrkov
Mentor Graphics / CodeSourcery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsf-gcc-combine-fix-1.ChangeLog
Type: application/octet-stream
Size: 202 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110425/83a72e75/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsf-gcc-combine-fix-1.patch
Type: application/octet-stream
Size: 525 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110425/83a72e75/attachment-0001.obj>
More information about the Gcc-patches
mailing list