constraints.md revision 169689
1169689Skan;; Constraint definitions for MIPS. 2169689Skan;; Copyright (C) 2006 Free Software Foundation, Inc. 3169689Skan;; 4169689Skan;; This file is part of GCC. 5169689Skan;; 6169689Skan;; GCC is free software; you can redistribute it and/or modify 7169689Skan;; it under the terms of the GNU General Public License as published by 8169689Skan;; the Free Software Foundation; either version 2, or (at your option) 9169689Skan;; any later version. 10169689Skan;; 11169689Skan;; GCC is distributed in the hope that it will be useful, 12169689Skan;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13169689Skan;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14169689Skan;; GNU General Public License for more details. 15169689Skan;; 16169689Skan;; You should have received a copy of the GNU General Public License 17169689Skan;; along with GCC; see the file COPYING. If not, write to 18169689Skan;; the Free Software Foundation, 51 Franklin Street, Fifth Floor, 19169689Skan;; Boston, MA 02110-1301, USA. 20169689Skan 21169689Skan;; Register constraints 22169689Skan 23169689Skan(define_register_constraint "d" "BASE_REG_CLASS" 24169689Skan "An address register. This is equivalent to @code{r} unless 25169689Skan generating MIPS16 code.") 26169689Skan 27169689Skan(define_register_constraint "t" "T_REG" 28169689Skan "@internal") 29169689Skan 30169689Skan(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS" 31169689Skan "A floating-point register (if available).") 32169689Skan 33169689Skan(define_register_constraint "h" "HI_REG" 34169689Skan "The @code{hi} register.") 35169689Skan 36169689Skan(define_register_constraint "l" "LO_REG" 37169689Skan "The @code{lo} register.") 38169689Skan 39169689Skan(define_register_constraint "x" "MD_REGS" 40169689Skan "The @code{hi} and @code{lo} registers.") 41169689Skan 42169689Skan(define_register_constraint "b" "ALL_REGS" 43169689Skan "@internal") 44169689Skan 45169689Skan(define_register_constraint "c" "TARGET_ABICALLS ? PIC_FN_ADDR_REG 46169689Skan : TARGET_MIPS16 ? M16_NA_REGS 47169689Skan : GR_REGS" 48169689Skan "A register suitable for use in an indirect jump. This will always be 49169689Skan @code{$25} for @option{-mabicalls}.") 50169689Skan 51169689Skan(define_register_constraint "e" "LEA_REGS" 52169689Skan "@internal") 53169689Skan 54169689Skan(define_register_constraint "j" "PIC_FN_ADDR_REG" 55169689Skan "@internal") 56169689Skan 57169689Skan(define_register_constraint "v" "V1_REG" 58169689Skan "@internal") 59169689Skan 60169689Skan(define_register_constraint "y" "GR_REGS" 61169689Skan "Equivalent to @code{r}; retained for backwards compatibility.") 62169689Skan 63169689Skan(define_register_constraint "z" "ST_REGS" 64169689Skan "A floating-point condition code register.") 65169689Skan 66169689Skan(define_register_constraint "A" "DSP_ACC_REGS" 67169689Skan "@internal") 68169689Skan 69169689Skan(define_register_constraint "a" "ACC_REGS" 70169689Skan "@internal") 71169689Skan 72169689Skan(define_register_constraint "B" "COP0_REGS" 73169689Skan "@internal") 74169689Skan 75169689Skan(define_register_constraint "C" "COP2_REGS" 76169689Skan "@internal") 77169689Skan 78169689Skan(define_register_constraint "D" "COP3_REGS" 79169689Skan "@internal") 80169689Skan 81169689Skan;; Integer constraints 82169689Skan 83169689Skan(define_constraint "I" 84169689Skan "A signed 16-bit constant (for arithmetic instructions)." 85169689Skan (and (match_code "const_int") 86169689Skan (match_test "SMALL_OPERAND (ival)"))) 87169689Skan 88169689Skan(define_constraint "J" 89169689Skan "Integer zero." 90169689Skan (and (match_code "const_int") 91169689Skan (match_test "ival == 0"))) 92169689Skan 93169689Skan(define_constraint "K" 94169689Skan "An unsigned 16-bit constant (for logic instructions)." 95169689Skan (and (match_code "const_int") 96169689Skan (match_test "SMALL_OPERAND_UNSIGNED (ival)"))) 97169689Skan 98169689Skan(define_constraint "L" 99169689Skan "A signed 32-bit constant in which the lower 16 bits are zero. 100169689Skan Such constants can be loaded using @code{lui}." 101169689Skan (and (match_code "const_int") 102169689Skan (match_test "LUI_OPERAND (ival)"))) 103169689Skan 104169689Skan(define_constraint "M" 105169689Skan "A constant that cannot be loaded using @code{lui}, @code{addiu} 106169689Skan or @code{ori}." 107169689Skan (and (match_code "const_int") 108169689Skan (match_test "!SMALL_OPERAND (ival)") 109169689Skan (match_test "!SMALL_OPERAND_UNSIGNED (ival)") 110169689Skan (match_test "!LUI_OPERAND (ival)"))) 111169689Skan 112169689Skan(define_constraint "N" 113169689Skan "A constant in the range -65535 to -1 (inclusive)." 114169689Skan (and (match_code "const_int") 115169689Skan (match_test "ival >= -0xffff && ival < 0"))) 116169689Skan 117169689Skan(define_constraint "O" 118169689Skan "A signed 15-bit constant." 119169689Skan (and (match_code "const_int") 120169689Skan (match_test "ival >= -0x4000 && ival < 0x4000"))) 121169689Skan 122169689Skan(define_constraint "P" 123169689Skan "A constant in the range 1 to 65535 (inclusive)." 124169689Skan (and (match_code "const_int") 125169689Skan (match_test "ival > 0 && ival < 0x10000"))) 126169689Skan 127169689Skan;; Floating-point constraints 128169689Skan 129169689Skan(define_constraint "G" 130169689Skan "Floating-point zero." 131169689Skan (and (match_code "const_double") 132169689Skan (match_test "op == CONST0_RTX (mode)"))) 133169689Skan 134169689Skan;; General constraints 135169689Skan 136169689Skan(define_constraint "Q" 137169689Skan "@internal" 138169689Skan (match_operand 0 "const_arith_operand")) 139169689Skan 140169689Skan(define_memory_constraint "R" 141169689Skan "An address that can be used in a non-macro load or store." 142169689Skan (and (match_code "mem") 143169689Skan (match_test "mips_fetch_insns (op) == 1"))) 144169689Skan 145169689Skan(define_constraint "S" 146169689Skan "@internal 147169689Skan A constant call address." 148169689Skan (and (match_operand 0 "call_insn_operand") 149169689Skan (match_test "CONSTANT_P (op)"))) 150169689Skan 151169689Skan(define_constraint "T" 152169689Skan "@internal 153169689Skan A constant @code{move_operand} that cannot be safely loaded into @code{$25} 154169689Skan using @code{la}." 155169689Skan (and (match_operand 0 "move_operand") 156169689Skan (match_test "CONSTANT_P (op)") 157169689Skan (match_test "mips_dangerous_for_la25_p (op)"))) 158169689Skan 159169689Skan(define_constraint "U" 160169689Skan "@internal 161169689Skan A constant @code{move_operand} that can be safely loaded into @code{$25} 162169689Skan using @code{la}." 163169689Skan (and (match_operand 0 "move_operand") 164169689Skan (match_test "CONSTANT_P (op)") 165169689Skan (match_test "!mips_dangerous_for_la25_p (op)"))) 166169689Skan 167169689Skan(define_memory_constraint "W" 168169689Skan "@internal 169169689Skan A memory address based on a member of @code{BASE_REG_CLASS}. This is 170169689Skan true for all non-mips16 references (although it can sometimes be implicit 171169689Skan if @samp{!TARGET_EXPLICIT_RELOCS}). For MIPS16, it excludes stack and 172169689Skan constant-pool references." 173169689Skan (and (match_code "mem") 174169689Skan (match_operand 0 "memory_operand") 175169689Skan (ior (match_test "!TARGET_MIPS16") 176169689Skan (and (not (match_operand 0 "stack_operand")) 177169689Skan (not (match_test "CONSTANT_P (XEXP (op, 0))")))))) 178169689Skan 179169689Skan(define_constraint "YG" 180169689Skan "@internal 181169689Skan A vector zero." 182169689Skan (and (match_code "const_vector") 183169689Skan (match_test "op == CONST0_RTX (mode)"))) 184169689Skan 185169689Skan(define_constraint "YA" 186169689Skan "@internal 187169689Skan An unsigned 6-bit constant." 188169689Skan (and (match_code "const_int") 189169689Skan (match_test "UIMM6_OPERAND (ival)"))) 190169689Skan 191169689Skan(define_constraint "YB" 192169689Skan "@internal 193169689Skan A signed 10-bit constant." 194169689Skan (and (match_code "const_int") 195169689Skan (match_test "IMM10_OPERAND (ival)"))) 196