gccint: Dependent Patterns

1 
1 17.11 Interdependence of Patterns
1 =================================
1 
1 In some cases machines support instructions identical except for the
1 machine mode of one or more operands.  For example, there may be
1 "sign-extend halfword" and "sign-extend byte" instructions whose
1 patterns are
1 
1      (set (match_operand:SI 0 ...)
1           (extend:SI (match_operand:HI 1 ...)))
1 
1      (set (match_operand:SI 0 ...)
1           (extend:SI (match_operand:QI 1 ...)))
1 
1 Constant integers do not specify a machine mode, so an instruction to
1 extend a constant value could match either pattern.  The pattern it
1 actually will match is the one that appears first in the file.  For
1 correct results, this must be the one for the widest possible mode
1 ('HImode', here).  If the pattern matches the 'QImode' instruction, the
1 results will be incorrect if the constant value does not actually fit
1 that mode.
1 
1  Such instructions to extend constants are rarely generated because they
1 are optimized away, but they do occasionally happen in nonoptimized
1 compilations.
1 
1  If a constraint in a pattern allows a constant, the reload pass may
1 replace a register with a constant permitted by the constraint in some
1 cases.  Similarly for memory references.  Because of this substitution,
1 you should not provide separate patterns for increment and decrement
1 instructions.  Instead, they should be generated from the same pattern
1 that supports register-register add insns by examining the operands and
1 generating the appropriate machine instruction.
1