Contents|Index|Previous|Next
Constraints
for particular machines
Whenever possible, you should
use the general-purpose constraint letters in asm
arguments, since they will convey meaning more readily to people reading
your code. Failing that, use the constraint letters that usually have very
similar meanings across architectures. The most commonly used constraints
are m
and r
(for memory and general-purpose registers respectively; see Simple
constraints) and I,
usually the letter indicating the most common immediate-constant format.
For each machine architecture, the config/machine.h
file defines additional constraints. These constraints are used by the
compiler itself for instruction generation, as well as for asm
statements; therefore, some of the constraints are not particularly interesting
for asm.
The constraints are defined
through the following macros.
-
REG_CLASS_FROM_LETTER
Register class constraints
(usually lower case).
-
CONST_OK_FOR_LETTER_P
Immediate constant constraints,
for non-floating point constants of word size or smaller precision (usually
upper case).
-
CONST_DOUBLE_OK_FOR_LETTER_P
Immediate constant constraints,
for all floating point constants and for constants of greater than word
size precision (usually upper case).
-
EXTRA_CONSTRAINT
Special cases of registers
or memory. This macro is not required, and is only defined for some machines.
Inspecting these macro definitions
in the compiler source for your machine is the best way to be certain you
have the right constraints. However, see the following summary of the machine-dependent
constraints available on some particular machines.
ARM
familyarm.h
-
f
-
F
One of the floating-point
constants 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0 or 10.0
-
G
Floating-point constant
that would satisfy the constraint F
if it were negated
-
I
Integer that is valid as
an immediate operand in a data processing instruction. That is, an integer
in the range 0 to 255 rotated by a multiple of 2
-
J
Integer in the range -4095
to 4095
-
K
Integer that satisfies constraint
I
when inverted (ones complement)
-
L
Integer that satisfies constraint
I
when negated (twos complement)
-
M
Integer in the range 0 to
32
-
Q
A memory reference where
the exact address is in a single register (m
is preferable for asm
statements)
-
R
An item in the constant
pool
-
S
A symbol in the text segment
of the current file
AMD
29000 familya29k.h
-
l
-
b
Byte Pointer (BP)
register
-
q
-
h
-
A
First accumulator register
-
a
Other accumulator register
-
f
-
I
Constant greater than 0,
less than 0x100
-
J
Constant greater than 0,
less than 0x10000
-
K
Constant whose high 24 bits
are on (1)
-
L
16 bit constant whose high
8 bits are on (1)
-
M
32 bit constant whose high
16 bits are on (1)
-
N
32 bit negative constant
that fits in 8 bits
-
O
The constant 0x80000000
or, on the 29050, any 32 bit constant whose low 16 bits are 0
-
P
16 bit negative constant
that fits in 8 bits
-
G,
H
A floating point constant
(in asm
statements, use the machine independent E
or F
instead)
IBM
RS6000rs6000.h
-
b
-
f
-
h
MQ,
CTR,
or LINK
register
-
q
-
c
-
l
-
x
CR
register (condition register) number 0
-
y
CR
register (condition register)
-
I
-
J
Constant whose low 16 bits
are 0
-
K
Constant whose high 16 bits
are 0
-
L
Constant suitable as a mask
operand
-
M
-
N
-
O
-
P
Constant whose negation
is a signed 16 bit constant
-
G
Floating point constant
that can be loaded into a register with one instruction per word
-
Q
Memory operand that is an
offset from a register (m
is preferable for asm
statements)
-
R
-
S
-
T
-
U
System V Release 4 small
data area reference
Intel
386i386.h
-
q
a,
b,
c,or
d
register
-
A
a,
or d
register (for 64-bit ints)
-
f
-
t
First (top of stack) floating
point register
-
u
Second floating point register
-
a
-
b
-
c
-
d
-
D
-
S
-
I
Constant in range 0 to 31
(for 32 bit shifts)
-
J
Constant in range 0 to 63
(for 64 bit shifts)
-
K
-
L
-
M
0, 1, 2, or 3 (shifts for
lea instruction)
-
N
Constant in range 0 to 255
(for out instruction)
-
G
Standard 80387 floating
point constant
Intel
960i960.h
-
f
Floating point register
(fp0 to fp3)
-
l
Local register (r0
to r15)
-
b
Global register (g0
to g15)
-
d
Any local or global register
-
I
-
J
-
K
-
G
-
H
MIPSmips.h
-
d
General-purpose integer
register
-
f
Floating-point register
(if available)
-
h
-
l
-
x
-
y
General-purpose integer
register
-
z
Floating-point status register
-
I
Signed 16 bit constant (for
arithmetic instructions)
-
J
-
K
Zero-extended 16-bit constant
(for logic instructions)
-
L
Constant with low 16 bits
zero (can be loaded with lui)
-
M
32 bit constant which requires
two instructions to load (a constant which is not I,
K,
or L)
-
N
-
O
-
P
-
GO
-
Q
Memory reference that can
be loaded with more than one instruction (m
is preferable for asm
statements)
-
R
Memory reference that can
be loaded with one instruction (m
is preferable for asm
statements)
-
S
Memory reference in external
OSF/rose PIC for-mat (m
is preferable for asm
statements)
Motorola
680x0m68k.h
-
a
-
d
-
f
68881 floating-point register,
if available
-
x
Sun FPA (floating-point)
register, if available
-
y
First 16 Sun FPA registers,
if available
-
I
Integer in the range 1 to
8
-
J
-
K
Signed number whose magnitude
is greater than 0x80
-
L
Integer in the range -8
to -1
-
M
Signed number whose magnitude
is greater than 0x100
-
G
Floating point constant
that is not a 68881 constant
-
H
Floating point constant
that can be used by Sun FPA
SPARCsparc.h
-
f
-
I
-
J
-
K
32 bit constant with the
low 12 bits clear (a constant that can be loaded with the sethi
instruction)
-
G
-
H
Signed 13 bit constant,
sign-extended to 32 or 64 bits
-
Q
Memory reference that can
be loaded with one instruction (m
is more appropriate for asm
statements)
-
S
Constant, or memory address
-
T
Memory address aligned to
an 8-byte boundary
-
U
Top|Contents|Index|Previous|Next