public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Henri Cloetens <henri.cloetens@blueice.be>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Question on gcc RTL and scheduling step.
Date: Thu, 27 Feb 2020 07:43:00 -0000	[thread overview]
Message-ID: <41ecc0c2-0bda-f22f-549e-e7fc7b3a8c7f@blueice.be> (raw)
In-Reply-To: <20200226163818.GO22482@gate.crashing.org>

Hello Segher,

- Yes, DImode is a two register mode in my backend.
/static int hard_regno_nregs_internal(int regno, enum machine_mode mod)
{
...
//return (GET_MODE_SIZE (mode) + reg_size - 1) / reg_size;//
}
/- In the example, file "use_manyregs.c.299r.sched2, line 95, I find:

;; *      11--> b  0: i  44 
{{%r31=%r31+0x18;%r0=[%r31+0x10];%r18=[%r31+0x8];clobber %r1;clobber 
%r19;};pc=return;}:LDST**
*
(This is the 'patched' version - I added the 'clobber' statements.)
In the same file, the RTL I emitted:

***(insn:TI 44 27 28 2 (parallel [
             (parallel [
                     (set (reg/f:SI 31 %r31)
                         (plus:SI (reg/f:SI 31 %r31)
                             (const_int 24 [0x18])))
                     (set (reg:DI 0 %r0)
                         (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                 (const_int 16 [0x10])) [2  S8 A64]))
                     (set (reg:DI 18 %r18)
                         (mem/c:DI (plus:SI (reg/f:SI 31 %r31)
                                 (const_int 8 [0x8])) [2  S8 A64]))
                     (clobber:SI (reg:DI 1 %r1))
                     (clobber:SI (reg:DI 19 %r19))
                 ])
             (set (pc)
                 (return))

*Note that, the statement on line 95 does not contain the mode the 
register is used in.
The result of this, is that the scheduler cannot find the operation on 
R18 also clobbers R19.
In my opinion, this is wrong, as the function /hard_regno_nregs()/ is 
correctly defined.
Anyway, the addition of the "clobber" statements fix it.
On the (set (pc) (return)) and (return) statements, I think you are 
right. I mean,
the use of (return) leads to the double "parallel" statement in the RTL. 
(With (set (pc) (return))
there is only one "parallel", and then the tool misunderstands.)

Best Regards,

Henri.
*
*


On 02/26/2020 05:38 PM, Segher Boessenkool wrote:
> [ Top-post do please not. ]
>
> On Wed, Feb 26, 2020 at 04:11:06PM +0100, Henri Cloetens wrote:
>> - On the issue of the restore of R18 in mode DI, it seems from
>>    analysing the log file that the compiler does not understand this
>>    also affects R19. This looks a bug to me ??. Anyway, I have resolved
>>    this, by adding a 'clobber' statement to R19 when R18 is written
>>    in mode 'DI'.
> You haven't showed any evidence like this, so it's hard for use to help
> you with this at all.  *Is* DImode a two register mode in your backend?
>
>> - The other issue, I have changed ((set) (pc) (return)) to (return),
>>    but, as far as I understand the logfiles, and the documentation,
>>    both forms are equivalent. Anyway, after fixing the first issue, I do
>>    not see the second issue any more.
> The docs say
>    Note that an insn pattern of @code{(return)} is logically equivalent to
>    @code{(set (pc) (return))}, but the latter form is never used.
>
> If something is never used, then not everything might expect that form,
> that's all.
>
>
> Segher
>

  reply	other threads:[~2020-02-26 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 15:10 Henri Cloetens
2020-02-26 16:39 ` Segher Boessenkool
2020-02-26 17:02   ` Henri Cloetens
2020-02-26 22:00     ` Segher Boessenkool
2020-02-27  7:43       ` Henri Cloetens [this message]
2020-02-27  9:23         ` Segher Boessenkool

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=41ecc0c2-0bda-f22f-549e-e7fc7b3a8c7f@blueice.be \
    --to=henri.cloetens@blueice.be \
    --cc=gcc-help@gcc.gnu.org \
    --cc=segher@kernel.crashing.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).