http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60763
--- Comment #14 from Michael Meissner <meissner at linux dot vnet.ibm.com> --- On Tue, Apr 08, 2014 at 03:21:13PM +0000, dje at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60763 > > --- Comment #13 from David Edelsohn <dje at gcc dot gnu.org> --- > Gentlemen, I really do not understand this discussion. > > I used the term "crude" and receive a response that it is not crude, but it is > dangerous. WTF? Why is anyone trying to "sell" the patch when I repeatedly > have > said that I do not disagree with it in principle? I only am trying to ensure > that this is the right use of the GCC API. i386 uses this idiom a lot; rs6000 > does not. > > I see multiple responses trying to convince me of a patch with which I already > agree and no one writing a one line comment. When you are doing a subreg type operation, before reload, you must NOT use the register number directly. This is the dangerous part that was mentioned. Hence using gen_highpart, gen_lowpart, or simplify_gen_subreg is the appropriate solution. If you are doing splits after reload, and are dealing with whole registers, the preferred solution is to create a new REG with the appropriate register number. In particular, gen_highpart and gen_lowpart must not be used after reload. However, up until the patch to add more checking, simplify_gen_subreg could be used after reload. The alpha, arm, i386, ia64, iq2000, m32k, m68k, mips, msp430, pa, pdp11, picochip, rl78, rs6000, s390, sh, sparc, spu, and xtensa all generate a call to gen_rtx_REG using REGNO of an operand to change types. Out of force of habit, I've tended to use simplify_gen_subreg when doing splitting, no matter whether it is before or after reload. I thought with 'simplify' in the name, it would do the right thing after reload, but evidently it does not.