1 ;; Constraint definitions for XSTORMY16.
2 ;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ;; Register constraints.
21 (define_register_constraint "a" "R0_REGS"
24 (define_register_constraint "b" "R1_REGS"
27 (define_register_constraint "c" "R2_REGS"
30 (define_register_constraint "d" "R8_REGS"
33 (define_register_constraint "e" "EIGHT_REGS"
36 (define_register_constraint "t" "TWO_REGS"
39 (define_register_constraint "z" "ICALL_REGS"
42 ;; Integer constraints.
43 (define_constraint "I"
44 "An integer between 0 and 3."
45 (and (match_code "const_int")
46 (match_test "IN_RANGE (ival, 0, 3)")))
48 (define_constraint "J"
50 (and (match_code "const_int")
51 (match_test "exact_log2 (ival) != -1")))
53 (define_constraint "K"
54 "A power of two when inverted."
55 (and (match_code "const_int")
56 (match_test "exact_log2 (~ival) != -1")))
58 (define_constraint "L"
59 "An 8-bit unsigned integer."
60 (and (match_code "const_int")
61 (match_test "IN_RANGE (ival, 0, 255)")))
63 (define_constraint "M"
64 "An integer between -255 and 0."
65 (and (match_code "const_int")
66 (match_test "IN_RANGE (ival, -255, 0)")))
68 (define_constraint "N"
69 "An integer between -3 and 0."
70 (and (match_code "const_int")
71 (match_test "IN_RANGE (ival, -3, 0)")))
73 (define_constraint "O"
74 "An integer between 1 and 4."
75 (and (match_code "const_int")
76 (match_test "IN_RANGE (ival, 1, 4)")))
78 (define_constraint "P"
79 "An integer between -4 and -1."
80 (and (match_code "const_int")
81 (match_test "IN_RANGE (ival, -4, -1)")))
84 (define_constraint "Q"
85 "A register push operation."
86 (and (match_code "mem")
87 (match_code "post_inc" "0")
88 (match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx")))
90 (define_constraint "R"
91 "A register pop operation."
92 (and (match_code "mem")
93 (match_code "pre_dec" "0")
94 (match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx")))
96 (define_constraint "S"
97 "An immediate memory address."
98 (and (match_code "mem")
99 (match_code "const_int" "0")
100 (match_test "xstormy16_legitimate_address_p (VOIDmode, XEXP (op, 0), false)")))
102 (define_constraint "T"
104 ;; For Rx; not implemented yet.
107 (define_constraint "U"
108 "An integer not between 2 and 15."
109 (and (match_code "const_int")
110 (match_test "!IN_RANGE (ival, 2, 15)")))
112 (define_constraint "W"
114 (match_operand 0 "xstormy16_below100_operand"))
116 (define_constraint "Z"
118 (and (match_code "const_int")
119 (match_test "ival == 0")))