2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / config / rx / constraints.md
blobd981f66acf9583dca2ba445d32984b1a94b867b4
1 ;; Constraint definitions for Renesas RX.
2 ;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
3 ;; Contributed by Red Hat.
4 ;;
5 ;; This file is part of GCC.
6 ;;
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public 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/>.
22 (define_constraint "Symbol"
23   "@internal Constraint on the type of rtx allowed in call insns"
24   (match_test "GET_CODE (op) == SYMBOL_REF")
28 (define_constraint "Int08"
29   "@internal A signed or unsigned 8-bit immediate value"
30   (and (match_code "const_int")
31        (match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 8), (1 << 8) - 1)")
32   )
35 (define_constraint "Sint08"
36   "@internal A signed 8-bit immediate value"
37   (and (match_code "const_int")
38        (match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 7), (1 << 7) - 1)")
39   )
42 (define_constraint "Sint16"
43   "@internal A signed 16-bit immediate value"
44   (and (match_code "const_int")
45        (match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 15), (1 << 15) - 1)")
46   )
49 (define_constraint "Sint24"
50   "@internal A signed 24-bit immediate value"
51   (and (match_code "const_int")
52        (match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 23), (1 << 23) - 1)")
53   )
56 ;; This constraint is used by the SUBSI3 pattern because the
57 ;; RX SUB instruction can only take a 4-bit unsigned integer
58 ;; value.  Also used by the MVTIPL instruction.
59 (define_constraint "Uint04"
60   "@internal An unsigned 4-bit immediate value"
61   (and (match_code "const_int")
62        (match_test "IN_RANGE (ival, 0, 15)")
63   )
66 (define_constraint "NEGint4"
67   "@internal An signed 4-bit negative immediate value"
68   (and (match_code "const_int")
69        (match_test "IN_RANGE (ival, -15, -1)")
70   )
73 ;; This is used in arithmetic and logic instructions for
74 ;; a source operand that lies in memory and which satisfies
75 ;; rx_restricted_memory_address().
77 (define_memory_constraint "Q"
78   "A MEM which only uses REG or REG+INT addressing."
79   (and (match_code "mem")
80        (ior (match_code "reg" "0")
81             (and (match_code "plus" "0")
82                  (and (match_code "reg,subreg" "00")
83                       (match_code "const_int" "01")
84                  )
85             )
86        )
87   )
90 (define_constraint "Rpid"
91   "A MEM to a PID variable"
92   (and (match_code "mem")
93        (and (match_code "plus" "0")
94             (and (match_code "reg,subreg" "00")
95                  (match_code "unspec" "01")
96             )
97        )
98   )
101 (define_constraint "Rpda"
102   "An address to a PID variable"
103   (and (match_code "plus" "")
104        (and (match_code "reg,subreg" "0")
105             (match_code "unspec" "1")
106        )
107   )
110 (define_constraint "CALL_OP_SYMBOL_REF"
111 "constraint for call instructions using symbol ref"
112 (and (match_test "!TARGET_JSR")
113      (match_code "symbol_ref"))