[Sorry, pressed the wrong key combination again for the other mail... ] On Friday 14 October 2005 01:41, Evan Cheng wrote: > gcc produces the following code:
You're not giving enough information for me to reproduce it. I used "-O2 -march=i686 -dAP" for the follow annotated assembler output: #(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 cmpl is not needed because subl has already set the flags. And as you already noticed, we don't actually model that in this case. > My question is: where and how would you suggest we do this > optimization. combine. > With peephole2? You'd get an explosion of peephole patterns. Gr. Steven