public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Barada <pbarada@mail.wm.sps.mot.com>
To: rth@redhat.com
Cc: Peter.Barada@motorola.com, gcc@gcc.gnu.org, Peter.Barada@motorola.com
Subject: Re: Illegal code generation: gcc-3.2 --target=m68k-elf
Date: Tue, 22 Oct 2002 10:49:00 -0000	[thread overview]
Message-ID: <200210221529.g9MFTJr21005@hyper.wm.sps.mot.com> (raw)
In-Reply-To: <20021022062737.GD15658@redhat.com> (message from Richard Henderson on Mon, 21 Oct 2002 23:27:37 -0700)


>> (insn 690 689 691 (set (subreg:SI (reg/v:HI 40) 0)
>>         (plus:SI (subreg:SI (reg/v:HI 40) 0)
>>             (const_int 1 [0x1]))) 99 {*addsi3_5200} (nil)
>>     (nil))
>> 
>> Looks like combine put the two instructions together, but there is no
>> instruction in the ColdFire that can allow for this to happen (I guess
>> it found the pattern for addhi3 and assumed that it is valid for
>> ColdFire?).
>
>No.  The constraints for addsi3_5200 say it's valid.  And indeed
>it would be if R40 were allocated to a register.

Ok, so the add is valid, but this RTL has to be broken up into insns
later since the add can't deal with the subregs, right?


>> (insn 690 1150 691 (set (mem:SI (plus:SI (reg/f:SI 14 %a6)
>>                 (const_int -428 [0xfffffe54])) [0 rotate S4 A16])
>>         (plus:SI (mem:SI (plus:SI (reg/f:SI 14 %a6)
>>                     (const_int -428 [0xfffffe54])) [0 rotate S4 A16])
>>             (reg:SI 0 %d0))) 99 {*addsi3_5200} (nil)
>>     (nil))
>> 
>> Now the RTL is bogus since the store to memory is *SImode* wide
>> whereas the original variable is HImode.
>
>Are you _sure_ you're showing us everything?  There should have
>been some inefficient jiggery-pokery with subreg reloads.  This
>should not have been the real stack slot for R40, but somewhere
>else.

I don't see *any* fiddling with subregs.  I would have expected to see
a HImode load into a regieter, followed by the SImode add, followed by
an HImode store into the stack slot, but no.  I thought I got
everything relavent.  Here's *every* references to R40 from
yy.c.20.lreg:  

(note 21 20 22 ("yy.c") 554)

(insn 22 21 23 (set (reg/v:HI 40)
        (const_int 0 [0x0])) 33 {*m68k.md:1024} (nil)
    (nil))

...

(note 522 521 523 ("yy.c") 622)

(insn 523 522 524 (set (reg/v:HI 40)
        (const_int 0 [0x0])) 33 {*m68k.md:1024} (nil)
    (nil))

...

(insn 677 676 678 (set (reg:SI 182)
        (and:SI (subreg:SI (reg/v:HI 40) 0)
            (const_int 3 [0x3]))) 177 {andsi3_5200} (nil)
    (nil))

...

(note 688 687 689 ("yy.c") 640)

(note 689 688 690 NOTE_INSN_DELETED)

(insn 690 689 691 (set (subreg:SI (reg/v:HI 40) 0)
        (plus:SI (subreg:SI (reg/v:HI 40) 0)
            (const_int 1 [0x1]))) 99 {*addsi3_5200} (nil)
    (nil))


R40's name is 'rotate', and here's *every* referneces to 'rotate' or
R40 from yy.c.21.greg(including context):

Reloads for insn # 22
Reload 0: reload_out (HI) = (reg/v:HI 40)
	DATA_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
	reload_out_reg: (reg/v:HI 40)
	reload_reg_rtx: (reg:HI 0 %d0)

...

Reloads for insn # 523
Reload 0: reload_out (HI) = (reg/v:HI 40)
	DATA_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
	reload_out_reg: (reg/v:HI 40)
	reload_reg_rtx: (reg:HI 0 %d0)
...

Reloads for insn # 677
Reload 0: reload_in (SI) = (const_int 3 [0x3])
	reload_out (SI) = (reg:SI 0 %d0 [182])
	DATA_REGS, RELOAD_OTHER (opnum = 0)
	reload_in_reg: (const_int 3 [0x3])
	reload_out_reg: (reg:SI 0 %d0 [182])
	reload_reg_rtx: (reg:SI 0 %d0 [182])
Reload 1: reload_in (HI) = (reg/v:HI 40)
	DATA_REGS, RELOAD_FOR_INPUT (opnum = 2), optional
	reload_in_reg: (reg/v:HI 40)

...

Reloads for insn # 690
Reload 0: reload_in (SI) = (const_int 1 [0x1])
	DATA_REGS, RELOAD_FOR_INPUT (opnum = 2)
	reload_in_reg: (const_int 1 [0x1])
	reload_reg_rtx: (reg:SI 0 %d0)

...

(note 21 20 22 ("yy.c") 554)

(insn 22 21 1023 (set (reg:HI 0 %d0)
        (const_int 0 [0x0])) 33 {*m68k.md:1024} (nil)
    (nil))

(insn 1023 22 23 (set (mem:HI (plus:SI (reg/f:SI 14 %a6)
                (const_int -428 [0xfffffe54])) [0 rotate S2 A16])
        (reg:HI 0 %d0)) 33 {*m68k.md:1024} (nil)
    (nil))

...

(note 522 521 523 ("yy.c") 622)

(insn 523 522 1114 (set (reg:HI 0 %d0)
        (const_int 0 [0x0])) 33 {*m68k.md:1024} (nil)
    (nil))

(insn 1114 523 524 (set (mem:HI (plus:SI (reg/f:SI 14 %a6)
                (const_int -428 [0xfffffe54])) [0 rotate S2 A16])
        (reg:HI 0 %d0)) 33 {*m68k.md:1024} (nil)
    (nil))

...

(note 674 671 939 ("yy.c") 639)

;; Start of basic block 32, registers live: 10 [%a2] 14 [%a6] 15 [%sp] 33 34 35 37 38 39 40 41 43 46 62
(note 939 674 675 [bb 32] NOTE_INSN_BASIC_BLOCK)

(note 675 939 676 NOTE_INSN_DELETED)

(note 676 675 1142 NOTE_INSN_DELETED)

(insn 1142 676 677 (set (reg:SI 0 %d0 [182])
        (const_int 3 [0x3])) 30 {*m68k.md:993} (nil)
    (nil))

(insn 677 1142 678 (set (reg:SI 0 %d0 [182])
        (and:SI (reg:SI 0 %d0 [182])
            (mem:SI (plus:SI (reg/f:SI 14 %a6)
                    (const_int -428 [0xfffffe54])) [0 rotate S4 A16]))) 177 {andsi3_5200} (nil)
    (nil))

(insn 678 677 679 (set (reg/f:SI 8 %a0 [183])
        (plus:SI (reg/f:SI 14 %a6)
            (reg:SI 0 %d0 [182]))) 99 {*addsi3_5200} (insn_list 677 (nil))
    (nil))

...

(note 688 687 689 ("yy.c") 640)

(note 689 688 1150 NOTE_INSN_DELETED)

(insn 1150 689 690 (set (reg:SI 0 %d0)
        (const_int 1 [0x1])) 30 {*m68k.md:993} (nil)
    (nil))

(insn 690 1150 691 (set (mem:SI (plus:SI (reg/f:SI 14 %a6)
                (const_int -428 [0xfffffe54])) [0 rotate S4 A16])
        (plus:SI (mem:SI (plus:SI (reg/f:SI 14 %a6)
                    (const_int -428 [0xfffffe54])) [0 rotate S4 A16])
            (reg:SI 0 %d0))) 99 {*addsi3_5200} (nil)
    (nil))



Hopefully this is enough information.  I'm still cutting the testcase
down to size...  I hope to have a bug report soon.


-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

  reply	other threads:[~2002-10-22 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-21 18:11 Peter Barada
2002-10-22  3:48 ` Richard Henderson
2002-10-22 10:49   ` Peter Barada [this message]
2002-10-22 11:16     ` Richard Henderson
2002-10-22 11:18       ` Peter Barada
2002-10-22 14:20       ` Peter Barada
2002-10-22 21:00     ` Joel Sherrill
2002-10-23 18:19       ` Peter Barada
2002-10-23 18:39         ` Joel Sherrill
2002-10-23 21:23           ` Peter Barada

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=200210221529.g9MFTJr21005@hyper.wm.sps.mot.com \
    --to=pbarada@mail.wm.sps.mot.com \
    --cc=Peter.Barada@motorola.com \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@redhat.com \
    /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).