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/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 these macros:
REG_CLASS_FROM_LETTER
CONST_OK_FOR_LETTER_P
CONST_DOUBLE_OK_FOR_LETTER_P
EXTRA_CONSTRAINT
Inspecting these macro definitions in the compiler source for your machine is the best way to be certain you have the right constraints. However, here is a summary of the machine-dependent constraints available on some particular machines.
arm.h
f
F
G
F if it
were negated
I
J
K
I when inverted (ones complement)
L
I when negated (twos complement)
M
Q
m' is preferable for asm statements)
R
S
avr.h
l
a
d
w
adiw command
e
b
q
t
x
y
z
I
J
K
L
M
N
O
P
G
rs6000.h
b
f
h
MQ, CTR, or LINK register
q
MQ register
c
CTR register
l
LINK register
x
CR register (condition register) number 0
y
CR register (condition register)
z
FPMEM stack memory for FPR-GPR transfers
I
J
L instead for
SImode constants)
K
L
M
N
O
P
G
Q
m is preferable
for asm statements)
R
S
T
U
i386.h
q
a, b, c, or d register for the i386.
For x86-64 it is equivalent to r class. (for 8-bit instructions that
do not use upper halves)
Q
a, b, c, or d register. (for 8-bit instructions,
that do use upper halves)
R
r class in i386 mode.
(for non-8-bit registers used together with 8-bit upper halves in a single
instruction)
A
a or d registers. This is primarily useful
for 64-bit integer values (when in 32-bit mode) intended to be returned
with the d register holding the most significant bits and the
a register holding the least significant bits.
f
t
u
a
a register
b
b register
c
c register
C
d
d register
D
di register
S
si register
x
xmm SSE register
y
I
J
K
0xff
L
0xffff
M
lea instruction)
N
out instruction)
Z
0xffffffff or symbolic reference known to fit specified range.
(for using immediates in zero extending 32-bit to 64-bit x86-64 instructions)
e
G
i960.h
f
fp0 to fp3)
l
r0 to r15)
b
g0 to g15)
d
I
J
K
G
H
ia64.h
a
r0 to r3 for addl instruction
b
c
c as in "conditional")
d
e
f
m
m allows postincrement and postdecrement which
require printing with %Pn on IA-64.
Use S to disallow postincrement and postdecrement.
G
I
J
K
L
M
N
O
P
dep instruction
Q
R
shladd instruction
S
frv.h
a
ACC_REGS (acc0 to acc7).
b
EVEN_ACC_REGS (acc0 to acc7).
c
CC_REGS (fcc0 to fcc3 and
icc0 to icc3).
d
GPR_REGS (gr0 to gr63).
e
EVEN_REGS (gr0 to gr63).
Odd registers are excluded not in the class but through the use of a machine
mode larger than 4 bytes.
f
FPR_REGS (fr0 to fr63).
h
FEVEN_REGS (fr0 to fr63).
Odd registers are excluded not in the class but through the use of a machine
mode larger than 4 bytes.
l
LR_REG (the lr register).
q
QUAD_REGS (gr2 to gr63).
Register numbers not divisible by 4 are excluded not in the class but through
the use of a machine mode larger than 8 bytes.
t
ICC_REGS (icc0 to icc3).
u
FCC_REGS (fcc0 to fcc3).
v
ICR_REGS (cc4 to cc7).
w
FCR_REGS (cc0 to cc3).
x
QUAD_FPR_REGS (fr0 to fr63).
Register numbers not divisible by 4 are excluded not in the class but through
the use of a machine mode larger than 8 bytes.
z
SPR_REGS (lcr and lr).
A
QUAD_ACC_REGS (acc0 to acc7).
B
ACCG_REGS (accg0 to accg7).
C
CR_REGS (cc0 to cc7).
G
I
J
L
M
N
O
P
ip2k.h
a
DP or IP registers (general address)
f
IP register
j
IPL register
k
IPH register
b
DP register
y
DPH register
z
DPL register
q
SP register
c
DP or SP registers (offsettable address)
d
SP, DP, IP)
u
SP)
R
IP - Avoid this except for QImode, since we
can't access extra bytes
S
SP or DP with short displacement (0..127)
T
I
J
K
L
M
N
O
P
mips.h
d
f
h
Hi register
l
Lo register
x
Hi or Lo register
y
z
I
J
K
L
lui)
M
I, K, or L)
N
O
P
G
Q
m is preferable for asm statements)
R
m is preferable for asm statements)
S
m is preferable for asm statements)
m68k.h
a
d
f
x
y
I
J
K
L
M
G
H
m68hc11.h
a
b
d
q
t
u
w
x
y
z
A
B
D
L
M
N
O
P
sparc.h
f
e
I
J
K
sethi instruction)
L
movcc instructions
M
movrcc instructions
N
K, except that it verifies that bits that are not in the
lower 32-bit range are all zero. Must be used instead of K for
modes wider than SImode
G
H
Q
R
S
T
U
W
e constraint registers.
c4x.h
a
b
c
f
k
q
t
u
v
x
y
z
G
H
I
J
K
L
M
N
O
Q
R
S
T
U
s390.h
a
d
f
I
J
K
L
Q
S
larl instruction
stormy16.h
a
b
c
d
e
t
y
z
I
J
K
L
M
N
O
P
Q
R
S
T
U
xtensa.h
a
b
A
I
J
K
L