| GNU Compiler Collection (GCC) | www.imodulo.com · 2003-11-10 | ||
| [ Software | Documentation | Contact ] |
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; 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_LETTERRegister class constraints (usually lower case).
CONST_OK_FOR_LETTER_PImmediate constant constraints, for non-floating point constants of word size or smaller precision (usually upper case).
CONST_DOUBLE_OK_FOR_LETTER_PImmediate constant constraints, for all floating point constants and for constants of greater than word size precision (usually upper case).
EXTRA_CONSTRAINTSpecial 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, here is a summary of the machine-dependent constraints available on some particular machines.
arm.hfFloating-point register
FOne of the floating-point constants 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0 or 10.0
GFloating-point constant that would satisfy the constraint F if it were negated
IInteger 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
JInteger in the range −4095 to 4095
KInteger that satisfies constraint I when inverted (ones complement)
LInteger that satisfies constraint I when negated (twos complement)
MInteger in the range 0 to 32
QA memory reference where the exact address is in a single register (`m' is preferable for asm statements)
RAn item in the constant pool
SA symbol in the text segment of the current file
avr.hlRegisters from r0 to r15
aRegisters from r16 to r23
dRegisters from r16 to r31
wRegisters from r24 to r31. These registers can be used in adiw command
ePointer register (r26-r31)
bBase pointer register (r28-r31)
qStack pointer register (SPH:SPL)
tTemporary register r0
xRegister pair X (r27:r26)
yRegister pair Y (r29:r28)
zRegister pair Z (r31:r30)
IConstant greater than −1, less than 64
JConstant greater than −64, less than 1
KConstant integer 2
LConstant integer 0
MConstant that fits in 8 bits
NConstant integer −1
OConstant integer 8, 16, or 24
PConstant integer 1
GA floating point constant 0.0
rs6000.hbAddress base register
fFloating point register
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
ISigned 16-bit constant
JUnsigned 16-bit constant shifted left 16 bits (use L instead for SImode constants)
KUnsigned 16-bit constant
LSigned 16-bit constant shifted left 16 bits
MConstant larger than 31
NExact power of 2
OZero
PConstant whose negation is a signed 16-bit constant
GFloating point constant that can be loaded into a register with one instruction per word
QMemory operand that is an offset from a register (m is preferable for asm statements)
RAIX TOC entry
SConstant suitable as a 64-bit mask operand
TConstant suitable as a 32-bit mask operand
USystem V Release 4 small data area reference
i386.hq
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)
RLegacy register--equivalent to r class in i386 mode. (for non-8-bit registers used together with 8-bit upper halves in a single instruction)
ASpecifies the 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.
fFloating point register
tFirst (top of stack) floating point register
uSecond floating point register
a
a register
b
b register
c
c register
CSpecifies constant that can be easily constructed in SSE register without loading it from memory.
d
d register
D
di register
S
si register
x
xmm SSE register
yMMX register
IConstant in range 0 to 31 (for 32-bit shifts)
JConstant in range 0 to 63 (for 64-bit shifts)
K
0xff
L
0xffff
M0, 1, 2, or 3 (shifts for lea instruction)
NConstant in range 0 to 255 (for out instruction)
ZConstant in range 0 to 0xffffffff or symbolic reference known to fit specified range. (for using immediates in zero extending 32-bit to 64-bit x86-64 instructions)
eConstant in range −2147483648 to 2147483647 or symbolic reference known to fit specified range. (for using immediates in 64-bit x86-64 instructions)
GStandard 80387 floating point constant
i960.hfFloating point register (fp0 to fp3)
lLocal register (r0 to r15)
bGlobal register (g0 to g15)
dAny local or global register
IIntegers from 0 to 31
J0
KIntegers from −31 to 0
GFloating point 0
HFloating point 1
ia64.haGeneral register r0 to r3 for addl instruction
bBranch register
cPredicate register (c as in "conditional")
dApplication register residing in M-unit
eApplication register residing in I-unit
fFloating-point register
mMemory operand. Remember that m allows postincrement and postdecrement which require printing with %Pn on IA-64. Use S to disallow postincrement and postdecrement.
GFloating-point constant 0.0 or 1.0
I14-bit signed integer constant
J22-bit signed integer constant
K8-bit signed integer constant for logical instructions
L8-bit adjusted signed integer constant for compare pseudo-ops
M6-bit unsigned integer constant for shift counts
N9-bit signed integer constant for load and store postincrements
OThe constant zero
P0 or -1 for dep instruction
QNon-volatile memory for floating-point loads and stores
RInteger constant in the range 1 to 4 for shladd instruction
SMemory operand except postincrement and postdecrement
frv.haRegister in the class ACC_REGS (acc0 to acc7).
bRegister in the class EVEN_ACC_REGS (acc0 to acc7).
cRegister in the class CC_REGS (fcc0 to fcc3 and icc0 to icc3).
dRegister in the class GPR_REGS (gr0 to gr63).
eRegister in the class 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.
fRegister in the class FPR_REGS (fr0 to fr63).
hRegister in the class 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.
lRegister in the class LR_REG (the lr register).
qRegister in the class 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.
tRegister in the class ICC_REGS (icc0 to icc3).
uRegister in the class FCC_REGS (fcc0 to fcc3).
vRegister in the class ICR_REGS (cc4 to cc7).
wRegister in the class FCR_REGS (cc0 to cc3).
xRegister in the class 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.
zRegister in the class SPR_REGS (lcr and lr).
ARegister in the class QUAD_ACC_REGS (acc0 to acc7).
BRegister in the class ACCG_REGS (accg0 to accg7).
CRegister in the class CR_REGS (cc0 to cc7).
GFloating point constant zero
I6-bit signed integer constant
J10-bit signed integer constant
L16-bit signed integer constant
M16-bit unsigned integer constant
N12-bit signed integer constant that is negative--i.e. in the range of −2048 to −1
OConstant zero
P12-bit signed integer constant that is greater than zero--i.e. in the range of 1 to 2047.
ip2k.ha
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)
dNon-pointer registers (not SP, DP, IP)
uNon-SP registers (everything except SP)
RIndirect thru IP - Avoid this except for QImode, since we can't access extra bytes
SIndirect thru SP or DP with short displacement (0..127)
TData-section immediate value
IIntegers from −255 to −1
JIntegers from 0 to 7--valid bit number in a register
KIntegers from 0 to 127--valid displacement for addressing mode
LIntegers from 1 to 127
MInteger −1
NInteger 1
OZero
PIntegers from 0 to 255
mips.hdGeneral-purpose integer register
fFloating-point register (if available)
h
Hi register
l
Lo register
x
Hi or Lo register
yGeneral-purpose integer register
zFloating-point status register
ISigned 16-bit constant (for arithmetic instructions)
JZero
KZero-extended 16-bit constant (for logic instructions)
LConstant with low 16 bits zero (can be loaded with lui)
M32-bit constant which requires two instructions to load (a constant which is not I, K, or L)
NNegative 16-bit constant
OExact power of two
PPositive 16-bit constant
GFloating point zero
QMemory reference that can be loaded with more than one instruction (m is preferable for asm statements)
RMemory reference that can be loaded with one instruction (m is preferable for asm statements)
SMemory reference in external OSF/rose PIC format (m is preferable for asm statements)
m68k.haAddress register
dData register
f68881 floating-point register, if available
xSun FPA (floating-point) register, if available
yFirst 16 Sun FPA registers, if available
IInteger in the range 1 to 8
J16-bit signed number
KSigned number whose magnitude is greater than 0x80
LInteger in the range −8 to −1
MSigned number whose magnitude is greater than 0x100
GFloating point constant that is not a 68881 constant
HFloating point constant that can be used by Sun FPA
m68hc11.haRegister 'a'
bRegister 'b'
dRegister 'd'
qAn 8-bit register
tTemporary soft register _.tmp
uA soft register _.d1 to _.d31
wStack pointer register
xRegister 'x'
yRegister 'y'
zPseudo register 'z' (replaced by 'x' or 'y' at the end)
AAn address register: x, y or z
BAn address register: x or y
DRegister pair (x:d) to form a 32-bit value
LConstants in the range −65536 to 65535
MConstants whose 16-bit low part is zero
NConstant integer 1 or −1
OConstant integer 16
PConstants in the range −8 to 2
sparc.hfFloating-point register on the SPARC-V8 architecture and lower floating-point register on the SPARC-V9 architecture.
eFloating-point register. It is equivalent to f on the SPARC-V8 architecture and contains both lower and upper floating-point registers on the SPARC-V9 architecture.
cFloating-point condition code register.
dLower floating-point register. It is only valid on the SPARC-V9 architecture when the Visual Instruction Set is available.
bFloating-point register. It is only valid on the SPARC-V9 architecture when the Visual Instruction Set is available.
h64-bit global or out register for the SPARC-V8+ architecture.
ISigned 13-bit constant
JZero
K32-bit constant with the low 12 bits clear (a constant that can be loaded with the sethi instruction)
LA constant in the range supported by movcc instructions
MA constant in the range supported by movrcc instructions
NSame as 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
OThe constant 4096
GFloating-point zero
HSigned 13-bit constant, sign-extended to 32 or 64 bits
QFloating-point constant whose integral representation can be moved into an integer register using a single sethi instruction
RFloating-point constant whose integral representation can be moved into an integer register using a single mov instruction
SFloating-point constant whose integral representation can be moved into an integer register using a high/lo_sum instruction sequence
TMemory address aligned to an 8-byte boundary
UEven register
WMemory address for e constraint registers.
c4x.haAuxiliary (address) register (ar0-ar7)
bStack pointer register (sp)
cStandard (32-bit) precision integer register
fExtended (40-bit) precision register (r0-r11)
kBlock count register (bk)
qExtended (40-bit) precision low register (r0-r7)
tExtended (40-bit) precision register (r0-r1)
uExtended (40-bit) precision register (r2-r3)
vRepeat count register (rc)
xIndex register (ir0-ir1)
yStatus (condition code) register (st)
zData page register (dp)
GFloating-point zero
HImmediate 16-bit floating-point constant
ISigned 16-bit constant
JSigned 8-bit constant
KSigned 5-bit constant
LUnsigned 16-bit constant
MUnsigned 8-bit constant
NOnes complement of unsigned 16-bit constant
OHigh 16-bit constant (32-bit constant with 16 LSBs zero)
QIndirect memory reference with signed 8-bit or index register displacement
RIndirect memory reference with unsigned 5-bit displacement
SIndirect memory reference with 1 bit or index register displacement
TDirect memory reference
USymbolic address
s390.haAddress register (general purpose register except r0)
dData register (arbitrary general purpose register)
fFloating-point register
IUnsigned 8-bit constant (0-255)
JUnsigned 12-bit constant (0-4095)
KSigned 16-bit constant (−32768-32767)
LUnsigned 16-bit constant (0-65535)
QMemory reference without index register
SSymbolic constant suitable for use with the larl instruction
stormy16.haRegister r0.
bRegister r1.
cRegister r2.
dRegister r8.
eRegisters r0 through r7.
tRegisters r0 and r1.
yThe carry register.
zRegisters r8 and r9.
IA constant between 0 and 3 inclusive.
JA constant that has exactly one bit set.
KA constant that has exactly one bit clear.
LA constant between 0 and 255 inclusive.
MA constant between −255 and 0 inclusive.
NA constant between −3 and 0 inclusive.
OA constant between 1 and 4 inclusive.
PA constant between −4 and −1 inclusive.
QA memory reference that is a stack push.
RA memory reference that is a stack pop.
SA memory reference that refers to a constant address of known value.
TThe register indicated by Rx (not implemented yet).
UA constant that is not between 2 and 15 inclusive.
xtensa.haGeneral-purpose 32-bit register
bOne-bit boolean register
AMAC16 40-bit accumulator register
ISigned 12-bit integer constant, for use in MOVI instructions
JSigned 8-bit integer constant, for use in ADDI instructions
KInteger constant valid for BccI instructions
LUnsigned constant valid for BccUI instructions
| © Free Software Foundation, Inc. |