public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Denis Chertykov <chertykov@gmail.com>
To: Georg-Johann Lay <avr@gjlay.de>
Cc: gcc-patches@gcc.gnu.org, Anatoly Sokolov <aesok@post.ru>,
		Eric Weddington <eric.weddington@atmel.com>
Subject: Re: [Patch,AVR]: FIX ICE in optabs due to bad rotate expander.
Date: Sun, 17 Apr 2011 10:23:00 -0000	[thread overview]
Message-ID: <BANLkTimkgPyqGsrE4a_06TEbwYgzG=C1_w@mail.gmail.com> (raw)
In-Reply-To: <4DA880F6.4070109@gjlay.de>

2011/4/15 Georg-Johann Lay <avr@gjlay.de>:
> Denis Chertykov schrieb:
>> 2011/4/14 Georg-Johann Lay <avr@gjlay.de>:
>>> Denis Chertykov schrieb:
>>>> 2011/4/14 Georg-Johann Lay <avr@gjlay.de>:
>>>>> The "rotl<mode>3" expanders (mode \in {HI,SI,DI}) violates synopsis by
>>>>> using 4 operands instead of 3. This runs in ICE in top of
>>>>> optabs.c:maybe_gen_insn.
>>>>>
>>>>> The right way to do this is to use match_dup, not match_operand. So
>>>>> the fix is obvious.
>>>>>
>>>>> Regenerated avr-gcc and run against avr testsuite:
>>>>>
>>>>> gcc.target/avr/torture/pr41885.c generates these patterns
>>>>>
>>>>> Johann
>>>>>
>>>>> 2011-04-14  Georg-Johann Lay  <avr@gjlay.de>
>>>>>
>>>>>        * config/avr/avr.md ("rotlhi3", "rotlsi3", "rotldi3"): Fix
>>>>>        expanders operand 3 from match_operand to match_dup.
>>>> May be better to use (clobber (match_scratch ...)) here and in
>>>> `*rotw<mode>' and `*rotb<mode>'.
>>> These are splitters that might split before reload, producing strange,
>>> non-matching insns like
>>>  (set (scratch:QI) ...
>>> or crashing already in avr_rotate_bytes becase the split condition reads
>>> "&& (reload_completed || <MODE>mode == DImode)"
>>
>> Generally I'm agree with you, change match_operand to match_dup is easy.
>
> I already submitted the easy patch to avoid the ICE.
>
>> But IMHO the right way is:
>>  - the splitters and avr_rotate_bytes are wrong and must be fixed too.
>>  - operands[3] is a scratch register and right way is to use match_scratch.
>>
>> I can approve the patch.
>>
>> Denis.
>
> Ok, here is the right-way patch.
>
> The expander generates a SCRATCH instead of a pseudo, and in case of a
> pre-reload split the SCRATCH is replaced with a pseudo because it is
> not known if or if not the scratch will actually be needed.
>
> avr_rotate_bytes now skips operations on non-REG 'scratch'.
> Furthermore, I added an assertion that ensures that 'scratch' is
> actually a REG when it is needed.
>
> Besides that, I fixed indentation. I know it is not optimal to fix
> indentation alongside with functionality... did it anyway :-)
>
> Finally, I exposed alternative #3 of the insns to the register
> allocator, because it is not possible to distinguish between
> overlapping or non-overlapping regs, and #3 does not need a scratch.
>
> Ran C-testsuite with no regressions.

Are you encountered any difference in code size ?

Denis.

  reply	other threads:[~2011-04-17  9:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 10:25 Georg-Johann Lay
2011-04-14 16:21 ` Denis Chertykov
2011-04-14 17:20   ` Georg-Johann Lay
2011-04-14 18:15     ` Denis Chertykov
2011-04-15 17:56       ` Georg-Johann Lay
2011-04-17 10:23         ` Denis Chertykov [this message]
2011-04-17 19:43           ` Denis Chertykov
2011-04-18 11:10             ` Georg-Johann Lay
2011-04-18 16:35               ` Denis Chertykov
2011-04-18 16:46                 ` Denis Chertykov
2011-04-19  9:46                 ` Georg-Johann Lay
2011-04-19 10:16                   ` Denis Chertykov
2011-04-19 10:36                     ` Georg-Johann Lay
2011-04-19 12:07                       ` Denis Chertykov
2011-04-19 13:15                         ` Richard Earnshaw
2011-04-20 17:44                     ` Richard Henderson
2011-04-20 11:25             ` Georg-Johann Lay
2011-04-20 12:56               ` Denis Chertykov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTimkgPyqGsrE4a_06TEbwYgzG=C1_w@mail.gmail.com' \
    --to=chertykov@gmail.com \
    --cc=aesok@post.ru \
    --cc=avr@gjlay.de \
    --cc=eric.weddington@atmel.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).