Richard Sandiford wrote: > Also, you need to beware of cases in which operands[1] overlaps > operands[0]. The splitter says: > > [(set (match_dup 2) (match_dup 4)) > (set (match_dup 3) (match_dup 5))] > > and operands[2] is always the highpart: > > operands[2] = gen_highpart(QImode, operands[0]); > > but consider the case in which operands[1] (and thus operands[4]) > is a memory reference that uses the high part of operands[0] as > a base register. In that case, the base register will be modified > by the first split instruction and have the wrong value in the > second split instruction. See other ports for the canonical way > of handling this. > > Richard
By looking at other ports, I learned that I can detect when this happens by using the reg_overlap_mentioned_p(). Here is one case: (insn 43 115 74 (set (reg:HI 7 %i0h) (mem/s/j:HI (plus:HI (reg/f:HI 7 %i0h [orig:39 source ] [39]) (const_int 2 [0x2])) [0 <variable>.r+0 S2 A8])) 3 {*movhi} (nil) (nil)) I need to tell the compiler not to use as destination the same base register when doing index operations. Any suggestions on how do I that? Thanks for your help. -Omar