Need advice: x86 redudant compare to zero

Uros Bizjak uros@kss-loka.si
Sat Oct 15 16:55:00 GMT 2005


Hello Steven!

>#(insn:TI 126 125 40 (parallel [
>#            (set (reg:SI 0 ax [71])
>#                (minus:SI (reg:SI 0 ax [71])
>#                    (reg:SI 5 di)))
>#            (clobber (reg:CC 17 flags))
>#        ]) 242 {*subsi_1} (insn_list:REG_DEP_TRUE 125 (insn_list:REG_DEP_TRUE 37 (nil)))
>#    (expr_list:REG_DEAD (reg:SI 5 di)
>#        (expr_list:REG_UNUSED (reg:CC 17 flags)
>#            (nil))))
>        subl    %edi, %eax      # 126   *subsi_1/1      [length = 2]
>#(insn:TI 40 126 41 (set (reg:CC 17 flags)
>#        (compare:CC (reg:SI 0 ax [71])
>#            (const_int 0 [0x0]))) 5 {*cmpsi_1_insn} (insn_list:REG_DEP_TRUE 126 (nil))
>#    (expr_list:REG_DEAD (reg:SI 0 ax [71])
>#        (nil)))
>        cmpl    $0, %eax        # 40    *cmpsi_1_insn/1 [length = 3]
>
The combination of these two insn will fail "*subsi_2", because 
"*subsi_2" is constrainted with:

  "ix86_match_ccmode (insn, CCGOCmode)
   && ix86_binary_operator_ok (MINUS, SImode, operands)"

Please note that insn 40 is CCmode compare with const_int 0. Perhaps 
insn 40 should be generated as "cmpsi_minus_1" pattern instead? 
"cmpsi_minus_1" looks similar to "*subsi_2" compare part.

The question is, if combine is smart enough to make a parallel of these 
two instructions.

Uros.



More information about the Gcc-patches mailing list