[PATCH 1/2] Allow REG_EQUAL for ZERO_EXTRACT
Kugan
kugan.vivekanandarajah@linaro.org
Sun Jul 5 23:17:00 GMT 2015
On 30/06/15 17:16, Maxim Kuvyrkov wrote:
>> On Jun 30, 2015, at 6:54 AM, Kugan <kugan.vivekanandarajah@linaro.org> wrote:
>>
>>
>> On 29/06/15 21:56, Maxim Kuvyrkov wrote:
>>>> On Jun 28, 2015, at 2:28 PM, Kugan <kugan.vivekanandarajah@linaro.org> wrote:
>>>>
>>>> This patch allows setting REG_EQUAL for ZERO_EXTRACT and handle that in
>>>> cse (where the src for the ZERO_EXTRACT needs to be calculated)
>>>>
>>>> Thanks,
>>>> Kugan
>>>
>>>> From 75e746e559ffd21b25542b3db627e3b318118569 Mon Sep 17 00:00:00 2001
>>>> From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
>>>> Date: Fri, 26 Jun 2015 17:12:07 +1000
>>>> Subject: [PATCH 1/2] Allow adding REG_EQUAL for ZERO_EXTRACT
>>>>
>>>> ---
>>>> gcc/ChangeLog | 6 ++++++
>>>> gcc/cse.c | 41 ++++++++++++++++++++++++++++++++++++++++-
>>>> gcc/emit-rtl.c | 3 ++-
>>>> 3 files changed, 48 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
>>>> index 080aa39..d4a73d6 100644
>>>> --- a/gcc/ChangeLog
>>>> +++ b/gcc/ChangeLog
>>>> @@ -1,3 +1,9 @@
>>>> +2015-06-26 Kugan Vivekanandarajah <kuganv@linaro.org>
>>>> +
>>>> + * cse.c (cse_insn): Calculate src_eqv for ZERO_EXTRACT.
>>>> + * emit-rtl.c (set_for_reg_notes): Allow ZERO_EXTRACT to set
>>>> + REG_EQUAL note.
>>>> +
>>>> 2015-06-25 H.J. Lu <hongjiu.lu@intel.com>
>>>>
>>>> * gentarget-def.c (def_target_insn): Cast return of strtol to
>>>> diff --git a/gcc/cse.c b/gcc/cse.c
>>>> index 100c9c8..8add651 100644
>>>> --- a/gcc/cse.c
>>>> +++ b/gcc/cse.c
>>>> @@ -4531,8 +4531,47 @@ cse_insn (rtx_insn *insn)
>>>> if (n_sets == 1 && REG_NOTES (insn) != 0
>>>> && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0
>>>> && (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl))
>>>> + || GET_CODE (SET_DEST (sets[0].rtl)) == ZERO_EXTRACT
>>>> || GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART))
>>>> - src_eqv = copy_rtx (XEXP (tem, 0));
>>>> + {
>>>> + src_eqv = copy_rtx (XEXP (tem, 0));
>>>> +
>>>> + /* If DEST is of the form ZERO_EXTACT, as in:
>>>> + (set (zero_extract:SI (reg:SI 119)
>>>> + (const_int 16 [0x10])
>>>> + (const_int 16 [0x10]))
>>>> + (const_int 51154 [0xc7d2]))
>>>> + REG_EQUAL note will specify the value of register (reg:SI 119) at this
>>>> + point. Note that this is different from SRC_EQV. We can however
>>>> + calculate SRC_EQV with the position and width of ZERO_EXTRACT. */
>>>> + if (GET_CODE (SET_DEST (sets[0].rtl)) == ZERO_EXTRACT)
>>>
>>> Consider changing
>>>
>>> if (something
>>> && (!rtx_equal_p)
>>> || ZERO_EXTRACT
>>> || STRICT_LOW_PART)
>>>
>>> to
>>>
>>> if (something
>>> && !rtx_equal_p)
>>> {
>>> if (ZERO_EXTRACT)
>>> {
>>> }
>>> else if (STRICT_LOW_PART)
>>> {
>>> }
>>> }
>>>
>>> Otherwise looks good to me, but you still need another approval.
>>
>> Thanks Maxim for the review. How about the attached patch?
>
> Looks good, with a couple of indentation nit-picks below. No need to repost the patch on their account. Wait for another a maintainer's review.
Thanks. Here is the update patch.
Kugan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-adding-REG_EQUAL-for-ZERO_EXTRACT.patch
Type: text/x-diff
Size: 3957 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150705/9ca8205f/attachment.bin>
More information about the Gcc-patches
mailing list