------- Comment #2 from zadeck at naturalbridge dot com 2006-09-14 12:51 ------- Subject: Re: useless clrlwi instruction produced for 16-bit bitfield
bonzini at gnu dot org wrote: > ------- Comment #1 from bonzini at gnu dot org 2006-09-14 12:07 ------- > The sole difference in the IR is > > ;; if ((int) node->x == a) goto <L0>; else (void) 0; > (insn 19 18 20 (set (reg:HI 125) > (mem/s/j:HI (reg/v/f:SI 123 [ node ]) > [2 <variable>.x+0 S2 A32])) -1 (nil) > > ;; if ((int) MEM[base: (short unsigned int *) node] == a) goto <L0>; else > (void) 0; > (insn 20 19 21 (set (reg:HI 125) > (mem/s:HI (reg/v/f:SI 123 [ node ]) > [3 <variable>.x+0 S2 A8])) -1 (nil) > (nil)) > > (COMPONENT_REF vs. TARGET_MEM_REF, the first produces A32 and the second A8) > > > ---- > > > It's actually flow's fault, because it fails to recognize a PRE_MODIFY > address, > and things go downhill from there: life1 dump is > > 16 r121:SI=r121:SI+0x1 | 17 r122:SI=r122:SI+0x1 > 18 r123:SI=r123:SI-0x4 | 20 r126:HI=[--r124:SI] > 19 r125:HI=[r123:SI] | REG_INC: r124:SI > 20 r124:SI=zero_extend(r125:HI) | 21 r125:SI=zero_extend(r126:HI) > REG_DEAD: r125:HI | REG_DEAD: r126:HI > 21 r126:CC=cmp(r124:SI,r121:SI) | 22 r127:CC=cmp(r125:SI,r122:SI) > REG_DEAD: r124:SI | REG_DEAD: r125:SI > 22 pc={(r126:CC==0x0)?L13:pc} | 23 pc={(r127:CC==0x0)?L14:pc} > REG_DEAD: r126:CC | REG_DEAD: r127:CC > REG_BR_PROB: 0x22c4 REG_BR_PROB: 0x22c4 > 24 NOTE_INSN_BASIC_BLOCK | 25 NOTE_INSN_BASIC_BLOCK > 28 NOTE_INSN_FUNCTION_END | 29 NOTE_INSN_FUNCTION_END > 31 r3:SI=r121:SI | 32 r3:SI=r122:SI > REG_DEAD: r121:SI | REG_DEAD: r122:SI > 37 use r3:SI | 38 use r3:SI > > while combine dump is > > 14 NOTE_INSN_BASIC_BLOCK | 15 NOTE_INSN_BASIC_BLOCK > 16 r121:SI=r121:SI+0x1 | 17 r122:SI=r122:SI+0x1 > 18 NOTE_INSN_DELETED | 20 NOTE_INSN_DELETED > 19 {r125:HI=[r123:SI-0x4];r123:SI= | 21 r125:SI=zero_extend([--r124:SI] > 20 r124:SI=zero_extend(r125:HI) | REG_INC: r124:SI > REG_DEAD: r125:HI | 22 r127:CC=cmp(r125:SI,r122:SI) > 21 r126:CC=cmp(r124:SI,r121:SI) | REG_DEAD: r125:SI > REG_DEAD: r124:SI > > where it has synthesized a movsi_movhi_update1, but then failed to implement > the merged. > > Could this be fixed on dataflow-branch? > > > The current flow does not recognize any pre modify cases. What flow does do is recognize pre_increment, which is a subset of pre_modify that has the restriction that the width of the load be equal to the amount of the increment. By changing the type of x, you made the example fit into the restrictions of the current code. The post side of things in flow is a little more general than the pre side because this was hacked for the ia-64. My code on the dataflow branch knows what the machine is capable of doing and would get this case, since the ppc is capable of much more general updates. Kenny -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29083