gcc: Multi-Alternative

1 
1 6.45.3.2 Multiple Alternative Constraints
1 .........................................
1 
1 Sometimes a single instruction has multiple alternative sets of possible
1 operands.  For example, on the 68000, a logical-or instruction can
1 combine register or an immediate value into memory, or it can combine
1 any kind of operand into a register; but it cannot combine one memory
1 location into another.
1 
1  These constraints are represented as multiple alternatives.  An
1 alternative can be described by a series of letters for each operand.
1 The overall constraint for an operand is made from the letters for this
1 operand from the first alternative, a comma, the letters for this
1 operand from the second alternative, a comma, and so on until the last
1 alternative.  All operands for a single instruction must have the same
1 number of alternatives.
1 
1  So the first alternative for the 68000's logical-or could be written as
1 '"+m" (output) : "ir" (input)'.  The second could be '"+r" (output):
1 "irm" (input)'.  However, the fact that two memory locations cannot be
1 used in a single instruction prevents simply using '"+rm" (output) :
1 "irm" (input)'.  Using multi-alternatives, this might be written as
1 '"+m,r" (output) : "ir,irm" (input)'.  This describes all the available
1 alternatives to the compiler, allowing it to choose the most efficient
1 one for the current conditions.
1 
1  There is no way within the template to determine which alternative was
1 chosen.  However you may be able to wrap your 'asm' statements with
1 builtins such as '__builtin_constant_p' to achieve the desired results.
1