This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Why can't CSE recognize const_int's in HIGH LO_SUM pair?


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]