1e4b17023SJohn Marino;; Constraint definitions for IA-32 and x86-64. 2e4b17023SJohn Marino;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. 3e4b17023SJohn Marino;; 4e4b17023SJohn Marino;; This file is part of GCC. 5e4b17023SJohn Marino;; 6e4b17023SJohn Marino;; GCC is free software; you can redistribute it and/or modify 7e4b17023SJohn Marino;; it under the terms of the GNU General Public License as published by 8e4b17023SJohn Marino;; the Free Software Foundation; either version 3, or (at your option) 9e4b17023SJohn Marino;; any later version. 10e4b17023SJohn Marino;; 11e4b17023SJohn Marino;; GCC is distributed in the hope that it will be useful, 12e4b17023SJohn Marino;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13e4b17023SJohn Marino;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14e4b17023SJohn Marino;; GNU General Public License for more details. 15e4b17023SJohn Marino;; 16e4b17023SJohn Marino;; You should have received a copy of the GNU General Public License 17e4b17023SJohn Marino;; along with GCC; see the file COPYING3. If not see 18e4b17023SJohn Marino;; <http://www.gnu.org/licenses/>. 19e4b17023SJohn Marino 20e4b17023SJohn Marino;;; Unused letters: 21e4b17023SJohn Marino;;; B H T W 22e4b17023SJohn Marino;;; h jk v 23e4b17023SJohn Marino 24e4b17023SJohn Marino;; Integer register constraints. 25e4b17023SJohn Marino;; It is not necessary to define 'r' here. 26e4b17023SJohn Marino(define_register_constraint "R" "LEGACY_REGS" 27e4b17023SJohn Marino "Legacy register---the eight integer registers available on all 28e4b17023SJohn Marino i386 processors (@code{a}, @code{b}, @code{c}, @code{d}, 29e4b17023SJohn Marino @code{si}, @code{di}, @code{bp}, @code{sp}).") 30e4b17023SJohn Marino 31e4b17023SJohn Marino(define_register_constraint "q" "TARGET_64BIT ? GENERAL_REGS : Q_REGS" 32e4b17023SJohn Marino "Any register accessible as @code{@var{r}l}. In 32-bit mode, @code{a}, 33e4b17023SJohn Marino @code{b}, @code{c}, and @code{d}; in 64-bit mode, any integer register.") 34e4b17023SJohn Marino 35e4b17023SJohn Marino(define_register_constraint "Q" "Q_REGS" 36e4b17023SJohn Marino "Any register accessible as @code{@var{r}h}: @code{a}, @code{b}, 37e4b17023SJohn Marino @code{c}, and @code{d}.") 38e4b17023SJohn Marino 39e4b17023SJohn Marino(define_register_constraint "l" "INDEX_REGS" 40e4b17023SJohn Marino "@internal Any register that can be used as the index in a base+index 41e4b17023SJohn Marino memory access: that is, any general register except the stack pointer.") 42e4b17023SJohn Marino 43e4b17023SJohn Marino(define_register_constraint "a" "AREG" 44e4b17023SJohn Marino "The @code{a} register.") 45e4b17023SJohn Marino 46e4b17023SJohn Marino(define_register_constraint "b" "BREG" 47e4b17023SJohn Marino "The @code{b} register.") 48e4b17023SJohn Marino 49e4b17023SJohn Marino(define_register_constraint "c" "CREG" 50e4b17023SJohn Marino "The @code{c} register.") 51e4b17023SJohn Marino 52e4b17023SJohn Marino(define_register_constraint "d" "DREG" 53e4b17023SJohn Marino "The @code{d} register.") 54e4b17023SJohn Marino 55e4b17023SJohn Marino(define_register_constraint "S" "SIREG" 56e4b17023SJohn Marino "The @code{si} register.") 57e4b17023SJohn Marino 58e4b17023SJohn Marino(define_register_constraint "D" "DIREG" 59e4b17023SJohn Marino "The @code{di} register.") 60e4b17023SJohn Marino 61e4b17023SJohn Marino(define_register_constraint "A" "AD_REGS" 62e4b17023SJohn Marino "The @code{a} and @code{d} registers, as a pair (for instructions 63e4b17023SJohn Marino that return half the result in one and half in the other).") 64e4b17023SJohn Marino 65e4b17023SJohn Marino(define_register_constraint "U" "CLOBBERED_REGS" 66e4b17023SJohn Marino "The call-clobbered integer registers.") 67e4b17023SJohn Marino 68e4b17023SJohn Marino;; Floating-point register constraints. 69e4b17023SJohn Marino(define_register_constraint "f" 70e4b17023SJohn Marino "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FLOAT_REGS : NO_REGS" 71e4b17023SJohn Marino "Any 80387 floating-point (stack) register.") 72e4b17023SJohn Marino 73e4b17023SJohn Marino(define_register_constraint "t" 74e4b17023SJohn Marino "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_TOP_REG : NO_REGS" 75e4b17023SJohn Marino "Top of 80387 floating-point stack (@code{%st(0)}).") 76e4b17023SJohn Marino 77e4b17023SJohn Marino(define_register_constraint "u" 78e4b17023SJohn Marino "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_SECOND_REG : NO_REGS" 79e4b17023SJohn Marino "Second from top of 80387 floating-point stack (@code{%st(1)}).") 80e4b17023SJohn Marino 81e4b17023SJohn Marino;; Vector registers (also used for plain floating point nowadays). 82e4b17023SJohn Marino(define_register_constraint "y" "TARGET_MMX ? MMX_REGS : NO_REGS" 83e4b17023SJohn Marino "Any MMX register.") 84e4b17023SJohn Marino 85e4b17023SJohn Marino(define_register_constraint "x" "TARGET_SSE ? SSE_REGS : NO_REGS" 86e4b17023SJohn Marino "Any SSE register.") 87e4b17023SJohn Marino 88e4b17023SJohn Marino;; We use the Y prefix to denote any number of conditional register sets: 89e4b17023SJohn Marino;; z First SSE register. 90e4b17023SJohn Marino;; i SSE2 inter-unit moves enabled 91e4b17023SJohn Marino;; m MMX inter-unit moves enabled 92e4b17023SJohn Marino;; p Integer register when TARGET_PARTIAL_REG_STALL is disabled 93e4b17023SJohn Marino;; d Integer register when integer DFmode moves are enabled 94e4b17023SJohn Marino;; x Integer register when integer XFmode moves are enabled 95*5ce9237cSJohn Marino;; f x87 register when 80387 floating point arithmetic is enabled 96e4b17023SJohn Marino 97e4b17023SJohn Marino(define_register_constraint "Yz" "TARGET_SSE ? SSE_FIRST_REG : NO_REGS" 98e4b17023SJohn Marino "First SSE register (@code{%xmm0}).") 99e4b17023SJohn Marino 100e4b17023SJohn Marino(define_register_constraint "Yi" 101e4b17023SJohn Marino "TARGET_SSE2 && TARGET_INTER_UNIT_MOVES ? SSE_REGS : NO_REGS" 102e4b17023SJohn Marino "@internal Any SSE register, when SSE2 and inter-unit moves are enabled.") 103e4b17023SJohn Marino 104e4b17023SJohn Marino(define_register_constraint "Ym" 105e4b17023SJohn Marino "TARGET_MMX && TARGET_INTER_UNIT_MOVES ? MMX_REGS : NO_REGS" 106e4b17023SJohn Marino "@internal Any MMX register, when inter-unit moves are enabled.") 107e4b17023SJohn Marino 108e4b17023SJohn Marino(define_register_constraint "Yp" 109e4b17023SJohn Marino "TARGET_PARTIAL_REG_STALL ? NO_REGS : GENERAL_REGS" 110e4b17023SJohn Marino "@internal Any integer register when TARGET_PARTIAL_REG_STALL is disabled.") 111e4b17023SJohn Marino 112e4b17023SJohn Marino(define_register_constraint "Yd" 113e4b17023SJohn Marino "(TARGET_64BIT 114e4b17023SJohn Marino || (TARGET_INTEGER_DFMODE_MOVES && optimize_function_for_speed_p (cfun))) 115e4b17023SJohn Marino ? GENERAL_REGS : NO_REGS" 116e4b17023SJohn Marino "@internal Any integer register when integer DFmode moves are enabled.") 117e4b17023SJohn Marino 118e4b17023SJohn Marino(define_register_constraint "Yx" 119e4b17023SJohn Marino "optimize_function_for_speed_p (cfun) ? GENERAL_REGS : NO_REGS" 120e4b17023SJohn Marino "@internal Any integer register when integer XFmode moves are enabled.") 121e4b17023SJohn Marino 122*5ce9237cSJohn Marino(define_register_constraint "Yf" 123*5ce9237cSJohn Marino "(ix86_fpmath & FPMATH_387) ? FLOAT_REGS : NO_REGS" 124*5ce9237cSJohn Marino "@internal Any x87 register when 80387 FP arithmetic is enabled.") 125*5ce9237cSJohn Marino 126e4b17023SJohn Marino(define_constraint "z" 127e4b17023SJohn Marino "@internal Constant call address operand." 128e4b17023SJohn Marino (match_operand 0 "constant_call_address_operand")) 129e4b17023SJohn Marino 130e4b17023SJohn Marino(define_constraint "w" 131e4b17023SJohn Marino "@internal Call memory operand." 132e4b17023SJohn Marino (and (not (match_test "TARGET_X32")) 133e4b17023SJohn Marino (match_operand 0 "memory_operand"))) 134e4b17023SJohn Marino 135e4b17023SJohn Marino;; Integer constant constraints. 136e4b17023SJohn Marino(define_constraint "I" 137e4b17023SJohn Marino "Integer constant in the range 0 @dots{} 31, for 32-bit shifts." 138e4b17023SJohn Marino (and (match_code "const_int") 139e4b17023SJohn Marino (match_test "IN_RANGE (ival, 0, 31)"))) 140e4b17023SJohn Marino 141e4b17023SJohn Marino(define_constraint "J" 142e4b17023SJohn Marino "Integer constant in the range 0 @dots{} 63, for 64-bit shifts." 143e4b17023SJohn Marino (and (match_code "const_int") 144e4b17023SJohn Marino (match_test "IN_RANGE (ival, 0, 63)"))) 145e4b17023SJohn Marino 146e4b17023SJohn Marino(define_constraint "K" 147e4b17023SJohn Marino "Signed 8-bit integer constant." 148e4b17023SJohn Marino (and (match_code "const_int") 149e4b17023SJohn Marino (match_test "IN_RANGE (ival, -128, 127)"))) 150e4b17023SJohn Marino 151e4b17023SJohn Marino(define_constraint "L" 152e4b17023SJohn Marino "@code{0xFF}, @code{0xFFFF} or @code{0xFFFFFFFF} 153e4b17023SJohn Marino for AND as a zero-extending move." 154e4b17023SJohn Marino (and (match_code "const_int") 155e4b17023SJohn Marino (match_test "ival == 0xff || ival == 0xffff 156e4b17023SJohn Marino || ival == (HOST_WIDE_INT) 0xffffffff"))) 157e4b17023SJohn Marino 158e4b17023SJohn Marino(define_constraint "M" 159e4b17023SJohn Marino "0, 1, 2, or 3 (shifts for the @code{lea} instruction)." 160e4b17023SJohn Marino (and (match_code "const_int") 161e4b17023SJohn Marino (match_test "IN_RANGE (ival, 0, 3)"))) 162e4b17023SJohn Marino 163e4b17023SJohn Marino(define_constraint "N" 164e4b17023SJohn Marino "Unsigned 8-bit integer constant (for @code{in} and @code{out} 165e4b17023SJohn Marino instructions)." 166e4b17023SJohn Marino (and (match_code "const_int") 167e4b17023SJohn Marino (match_test "IN_RANGE (ival, 0, 255)"))) 168e4b17023SJohn Marino 169e4b17023SJohn Marino(define_constraint "O" 170e4b17023SJohn Marino "@internal Integer constant in the range 0 @dots{} 127, for 128-bit shifts." 171e4b17023SJohn Marino (and (match_code "const_int") 172e4b17023SJohn Marino (match_test "IN_RANGE (ival, 0, 127)"))) 173e4b17023SJohn Marino 174e4b17023SJohn Marino;; Floating-point constant constraints. 175e4b17023SJohn Marino;; We allow constants even if TARGET_80387 isn't set, because the 176e4b17023SJohn Marino;; stack register converter may need to load 0.0 into the function 177e4b17023SJohn Marino;; value register (top of stack). 178e4b17023SJohn Marino(define_constraint "G" 179e4b17023SJohn Marino "Standard 80387 floating point constant." 180e4b17023SJohn Marino (and (match_code "const_double") 181e4b17023SJohn Marino (match_test "standard_80387_constant_p (op) > 0"))) 182e4b17023SJohn Marino 183e4b17023SJohn Marino;; This can theoretically be any mode's CONST0_RTX. 184e4b17023SJohn Marino(define_constraint "C" 185e4b17023SJohn Marino "Standard SSE floating point constant." 186e4b17023SJohn Marino (match_test "standard_sse_constant_p (op)")) 187e4b17023SJohn Marino 188e4b17023SJohn Marino;; Constant-or-symbol-reference constraints. 189e4b17023SJohn Marino 190e4b17023SJohn Marino(define_constraint "e" 191e4b17023SJohn Marino "32-bit signed integer constant, or a symbolic reference known 192e4b17023SJohn Marino to fit that range (for immediate operands in sign-extending x86-64 193e4b17023SJohn Marino instructions)." 194e4b17023SJohn Marino (match_operand 0 "x86_64_immediate_operand")) 195e4b17023SJohn Marino 196e4b17023SJohn Marino(define_constraint "Z" 197e4b17023SJohn Marino "32-bit unsigned integer constant, or a symbolic reference known 198e4b17023SJohn Marino to fit that range (for immediate operands in zero-extending x86-64 199e4b17023SJohn Marino instructions)." 200e4b17023SJohn Marino (match_operand 0 "x86_64_zext_immediate_operand")) 201