Article View: gnu.gcc.help
Article #42413Re: GCC inline assembler
From: Hal Peterson
Date: Thu, 07 Dec 1995 00:00
Date: Thu, 07 Dec 1995 00:00
27 lines
1792 bytes
1792 bytes
See the node "Extended Asm" in the gcc manual. In short:
You must specify an assembler instruction template much like what
appears in a machine description, plus an operand constraint string for
each operand.
For example, here is how to use the 68881's `fsinx' instruction:
asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
Here `angle' is the C expression for the input operand while `result'
is that of the output operand. Each has `"f"' as its operand
constraint, saying that a floating point register is required. The `='
in `=f' indicates that the operand is an output; all output operands'
constraints must use `='. The constraints use the same language used
in the machine description (*See Constraints::.).
Each operand is described by an operand-constraint string followed
by the C expression in parentheses. A colon separates the assembler
template from the first output operand, and another separates the last
output operand from the first input, if any. Commas separate output
operands and separate inputs. The total number of operands is limited
to ten or to the maximum number of operands in any instruction pattern
in the machine description, whichever is greater.
--
Hal Peterson NetStar, Inc. Eden Prairie, MN, USA
voice: +1 612 996 6853 FAX: +1 612 943 8939 hrp@netstar.com
Technical Details
Message-ID:
<HRP.95Dec7093151@mondo.netstar.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<30C61C68.41FBAF3B@taavo1.roc.servtech.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,82d94d0499a59db X-Google-Attributes: gid11318c,public From: hrp@netstar.com (Hal Peterson) Subject: Re: GCC inline assembler Date: 1995/12/07 Message-ID: <HRP.95Dec7093151@mondo.netstar.com> X-Deja-AN: 121175726 distribution: world references: <30C61C68.41FBAF3B@taavo1.roc.servtech.com> organization: NetStar, Inc. newsgroups: gnu.gcc.help