| 1 |
;; Constraint definitions for Moxie |
| 2 |
;; Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Anthony Green <[email protected]> |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 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. |
| 11 |
|
| 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. |
| 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 |
;; Constraints |
| 23 |
;; ------------------------------------------------------------------------- |
| 24 |
|
| 25 |
(define_memory_constraint "A" |
| 26 |
"An absolute address." |
| 27 |
(and (match_code "mem") |
| 28 |
(ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF") |
| 29 |
(match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF") |
| 30 |
(match_test "GET_CODE (XEXP (op, 0)) == CONST")))) |
| 31 |
|
| 32 |
(define_memory_constraint "B" |
| 33 |
"An offset address." |
| 34 |
(and (match_code "mem") |
| 35 |
(match_test "moxie_offset_address_p (op)"))) |
| 36 |
|
| 37 |
(define_memory_constraint "W" |
| 38 |
"A register indirect memory operand." |
| 39 |
(and (match_code "mem") |
| 40 |
(match_test "REG_P (XEXP (op, 0)) |
| 41 |
&& REGNO_OK_FOR_BASE_P (REGNO (XEXP (op, 0)))"))) |
| 42 |
|
| 43 |
(define_constraint "O" |
| 44 |
"The constant zero" |
| 45 |
(and (match_code "const_int") |
| 46 |
(match_test "ival == 0"))) |
| 47 |
|
| 48 |
(define_constraint "I" |
| 49 |
"An 8-bit constant (0..255)" |
| 50 |
(and (match_code "const_int") |
| 51 |
(match_test "ival >= 0 && ival <= 255"))) |
| 52 |
|
| 53 |
(define_constraint "N" |
| 54 |
"A constant -(0..255)" |
| 55 |
(and (match_code "const_int") |
| 56 |
(match_test "ival >= -255 && ival <= 0"))) |