[PATCH] REG_EQUAL notes on cond_jumps.

John David Anglin dave@hiauly1.hia.nrc.ca
Wed May 14 21:29:00 GMT 2003


Hi Roger,

> For example, pa.md doesn't support comparison with large immediate
> constants in a single instruction.  As a result code such as the
> following (reduced from 20010119-1.c) was failing to be optimized:
> 
> void foo()
> {
>   int a = 10;
>   int b = 20000;
>   if (a > b)
>     link_error();
> }

This is an over simplification of the problem.  The above testcase
doesn't fail on 3.[3-4] at -O1, -O2 or -O3.  The if is optimized away
in the cse pass.

20010119-1.c doesn't fail at -O1.  The jump is simplified in the cse
pass.  It does fail at -O2.  The difference might be:

(insn 24 67 25 3 7afd0270 (set (reg:SI 100)
        (high:SI (constant_p_rtx:SI (reg/v:SI 95 [ a ])))) -1 (nil)
    (nil))

(insn 25 24 26 3 7afd0270 (set (reg:SI 99)
	(lo_sum:SI (reg:SI 100)
	    (constant_p_rtx:SI (reg/v:SI 95 [ a ])))) -1 (nil)
    (nil))

versus

(insn 25 67 26 1 7afd1330 (set (reg:SI 99)
        (constant_p_rtx:SI (reg/v:SI 95 [ a ]))) 37 {*pa.md:2265} (nil)
    (nil))

The cse pass generates the latter form for insn 25 but possibly
it doesn't know how to use it for jump simplification.  Anyway, it
is a puzzle why cse can simplify the jump in 20010119-1.c at -O1
but not at -O2.

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



More information about the Gcc-patches mailing list