constraints.md revision 169689
1169689Skan;; Constraints definitions belonging to the gcc backend for IBM S/390. 2169689Skan;; Copyright (C) 2006 Free Software Foundation, Inc. 3169689Skan;; Written by Wolfgang Gellerich, using code and information found in 4169689Skan;; files s390.md, s390.h, and s390.c. 5169689Skan;; 6169689Skan;; This file is part of GCC. 7169689Skan;; 8169689Skan;; GCC is free software; you can redistribute it and/or modify it under 9169689Skan;; the terms of the GNU General Public License as published by the Free 10169689Skan;; Software Foundation; either version 2, or (at your option) any later 11169689Skan;; version. 12169689Skan;; 13169689Skan;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 14169689Skan;; WARRANTY; without even the implied warranty of MERCHANTABILITY or 15169689Skan;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16169689Skan;; for more details. 17169689Skan;; 18169689Skan;; You should have received a copy of the GNU General Public License 19169689Skan;; along with GCC; see the file COPYING. If not, write to the Free 20169689Skan;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 21169689Skan;; 02110-1301, USA. 22169689Skan 23169689Skan 24169689Skan;; 25169689Skan;; Special constraints for s/390 machine description: 26169689Skan;; 27169689Skan;; a -- Any address register from 1 to 15. 28169689Skan;; c -- Condition code register 33. 29169689Skan;; d -- Any register from 0 to 15. 30169689Skan;; f -- Floating point registers. 31169689Skan;; t -- Access registers 36 and 37. 32169689Skan;; G -- Const double zero operand 33169689Skan;; I -- An 8-bit constant (0..255). 34169689Skan;; J -- A 12-bit constant (0..4095). 35169689Skan;; K -- A 16-bit constant (-32768..32767). 36169689Skan;; L -- Value appropriate as displacement. 37169689Skan;; (0..4095) for short displacement 38169689Skan;; (-524288..524287) for long displacement 39169689Skan;; M -- Constant integer with a value of 0x7fffffff. 40169689Skan;; N -- Multiple letter constraint followed by 4 parameter letters. 41169689Skan;; 0..9,x: number of the part counting from most to least significant 42169689Skan;; H,Q: mode of the part 43169689Skan;; D,S,H: mode of the containing operand 44169689Skan;; 0,F: value of the other parts (F - all bits set) 45169689Skan;; 46169689Skan;; The constraint matches if the specified part of a constant 47169689Skan;; has a value different from its other parts. If the letter x 48169689Skan;; is specified instead of a part number, the constraint matches 49169689Skan;; if there is any single part with non-default value. 50169689Skan;; O -- Multiple letter constraint followed by 1 parameter. 51169689Skan;; s: Signed extended immediate value (-2G .. 2G-1). 52169689Skan;; p: Positive extended immediate value (0 .. 4G-1). 53169689Skan;; n: Negative extended immediate value (-4G .. -1). 54169689Skan;; These constraints do not accept any operand if the machine does 55169689Skan;; not provide the extended-immediate facility. 56169689Skan;; P -- Any integer constant that can be loaded without literal pool. 57169689Skan;; Q -- Memory reference without index register and with short displacement. 58169689Skan;; R -- Memory reference with index register and short displacement. 59169689Skan;; S -- Memory reference without index register but with long displacement. 60169689Skan;; T -- Memory reference with index register and long displacement. 61169689Skan;; A -- Multiple letter constraint followed by Q, R, S, or T: 62169689Skan;; Offsettable memory reference of type specified by second letter. 63169689Skan;; B -- Multiple letter constraint followed by Q, R, S, or T: 64169689Skan;; Memory reference of the type specified by second letter that 65169689Skan;; does *not* refer to a literal pool entry. 66169689Skan;; U -- Pointer with short displacement. 67169689Skan;; W -- Pointer with long displacement. 68169689Skan;; Y -- Shift count operand. 69169689Skan;; 70169689Skan 71169689Skan 72169689Skan;; 73169689Skan;; Register constraints. 74169689Skan;; 75169689Skan 76169689Skan(define_register_constraint "a" 77169689Skan "ADDR_REGS" 78169689Skan "Any address register from 1 to 15.") 79169689Skan 80169689Skan 81169689Skan(define_register_constraint "c" 82169689Skan "CC_REGS" 83169689Skan "Condition code register 33") 84169689Skan 85169689Skan 86169689Skan(define_register_constraint "d" 87169689Skan "GENERAL_REGS" 88169689Skan "Any register from 0 to 15") 89169689Skan 90169689Skan 91169689Skan(define_register_constraint "f" 92169689Skan "FP_REGS" 93169689Skan "Floating point registers") 94169689Skan 95169689Skan 96169689Skan(define_register_constraint "t" 97169689Skan "ACCESS_REGS" 98169689Skan "@internal 99169689Skan Access registers 36 and 37") 100169689Skan 101169689Skan 102169689Skan;; 103169689Skan;; General constraints for constants. 104169689Skan;; 105169689Skan 106169689Skan(define_constraint "G" 107169689Skan "@internal 108169689Skan Const double zero operand" 109169689Skan (and (match_code "const_double") 110169689Skan (match_test "s390_float_const_zero_p (op)"))) 111169689Skan 112169689Skan 113169689Skan(define_constraint "I" 114169689Skan "An 8-bit constant (0..255)" 115169689Skan (and (match_code "const_int") 116169689Skan (match_test "(unsigned int) ival <= 255"))) 117169689Skan 118169689Skan 119169689Skan(define_constraint "J" 120169689Skan "A 12-bit constant (0..4095)" 121169689Skan (and (match_code "const_int") 122169689Skan (match_test "(unsigned int) ival <= 4095"))) 123169689Skan 124169689Skan 125169689Skan(define_constraint "K" 126169689Skan "A 16-bit constant (-32768..32767)" 127169689Skan (and (match_code "const_int") 128169689Skan (match_test "ival >= -32768 && ival <= 32767"))) 129169689Skan 130169689Skan 131169689Skan 132169689Skan(define_constraint "L" 133169689Skan "Value appropriate as displacement. 134169689Skan (0..4095) for short displacement 135169689Skan (-524288..524287) for long displacement" 136169689Skan (and (match_code "const_int") 137169689Skan (match_test "TARGET_LONG_DISPLACEMENT ? 138169689Skan (ival >= -524288 && ival <= 524287) 139169689Skan : (ival >= 0 && ival <= 4095)"))) 140169689Skan 141169689Skan 142169689Skan(define_constraint "M" 143169689Skan "Constant integer with a value of 0x7fffffff" 144169689Skan (and (match_code "const_int") 145169689Skan (match_test "ival == 2147483647"))) 146169689Skan 147169689Skan 148169689Skan(define_constraint "P" 149169689Skan "@internal 150169689Skan Any integer constant that can be loaded without literal pool" 151169689Skan (and (match_code "const_int") 152169689Skan (match_test "legitimate_reload_constant_p (GEN_INT (ival))"))) 153169689Skan 154169689Skan 155169689Skan(define_address_constraint "Y" 156169689Skan "Shift count operand" 157169689Skan 158169689Skan;; Simply check for the basic form of a shift count. Reload will 159169689Skan;; take care of making sure we have a proper base register. 160169689Skan 161169689Skan (match_test "s390_decompose_shift_count (op, NULL, NULL)" )) 162169689Skan 163169689Skan 164169689Skan;; N -- Multiple letter constraint followed by 4 parameter letters. 165169689Skan;; 0..9,x: number of the part counting from most to least significant 166169689Skan;; H,Q: mode of the part 167169689Skan;; D,S,H: mode of the containing operand 168169689Skan;; 0,F: value of the other parts (F = all bits set) 169169689Skan;; 170169689Skan;; The constraint matches if the specified part of a constant 171169689Skan;; has a value different from its other parts. If the letter x 172169689Skan;; is specified instead of a part number, the constraint matches 173169689Skan;; if there is any single part with non-default value. 174169689Skan;; 175169689Skan;; The following patterns define only those constraints that are actually 176169689Skan;; used in s390.md. If you need an additional one, simply add it in the 177169689Skan;; obvious way. Function s390_N_constraint_str is ready to handle all 178169689Skan;; combinations. 179169689Skan;; 180169689Skan 181169689Skan 182169689Skan(define_constraint "NxQS0" 183169689Skan "@internal" 184169689Skan (and (match_code "const_int") 185169689Skan (match_test "s390_N_constraint_str (\"xQS0\", ival)"))) 186169689Skan 187169689Skan 188169689Skan(define_constraint "NxQD0" 189169689Skan "@internal" 190169689Skan (and (match_code "const_int") 191169689Skan (match_test "s390_N_constraint_str (\"xQD0\", ival)"))) 192169689Skan 193169689Skan 194169689Skan(define_constraint "N3HD0" 195169689Skan "@internal" 196169689Skan (and (match_code "const_int") 197169689Skan (match_test "s390_N_constraint_str (\"3HD0\", ival)"))) 198169689Skan 199169689Skan 200169689Skan(define_constraint "N2HD0" 201169689Skan "@internal" 202169689Skan (and (match_code "const_int") 203169689Skan (match_test "s390_N_constraint_str (\"2HD0\", ival)"))) 204169689Skan 205169689Skan 206169689Skan(define_constraint "N1SD0" 207169689Skan "@internal" 208169689Skan (and (match_code "const_int") 209169689Skan (match_test "s390_N_constraint_str (\"1SD0\", ival)"))) 210169689Skan 211169689Skan 212169689Skan(define_constraint "N1HS0" 213169689Skan "@internal" 214169689Skan (and (match_code "const_int") 215169689Skan (match_test "s390_N_constraint_str (\"1HS0\", ival)"))) 216169689Skan 217169689Skan 218169689Skan(define_constraint "N1HD0" 219169689Skan "@internal" 220169689Skan (and (match_code "const_int") 221169689Skan (match_test "s390_N_constraint_str (\"1HD0\", ival)"))) 222169689Skan 223169689Skan 224169689Skan(define_constraint "N0SD0" 225169689Skan "@internal" 226169689Skan (and (match_code "const_int") 227169689Skan (match_test "s390_N_constraint_str (\"0SD0\", ival)"))) 228169689Skan 229169689Skan 230169689Skan(define_constraint "N0HS0" 231169689Skan "@internal" 232169689Skan (and (match_code "const_int") 233169689Skan (match_test "s390_N_constraint_str (\"0HS0\", ival)"))) 234169689Skan 235169689Skan 236169689Skan(define_constraint "N0HD0" 237169689Skan "@internal" 238169689Skan (and (match_code "const_int") 239169689Skan (match_test "s390_N_constraint_str (\"0HD0\", ival)"))) 240169689Skan 241169689Skan 242169689Skan(define_constraint "NxQDF" 243169689Skan "@internal" 244169689Skan (and (match_code "const_int") 245169689Skan (match_test "s390_N_constraint_str (\"xQDF\", ival)"))) 246169689Skan 247169689Skan 248169689Skan(define_constraint "N1SDF" 249169689Skan "@internal" 250169689Skan (and (match_code "const_int") 251169689Skan (match_test "s390_N_constraint_str (\"1SDF\", ival)"))) 252169689Skan 253169689Skan 254169689Skan(define_constraint "N0SDF" 255169689Skan "@internal" 256169689Skan (and (match_code "const_int") 257169689Skan (match_test "s390_N_constraint_str (\"0SDF\", ival)"))) 258169689Skan 259169689Skan 260169689Skan(define_constraint "N3HDF" 261169689Skan "@internal" 262169689Skan (and (match_code "const_int") 263169689Skan (match_test "s390_N_constraint_str (\"3HDF\", ival)"))) 264169689Skan 265169689Skan 266169689Skan(define_constraint "N2HDF" 267169689Skan "@internal" 268169689Skan (and (match_code "const_int") 269169689Skan (match_test "s390_N_constraint_str (\"2HDF\", ival)"))) 270169689Skan 271169689Skan 272169689Skan(define_constraint "N1HDF" 273169689Skan "@internal" 274169689Skan (and (match_code "const_int") 275169689Skan (match_test "s390_N_constraint_str (\"1HDF\", ival)"))) 276169689Skan 277169689Skan 278169689Skan(define_constraint "N0HDF" 279169689Skan "@internal" 280169689Skan (and (match_code "const_int") 281169689Skan (match_test "s390_N_constraint_str (\"0HDF\", ival)"))) 282169689Skan 283169689Skan 284169689Skan(define_constraint "N0HSF" 285169689Skan "@internal" 286169689Skan (and (match_code "const_int") 287169689Skan (match_test "s390_N_constraint_str (\"0HSF\", ival)"))) 288169689Skan 289169689Skan 290169689Skan(define_constraint "N1HSF" 291169689Skan "@internal" 292169689Skan (and (match_code "const_int") 293169689Skan (match_test "s390_N_constraint_str (\"1HSF\", ival)"))) 294169689Skan 295169689Skan 296169689Skan(define_constraint "NxQSF" 297169689Skan "@internal" 298169689Skan (and (match_code "const_int") 299169689Skan (match_test "s390_N_constraint_str (\"xQSF\", ival)"))) 300169689Skan 301169689Skan 302169689Skan(define_constraint "NxQHF" 303169689Skan "@internal" 304169689Skan (and (match_code "const_int") 305169689Skan (match_test "s390_N_constraint_str (\"xQHF\", ival)"))) 306169689Skan 307169689Skan 308169689Skan(define_constraint "NxQH0" 309169689Skan "@internal" 310169689Skan (and (match_code "const_int") 311169689Skan (match_test "s390_N_constraint_str (\"xQH0\", ival)"))) 312169689Skan 313169689Skan 314169689Skan 315169689Skan 316169689Skan;; 317169689Skan;; Double-letter constraints starting with O follow. 318169689Skan;; 319169689Skan 320169689Skan 321169689Skan(define_constraint "Os" 322169689Skan "@internal 323169689Skan Signed extended immediate value (-2G .. 2G-1). 324169689Skan This constraint will only match if the machine provides 325169689Skan the extended-immediate facility." 326169689Skan (and (match_code "const_int") 327169689Skan (match_test "s390_O_constraint_str ('s', ival)"))) 328169689Skan 329169689Skan 330169689Skan(define_constraint "Op" 331169689Skan "@internal 332169689Skan Positive extended immediate value (0 .. 4G-1). 333169689Skan This constraint will only match if the machine provides 334169689Skan the extended-immediate facility." 335169689Skan (and (match_code "const_int") 336169689Skan (match_test "s390_O_constraint_str ('p', ival)"))) 337169689Skan 338169689Skan 339169689Skan(define_constraint "On" 340169689Skan "@internal 341169689Skan Negative extended immediate value (-4G .. -1). 342169689Skan This constraint will only match if the machine provides 343169689Skan the extended-immediate facility." 344169689Skan (and (match_code "const_int") 345169689Skan (match_test "s390_O_constraint_str ('n', ival)"))) 346169689Skan 347169689Skan 348169689Skan 349169689Skan 350169689Skan;; 351169689Skan;; Memory constraints follow. 352169689Skan;; 353169689Skan 354169689Skan(define_memory_constraint "Q" 355169689Skan "Memory reference without index register and with short displacement" 356169689Skan (match_test "s390_mem_constraint (\"Q\", op)")) 357169689Skan 358169689Skan 359169689Skan 360169689Skan(define_memory_constraint "R" 361169689Skan "Memory reference with index register and short displacement" 362169689Skan (match_test "s390_mem_constraint (\"R\", op)")) 363169689Skan 364169689Skan 365169689Skan(define_memory_constraint "S" 366169689Skan "Memory reference without index register but with long displacement" 367169689Skan (match_test "s390_mem_constraint (\"S\", op)")) 368169689Skan 369169689Skan 370169689Skan(define_memory_constraint "T" 371169689Skan "Memory reference with index register and long displacement" 372169689Skan (match_test "s390_mem_constraint (\"T\", op)")) 373169689Skan 374169689Skan 375169689Skan 376169689Skan(define_memory_constraint "AQ" 377169689Skan "@internal 378169689Skan Offsettable memory reference without index register and with short displacement" 379169689Skan (match_test "s390_mem_constraint (\"AQ\", op)")) 380169689Skan 381169689Skan 382169689Skan(define_memory_constraint "AR" 383169689Skan "@internal 384169689Skan Offsettable memory reference with index register and short displacement" 385169689Skan (match_test "s390_mem_constraint (\"AR\", op)")) 386169689Skan 387169689Skan 388169689Skan(define_memory_constraint "AS" 389169689Skan "@internal 390169689Skan Offsettable memory reference without index register but with long displacement" 391169689Skan (match_test "s390_mem_constraint (\"AS\", op)")) 392169689Skan 393169689Skan 394169689Skan(define_memory_constraint "AT" 395169689Skan "@internal 396169689Skan Offsettable memory reference with index register and long displacement" 397169689Skan (match_test "s390_mem_constraint (\"AT\", op)")) 398169689Skan 399169689Skan 400169689Skan 401169689Skan(define_constraint "BQ" 402169689Skan "@internal 403169689Skan Memory reference without index register and with short 404169689Skan displacement that does *not* refer to a literal pool entry." 405169689Skan (match_test "s390_mem_constraint (\"BQ\", op)")) 406169689Skan 407169689Skan 408169689Skan(define_constraint "BR" 409169689Skan "@internal 410169689Skan Memory reference with index register and short displacement that 411169689Skan does *not* refer to a literal pool entry. " 412169689Skan (match_test "s390_mem_constraint (\"BR\", op)")) 413169689Skan 414169689Skan 415169689Skan(define_constraint "BS" 416169689Skan "@internal 417169689Skan Memory reference without index register but with long displacement 418169689Skan that does *not* refer to a literal pool entry. " 419169689Skan (match_test "s390_mem_constraint (\"BS\", op)")) 420169689Skan 421169689Skan 422169689Skan(define_constraint "BT" 423169689Skan "@internal 424169689Skan Memory reference with index register and long displacement that 425169689Skan does *not* refer to a literal pool entry. " 426169689Skan (match_test "s390_mem_constraint (\"BT\", op)")) 427169689Skan 428169689Skan 429169689Skan 430169689Skan(define_address_constraint "U" 431169689Skan "Pointer with short displacement" 432169689Skan (match_test "s390_mem_constraint (\"U\", op)")) 433169689Skan 434169689Skan 435169689Skan 436169689Skan(define_address_constraint "W" 437169689Skan "Pointer with long displacement" 438169689Skan (match_test "s390_mem_constraint (\"W\", op)")) 439