public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Combine on IA-64
@ 2002-02-26  6:18 Jakub Jelinek
  2002-02-26 10:12 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-02-26  6:18 UTC (permalink / raw)
  To: gcc

Hi!

With the visibility patch I've noticed IA-64 generates
pretty inefficient code like:
        addl r15 = @gprel(l#), gp
        addl r16 = @gprel(m#), gp
        ;;
        .mii
        // cycle 1
        adds r15 = 10, r15
        adds r16 = 10, r16

instead of:
	addl r15 = @gprel(l#+10), gp
	addl r16 = @gprel(m#+10), gp

I've tried to fix this using peephole2, but that doesn't work too well,
since the two instructions aren't usually adjacent.
Now, as I understand, symbolic_operand accepts
(const (plus:DI (symbol_ref:DI ("@foo")) (const_int )))
just fine, so this looks like combiner inefficiency.
try_combine for:

i2:
(insn 9 18 12 (parallel[
            (set (reg/f:DI 340)
                (symbol_ref:DI ("@l")))
            (clobber (reg:DI 341))
            (use (reg:DI 1 r1))
        ] ) 5 {movdi_symbolic} (nil)
    (expr_list:REG_UNUSED (reg:DI 341)
        (expr_list:REG_EQUAL (symbol_ref:DI ("@l"))
            (nil))))

i3:
(insn 12 9 14 (set (reg/f:DI 343)
        (plus:DI (reg/f:DI 340)
            (const_int 10 [0xa]))) 90 {adddi3} (insn_list 9 (nil))
    (expr_list:REG_DEAD (reg/f:DI 340)
        (expr_list:REG_EQUAL (const:DI (plus:DI (symbol_ref:DI ("@l"))
                    (const_int 10 [0xa])))
            (nil))))

only attempts to recognize:

(set (reg/f:DI 343)
     (const (plus:DI (symbol_ref:DI ("@l"))
		     (const_int 10 [0xa]))))

and not

(parallel[
	(set (reg/f:DI 343)
	     (const (plus:DI (symbol_ref:DI ("@l"))
			     (const_int 10 [0xa]))))
	(clobber (reg:DI 341))
	(use (reg:DI 1 r1))
	] )

Cannot this be special cased in try_combine (there is already some other
similar special case which fails because i3's SET_SRC is not
register but PLUS) provided the clobbers aren't mentioned between i2 and i3
and uses are not modified in between?

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Combine on IA-64
  2002-02-26  6:18 Combine on IA-64 Jakub Jelinek
@ 2002-02-26 10:12 ` Richard Henderson
  2002-02-26 10:26   ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2002-02-26 10:12 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc

On Tue, Feb 26, 2002 at 02:50:31PM +0100, Jakub Jelinek wrote:
> Cannot this be special cased in try_combine (there is already some other
> similar special case which fails because i3's SET_SRC is not
> register but PLUS) provided the clobbers aren't mentioned between i2 and i3
> and uses are not modified in between?

I think better is to do

(define_split
  [(set (match_operand:DI 0 "register_operand" "")
        (match_operand:DI 1 "symbolic_operand" ""))]
  ""
  [(const_int 0)]
  "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")



r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Combine on IA-64
  2002-02-26 10:12 ` Richard Henderson
@ 2002-02-26 10:26   ` Jakub Jelinek
  2002-02-26 10:58     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2002-02-26 10:26 UTC (permalink / raw)
  To: Richard Henderson, gcc

On Tue, Feb 26, 2002 at 10:08:46AM -0800, Richard Henderson wrote:
> On Tue, Feb 26, 2002 at 02:50:31PM +0100, Jakub Jelinek wrote:
> > Cannot this be special cased in try_combine (there is already some other
> > similar special case which fails because i3's SET_SRC is not
> > register but PLUS) provided the clobbers aren't mentioned between i2 and i3
> > and uses are not modified in between?
> 
> I think better is to do
> 
> (define_split
>   [(set (match_operand:DI 0 "register_operand" "")
>         (match_operand:DI 1 "symbolic_operand" ""))]
>   ""
>   [(const_int 0)]
>   "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")

It is already there (well, define_insn_and_split, but I thought it
is the same).
But it is split during first schedule, not before, so nobody
combines into load_gprel.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Combine on IA-64
  2002-02-26 10:26   ` Jakub Jelinek
@ 2002-02-26 10:58     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2002-02-26 10:58 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc

On Tue, Feb 26, 2002 at 01:14:15PM -0500, Jakub Jelinek wrote:
> > (define_split
> >   [(set (match_operand:DI 0 "register_operand" "")
> >         (match_operand:DI 1 "symbolic_operand" ""))]
> >   ""
> >   [(const_int 0)]
> >   "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")
> 
> It is already there (well, define_insn_and_split, but I thought it
> is the same).

No, the input pattern is different.



r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-26 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26  6:18 Combine on IA-64 Jakub Jelinek
2002-02-26 10:12 ` Richard Henderson
2002-02-26 10:26   ` Jakub Jelinek
2002-02-26 10:58     ` Richard Henderson

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).