Fix version check for ATTRIBUTE_GCC_DUMP_PRINTF
[official-gcc.git] / gcc / config / ft32 / constraints.md
blob516bfc083a6edb58530ccee3ff5a8cde478cff83
1 ;; Constraint definitions for FT32
2 ;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
3 ;; Contributed by FTDI <support@ftdi.com>
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3.  If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; -------------------------------------------------------------------------
22 ;; Constraints
23 ;; -------------------------------------------------------------------------
25 (define_memory_constraint "A"
26   "An absolute address."
27   (and (match_code "mem")
28        (match_test "(!ft32_is_mem_pm(op))")
29        (ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
30             (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
31             (match_test "GET_CODE (XEXP (op, 0)) == CONST_INT")
32             (and (match_test "(GET_CODE (XEXP (op, 0)) == PLUS)")
33                  (ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF")
34                       (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF")
35                       (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == CONST_INT"))
36                  (ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == SYMBOL_REF")
37                       (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF")
38                       (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))))))
40 (define_memory_constraint "B"
41   "An offset address."
42   (and (match_code "mem")
43        (match_test "(!ft32_is_mem_pm(op))")
44        (match_test "(GET_CODE (XEXP (op, 0)) == PLUS)")))
46 (define_memory_constraint "W"
47   "A register indirect memory operand."
48   (and (match_code "mem")
49        (match_test "!ft32_is_mem_pm(op)
50         && REG_P (XEXP (op, 0))
51                     && REGNO_OK_FOR_BASE_P (REGNO (XEXP (op, 0)))")))
53 (define_memory_constraint "e"
54   "An offset address."
55   (and (match_code "mem")
56        (match_test "ft32_is_mem_pm(op) && (
57           (GET_CODE (XEXP (op, 0)) == SYMBOL_REF) ||
58           (GET_CODE (XEXP (op, 0)) == LABEL_REF) ||
59           (GET_CODE (XEXP (op, 0)) == CONST_INT) ||
60           (GET_CODE (XEXP (op, 0)) == CONST))"
61        )))
63 (define_memory_constraint "f"
64   "An offset address."
65   (and (match_code "mem")
66        (match_test "ft32_is_mem_pm(op) && (
67           ((GET_CODE (XEXP (op, 0)) == PLUS)) ||
68           (GET_CODE (XEXP (op, 0)) == REG))"
69        )))
71 (define_constraint "O"
72   "The constant zero or one"
73   (and (match_code "const_int")
74        (match_test "((ival == 0) || (ival == 1))")))
76 (define_constraint "I"
77   "A 16-bit signed constant (-32768..32767)"
78   (and (match_code "const_int")
79        (match_test "ival >= -32768 && ival <= 32767")))
81 (define_constraint "w"
82   "A bitfield mask suitable for bext or bins"
83   (and (match_code "const_int")
84        (match_test "ft32_as_bitfield(ival) != -1")))
86 (define_constraint "x"
87   "An inverted bitfield mask suitable for bext or bins"
88   (and (match_code "const_int")
89        (match_test "ft32_as_bitfield(0xffffffff ^ ival) != -1")))
91 (define_constraint "L"
92   "A 16-bit unsigned constant, multiple of 4 (-65532..0)"
93   (and (match_code "const_int")
94        (match_test "ival >= -65532 && ival <= 0 && (ival & 3) == 0")))
96 (define_constraint "S"
97   "A 20-bit signed constant (-524288..524287)"
98   (ior
99     (and (match_code "const_int")
100          (match_test "ival >= -524288 && ival <= 524287"))
101     (match_test "GET_CODE (op) == LABEL_REF")
102     (match_test "GET_CODE (op) == SYMBOL_REF")
103     (match_test "GET_CODE (op) == CONST")))
105 (define_constraint "b"
106   "A constant for a bitfield width (1..16)"
107   (and (match_code "const_int")
108        (match_test "ival >= 1 && ival <= 16")))
110 (define_constraint "KA"
111   "A 10-bit signed constant (-512..511)"
112   (and (match_code "const_int")
113        (match_test "ival >= -512 && ival <= 511")))