public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Why can't CSE recognize const_int's in HIGH LO_SUM pair?
@ 2001-09-07 16:07 John David Anglin
  2001-09-07 17:03 ` Richard Henderson
  0 siblings, 1 reply; 27+ messages in thread
From: John David Anglin @ 2001-09-07 16:07 UTC (permalink / raw)
  To: gcc

In looking into the failure of 20010119-1.c at -O1 on the PA, I am wondering
why large constant values in HIGH LO_SUM pairs aren't recognized in jump
expansion?  For example, we have the following situation comparing 10 and
20000:

(insn 10 5 12 (set (reg/v:SI 95)
        (const_int 10 [0xa])) -1 (nil)
    (nil))

...

(insn/i 24 70 25 (set (reg:SI 99)
        (high:SI (const_int 20000 [0x4e20]))) -1 (nil)
    (nil))

(insn/i 25 24 26 (set (reg:SI 100)
	(lo_sum:SI (reg:SI 99)
	    (const_int 20000 [0x4e20]))) -1 (nil)
    (nil))

(jump_insn/i 26 25 71 (set (pc)
	(if_then_else (le (reg/v:SI 95)
		(reg:SI 100))
	    (label_ref 30)
	    (pc))) -1 (nil)
    (nil))

If I reduce the constant 20000 to 8191 so that it can be loaded in a single
insn, we get for the initial rtl:

(insn/i 24 23 25 (set (reg:SI 99)
        (const_int 8191 [0x1fff])) -1 (nil)
    (nil))

(jump_insn/i 25 24 26 (set (pc)
	(label_ref 30)) 270 {jump} (nil)
(nil))

and the dead code branch gets eliminated.  At higher opt levels, it appears
the loop pass detects the HIGH LO_SUM pair and deletes the dead code.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: Why can't CSE recognize const_int's in HIGH LO_SUM pair?
@ 2001-09-08 17:21 Richard Kenner
  0 siblings, 0 replies; 27+ messages in thread
From: Richard Kenner @ 2001-09-08 17:21 UTC (permalink / raw)
  To: rth; +Cc: gcc

    If you ask Alpha to load 0x10001000, you'll get

	(set (reg) (const_int 0x10000000))
	(set (reg) (plus (reg) (const_int 0x1000))

    which is exactly what the machine code is doing.  No need for
    high/lo_sum, and by not using them, we expose the exact constant
    fragments to cse/combine/etc.

That's true for integers, but not symbolic constants.

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

end of thread, other threads:[~2001-09-24 10:25 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-07 16:07 Why can't CSE recognize const_int's in HIGH LO_SUM pair? John David Anglin
2001-09-07 17:03 ` Richard Henderson
2001-09-07 18:30   ` John David Anglin
2001-09-08 11:40     ` Richard Henderson
2001-09-08 12:50       ` John David Anglin
2001-09-08 12:58         ` Jan Hubicka
2001-09-08 13:09         ` Richard Henderson
2001-09-08  2:28   ` Bernd Schmidt
2001-09-08 10:18     ` John David Anglin
2001-09-10  9:21       ` law
2001-09-10  9:59         ` Richard Henderson
2001-09-10 10:04           ` David Edelsohn
2001-09-10 10:17           ` Daniel Berlin
2001-09-10 10:28           ` law
2001-09-10 10:44             ` Richard Henderson
2001-09-10 11:09               ` Daniel Berlin
2001-09-10 11:32                 ` Richard Henderson
2001-09-10 11:46                   ` Daniel Berlin
2001-09-10 11:50               ` law
2001-09-10 20:12                 ` John David Anglin
2001-09-24  9:37                   ` law
2001-09-24 10:02                     ` John David Anglin
2001-09-24 10:15                       ` law
2001-09-24 10:19                         ` John David Anglin
2001-09-24 10:25                           ` law
2001-09-08 11:36     ` Richard Henderson
2001-09-08 17:21 Richard Kenner

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