| 1 |
;; Constraint definitions for Renesas RX. |
| 2 |
;; Copyright (C) 2008-2025 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. |
| 11 |
;; |
| 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. |
| 16 |
;; |
| 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/>. |
| 20 |
|
| 21 |
|
| 22 |
(define_constraint "Symbol" |
| 23 |
"@internal Constraint on the type of rtx allowed in call insns" |
| 24 |
(match_test "GET_CODE (op) == SYMBOL_REF") |
| 25 |
) |
| 26 |
|
| 27 |
|
| 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 |
) |
| 33 |
) |
| 34 |
|
| 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 |
) |
| 40 |
) |
| 41 |
|
| 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 |
) |
| 47 |
) |
| 48 |
|
| 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 |
) |
| 54 |
) |
| 55 |
|
| 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 |
) |
| 64 |
) |
| 65 |
|
| 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 |
) |
| 71 |
) |
| 72 |
|
| 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(). |
| 76 |
|
| 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 |
(and (match_code "const_int" "01") |
| 84 |
(match_test "rx_is_restricted_memory_address (XEXP (op, 0), mode)")) |
| 85 |
) |
| 86 |
) |
| 87 |
) |
| 88 |
) |
| 89 |
) |
| 90 |
|
| 91 |
(define_constraint "Rpid" |
| 92 |
"A MEM to a PID variable" |
| 93 |
(and (match_code "mem") |
| 94 |
(and (match_code "plus" "0") |
| 95 |
(and (match_code "reg,subreg" "00") |
| 96 |
(match_code "unspec" "01") |
| 97 |
) |
| 98 |
) |
| 99 |
) |
| 100 |
) |
| 101 |
|
| 102 |
(define_constraint "Rpda" |
| 103 |
"An address to a PID variable" |
| 104 |
(and (match_code "plus" "") |
| 105 |
(and (match_code "reg,subreg" "0") |
| 106 |
(match_code "unspec" "1") |
| 107 |
) |
| 108 |
) |
| 109 |
) |
| 110 |
|
| 111 |
(define_constraint "CALL_OP_SYMBOL_REF" |
| 112 |
"constraint for call instructions using symbol ref" |
| 113 |
(and (match_test "!TARGET_JSR") |
| 114 |
(match_code "symbol_ref")) |
| 115 |
) |