constraints.md revision 169689
1197436Strasz;; Constraint definitions for IA-32 and x86-64. 2197436Strasz;; Copyright (C) 2006 Free Software Foundation, Inc. 3197436Strasz;; 4197436Strasz;; This file is part of GCC. 5197436Strasz;; 6197436Strasz;; GCC is free software; you can redistribute it and/or modify 7197436Strasz;; it under the terms of the GNU General Public License as published by 8197436Strasz;; the Free Software Foundation; either version 2, or (at your option) 9197436Strasz;; any later version. 10197436Strasz;; 11197436Strasz;; GCC is distributed in the hope that it will be useful, 12197436Strasz;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13197436Strasz;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14197436Strasz;; GNU General Public License for more details. 15197436Strasz;; 16197436Strasz;; You should have received a copy of the GNU General Public License 17197436Strasz;; along with GCC; see the file COPYING. If not, write to 18197436Strasz;; the Free Software Foundation, 51 Franklin Street, Fifth Floor, 19197436Strasz;; Boston, MA 02110-1301, USA. 20197436Strasz 21197436Strasz;;; Unused letters: 22197436Strasz;;; B H TU W 23197436Strasz;;; h jk vw z 24197436Strasz 25197436Strasz;; Integer register constraints. 26197436Strasz;; It is not necessary to define 'r' here. 27197436Strasz(define_register_constraint "R" "LEGACY_REGS" 28197436Strasz "Legacy register---the eight integer registers available on all 29197436Strasz i386 processors (@code{a}, @code{b}, @code{c}, @code{d}, 30197436Strasz @code{si}, @code{di}, @code{bp}, @code{sp}).") 31197436Strasz 32197436Strasz(define_register_constraint "q" "TARGET_64BIT ? GENERAL_REGS : Q_REGS" 33197436Strasz "Any register accessible as @code{@var{r}l}. In 32-bit mode, @code{a}, 34197436Strasz @code{b}, @code{c}, and @code{d}; in 64-bit mode, any integer register.") 35197436Strasz 36197436Strasz(define_register_constraint "Q" "Q_REGS" 37197436Strasz "Any register accessible as @code{@var{r}h}: @code{a}, @code{b}, 38197436Strasz @code{c}, and @code{d}.") 39197436Strasz 40197436Strasz(define_register_constraint "l" "INDEX_REGS" 41197436Strasz "@internal Any register that can be used as the index in a base+index 42197436Strasz memory access: that is, any general register except the stack pointer.") 43197436Strasz 44197436Strasz(define_register_constraint "a" "AREG" 45197436Strasz "The @code{a} register.") 46288314Sngie 47288314Sngie(define_register_constraint "b" "BREG" 48288314Sngie "The @code{b} register.") 49197436Strasz 50197436Strasz(define_register_constraint "c" "CREG" 51197436Strasz "The @code{c} register.") 52197436Strasz 53197436Strasz(define_register_constraint "d" "DREG" 54197436Strasz "The @code{d} register.") 55197436Strasz 56201048Strasz(define_register_constraint "S" "SIREG" 57201048Strasz "The @code{si} register.") 58201048Strasz 59201048Strasz(define_register_constraint "D" "DIREG" 60201048Strasz "The @code{di} register.") 61197436Strasz 62197436Strasz(define_register_constraint "A" "AD_REGS" 63197436Strasz "The @code{a} and @code{d} registers, as a pair (for instructions 64197436Strasz that return half the result in one and half in the other).") 65197436Strasz 66197436Strasz;; Floating-point register constraints. 67197436Strasz(define_register_constraint "f" 68197436Strasz "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FLOAT_REGS : NO_REGS" 69197436Strasz "Any 80387 floating-point (stack) register.") 70197436Strasz 71197436Strasz(define_register_constraint "t" 72201048Strasz "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_TOP_REG : NO_REGS" 73201048Strasz "Top of 80387 floating-point stack (@code{%st(0)}).") 74197436Strasz 75201048Strasz(define_register_constraint "u" 76201048Strasz "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_SECOND_REG : NO_REGS" 77201048Strasz "Second from top of 80387 floating-point stack (@code{%st(1)}).") 78201048Strasz 79201048Strasz;; Vector registers (also used for plain floating point nowadays). 80201048Strasz(define_register_constraint "y" "TARGET_MMX ? MMX_REGS : NO_REGS" 81201048Strasz "Any MMX register.") 82201048Strasz 83201048Strasz(define_register_constraint "x" "TARGET_SSE ? SSE_REGS : NO_REGS" 84201048Strasz "Any SSE register.") 85201048Strasz 86201048Strasz(define_register_constraint "Y" "TARGET_SSE2? SSE_REGS : NO_REGS" 87201048Strasz "@internal Any SSE2 register.") 88197436Strasz 89201048Strasz;; Integer constant constraints. 90197436Strasz(define_constraint "I" 91201048Strasz "Integer constant in the range 0 @dots{} 31, for 32-bit shifts." 92201048Strasz (and (match_code "const_int") 93201048Strasz (match_test "ival >= 0 && ival <= 31"))) 94201048Strasz 95201048Strasz(define_constraint "J" 96197436Strasz "Integer constant in the range 0 @dots{} 63, for 64-bit shifts." 97197436Strasz (and (match_code "const_int") 98197436Strasz (match_test "ival >= 0 && ival <= 63"))) 99288314Sngie 100288314Sngie(define_constraint "K" 101288314Sngie "Signed 8-bit integer constant." 102288314Sngie (and (match_code "const_int") 103201048Strasz (match_test "ival >= -128 && ival <= 127"))) 104201048Strasz 105197436Strasz(define_constraint "L" 106197436Strasz "@code{0xFF} or @code{0xFFFF}, for andsi as a zero-extending move." 107201048Strasz (and (match_code "const_int") 108201048Strasz (match_test "ival == 0xFF || ival == 0xFFFF"))) 109201048Strasz 110197436Strasz(define_constraint "M" 111197436Strasz "0, 1, 2, or 3 (shifts for the @code{lea} instruction)." 112197436Strasz (and (match_code "const_int") 113288314Sngie (match_test "ival >= 0 && ival <= 3"))) 114288314Sngie 115288314Sngie(define_constraint "N" 116288314Sngie "Unsigned 8-bit integer constant (for @code{in} and @code{out} 117288314Sngie instructions)." 118201048Strasz (and (match_code "const_int") 119201048Strasz (match_test "ival >= 0 && ival <= 255"))) 120197436Strasz 121201048Strasz(define_constraint "O" 122201048Strasz "@internal Integer constant in the range 0 @dots{} 127, for 128-bit shifts." 123197436Strasz (and (match_code "const_int") 124201048Strasz (match_test "ival >= 0 && ival <= 127"))) 125201048Strasz 126201048Strasz;; Floating-point constant constraints. 127201048Strasz;; We allow constants even if TARGET_80387 isn't set, because the 128201048Strasz;; stack register converter may need to load 0.0 into the function 129197436Strasz;; value register (top of stack). 130201048Strasz(define_constraint "G" 131197436Strasz "Standard 80387 floating point constant." 132201048Strasz (and (match_code "const_double") 133201048Strasz (match_test "standard_80387_constant_p (op)"))) 134201048Strasz 135201048Strasz;; This can theoretically be any mode's CONST0_RTX. 136201048Strasz(define_constraint "C" 137201048Strasz "Standard SSE floating point constant." 138201048Strasz (match_test "standard_sse_constant_p (op)")) 139201048Strasz 140201048Strasz;; Constant-or-symbol-reference constraints. 141201048Strasz 142201048Strasz(define_constraint "e" 143197436Strasz "32-bit signed integer constant, or a symbolic reference known 144197436Strasz to fit that range (for immediate operands in sign-extending x86-64 145201048Strasz instructions)." 146197436Strasz (match_operand 0 "x86_64_immediate_operand")) 147201048Strasz 148201048Strasz(define_constraint "Z" 149201048Strasz "32-bit unsigned integer constant, or a symbolic reference known 150201048Strasz to fit that range (for immediate operands in zero-extending x86-64 151201048Strasz instructions)." 152201048Strasz (match_operand 0 "x86_64_zext_immediate_operand")) 153201048Strasz