[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several rules on the usage of stack-like regs in asm_operands insns. These rules apply only to the operands that are stack-like regs:
An input reg that is implicitly popped by the asm must be explicitly clobbered, unless it is constrained to match an output operand.
All implicitly popped input regs must be closer to the top of the reg-stack than any input that is not implicitly popped.
It is possible that if an input dies in an insn, reload might use the input reg for an output reload. Consider this example:
asm ("foo" : "=t" (a) : "f" (b)); |
This asm says that input B is not popped by the asm, and that the asm pushes a result onto the reg-stack, i.e., the stack is one deeper after the asm than it was before. But, it is possible that reload will think that it can use the same reg for both the input and the output, if input B dies in this insn.
If any input operand uses the f
constraint, all output reg
constraints must use the &
earlyclobber.
The asm above would be written as
asm ("foo" : "=&t" (a) : "f" (b)); |
Output operands must specifically indicate which reg an output
appears in after an asm. =f
is not allowed: the operand
constraints must select a class with a single reg.
Output operands must start at the top of the reg-stack: output operands may not "skip" a reg.
Here are a couple of reasonable asms to want to write. This asm takes one input, which is internally popped, and produces two outputs.
asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp)); |
This asm takes two inputs, which are popped by the fyl2xp1
opcode,
and replaces them with one output. The user must code the st(1)
clobber for reg-stack.c to know that fyl2xp1
pops both inputs.
asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)"); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |