This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3 RFC] PATCH to memory asm ops in atomicity.h
On Thu, 18 Dec 2003 11:58:32 -0800, Richard Henderson <rth@redhat.com> wrote:
> On Thu, Dec 18, 2003 at 12:14:52PM -0500, Jason Merrill wrote:
>> Are you also agreeing that "+m" is converted into a matching restraint?
>
> Yes, it is.
OK. Doc patch follows. Would you suggest that expand_asm_operands warn if
we see either an in/out operand or a matching restraint that doesn't allow
a register?
*** extend.texi.~1~ 2003-11-26 10:22:46.000000000 -0500
--- extend.texi 2003-12-18 15:35:21.000000000 -0500
*************** The ordinary output operands must be wri
*** 3908,3925 ****
the values in these operands before the instruction are dead and need
not be generated. Extended asm supports input-output or read-write
operands. Use the constraint character @samp{+} to indicate such an
! operand and list it with the output operands.
!
! When the constraints for the read-write operand (or the operand in which
! only some of the bits are to be changed) allows a register, you may, as
! an alternative, logically split its function into two separate operands,
! one input operand and one write-only output operand. The connection
! between them is expressed by constraints which say they need to be in
! the same location when the instruction executes. You can use the same C
! expression for both operands, or different expressions. For example,
! here we write the (fictitious) @samp{combine} instruction with
! @code{bar} as its read-only source operand and @code{foo} as its
! read-write destination:
@example
asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
--- 3908,3926 ----
the values in these operands before the instruction are dead and need
not be generated. Extended asm supports input-output or read-write
operands. Use the constraint character @samp{+} to indicate such an
! operand and list it with the output operands. You should only use
! read-write operands when the constraints for the operand (or the
! operand in which only some of the bits are to be changed) allow a
! register.
!
! You may, as an alternative, logically split its function into two
! separate operands, one input operand and one write-only output
! operand. The connection between them is expressed by constraints
! which say they need to be in the same location when the instruction
! executes. You can use the same C expression for both operands, or
! different expressions. For example, here we write the (fictitious)
! @samp{combine} instruction with @code{bar} as its read-only source
! operand and @code{foo} as its read-write destination:
@example
asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));