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]

Re: RFC: Add TARGET_EXPAND_COMPOUND_OPERATION


On Mon, Jun 28, 2010 at 10:21 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jun 28, 2010 at 7:28 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Jun 28, 2010 at 3:05 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>>> However, combiner never exposes this to x86 backend. ?I added
>>>> a TARGET_EXPAND_COMPOUND_OPERATION hook to allow x86 backend to
>>>> optimize it. ?For
>>>>
>>>> ---
>>>> typedef struct
>>>> {
>>>> ? unsigned char c1;
>>>> ? unsigned char c2;
>>>> ? unsigned char c3;
>>>> ? unsigned char c4;
>>>> } foo_t;
>>>>
>>>> int
>>>> foo (foo_t x)
>>>> {
>>>> ? ?return x.c2 > 4;
>>>> }
>>>
>>> I think that disabling the canonicalization done by expand_compound_operation
>>> can disable certain forms of combining that are beneficial to x86 even for
>>> this kind of patterns.
>>>
>>> The combiner already knows that it needs to re-create the compound forms when
>>> it is trying to simplify a comparison, see simplify_comparison. ?The problem
>>> with your testcase is that make_compound_operation fails to do so.
>>>
>>> Lightly tested patch attached.
>>>
>>>
>>> ? ? ? ?* combine.c (make_compound_operation) <SUBREG>: Do not return the
>>> ? ? ? ?result of force_to_mode if it partially re-expanded the compound.
>>>
>>
>> It works on my testcases. I will do a full bootstrap and test on
>> Linux/x86-64.
>>
>
> There are no regressions. ?Can you install it?
>

Here is the complete patch with testcases.

Thanks.


-- 
H.J.
---
gcc/

2010-06-28  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/44659
	* combine.c (make_compound_operation) <SUBREG>: Do not return the
	result of force_to_mode if it partially re-expanded the compound.

gcc/testsuite/

2010-06-28  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/44659
	* gcc.target/i386/extract-1.c: New.
	* gcc.target/i386/extract-2.c: Likewise.
	* gcc.target/i386/extract-3.c: Likewise.
	* gcc.target/i386/extract-4.c: Likewise.
	* gcc.target/i386/extract-5.c: Likewise.
	* gcc.target/i386/extract-6.c: Likewise.

Attachment: gcc-pr44659-2.patch
Description: Text document


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