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]
Other format: [Raw text]

Re: Extension to compare-elim


On 05/15/12 06:00, Paulo J. Matos wrote:
> The RTL for the first two comparisons at compare-elim is:
> (insn 51 3 52 2 (set (reg:CC_NZ 13 CC)
>         (compare:CC_NZ (reg:QI 0 AH [orig:27 a ] [27])
>             (const_int 0 [0]))) b651.c:1 63 {*tstqi}
>      (nil))
> 
> (jump_insn 52 51 34 2 (set (pc)
>         (if_then_else (ge (reg:CC_NZ 13 CC)
>                 (const_int 0 [0]))
>             (label_ref 41)
>             (pc))) b651.c:1 68 {*conditional_branch}
>      (expr_list:REG_BR_PROB (const_int 7900 [0x1edc])
>         (nil))
>  -> 41)
> 
> (code_label 41 43 25 4 6 "" [1 uses])
> 
> (note 25 41 49 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
> 
> (insn 49 25 50 4 (set (reg:CC 13 CC)
>         (compare:CC (reg:QI 0 AH [orig:27 a ] [27])
>             (const_int 0 [0]))) b651.c:1 64 {*cmpqi}
>      (nil))
> 
> (jump_insn 50 49 26 4 (set (pc)
>         (if_then_else (gt (reg:CC 13 CC)
>                 (const_int 0 [0]))
>             (label_ref 13)
>             (pc))) b651.c:1 68 {*conditional_branch}
>      (expr_list:REG_BR_PROB (const_int 7900 [0x1edc])
>         (nil))
>  -> 13)

My question is, why are you generating compares in two different
modes early, before compare-elim runs?  If you hadn't done that,
your redundant compare would already be eliminated.

There's some amount of support for taking a full CCmode and
using SELECT_CC_MODE to find one that fits all the uses, but
that's only used in the places we're trying to replace a clobber.


r~


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