public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* SImode -> DImode optimizations
@ 2002-02-21 21:17 Alan Modra
  2002-02-22  1:33 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2002-02-21 21:17 UTC (permalink / raw)
  To: gcc

What's the correct way to let gcc know that SImode insn patterns
leave the high part of a reg in a known state?  eg.  powerpc has

(define_insn "rotlsi3"
  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
	(rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
		   (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  ""
  "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")

On PowerPC64, this particular insn is guaranteed to leave the high
32 bits of the reg zero.  I'd like to avoid gcc generating
unnecessary zero_extendsidi2 insns.  I know this can be done by
writing appropriate patterns that combine both operations and emit
a single rlwinm machine insn, but that leaves the zero_extend in
the rtl.  What I'm after is a way of zapping the zero_extend, so
that eg.

 rotlsi3
 zero_extendsidi2
 cmpsi 0

is optimized into one insn in the same way as is done for

 rotlsi3
 cmpsi 0

Or do I have to write a bunch of 3 insn combiners?

Hmm, or something different, like specifying the output of rotlsi3
and other similar instructions is really DImode?  If so, how to
do this without breaking things horribly?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: SImode -> DImode optimizations
  2002-02-21 21:17 SImode -> DImode optimizations Alan Modra
@ 2002-02-22  1:33 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2002-02-22  1:33 UTC (permalink / raw)
  To: gcc

On Fri, Feb 22, 2002 at 03:32:38PM +1030, Alan Modra wrote:
> What's the correct way to let gcc know that SImode insn patterns
> leave the high part of a reg in a known state?

Create additional patterns that also contain the zero_extend.  I.e.

  (set (match_operand:DI 0 "gpc_reg_operand" "=r")
       (zero_extend:DI
	 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
		    (match_operand:SI 2 "reg_or_cint_operand" "ri"))))


r~

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

end of thread, other threads:[~2002-02-22  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-21 21:17 SImode -> DImode optimizations Alan Modra
2002-02-22  1:33 ` 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).