1 ;; Constraint definitions for Moxie
2 ;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
3 ;; Contributed by Anthony Green <green@moxielogic.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 ;; -------------------------------------------------------------------------
23 ;; -------------------------------------------------------------------------
25 (define_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"))))
32 (define_constraint "B"
34 (and (match_code "mem")
35 (match_test "moxie_offset_address_p (op)")))
37 (define_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)))")))
43 (define_constraint "O"
45 (and (match_code "const_int")
46 (match_test "ival == 0")))
48 (define_constraint "I"
49 "An 8-bit constant (0..255)"
50 (and (match_code "const_int")
51 (match_test "ival >= 0 && ival <= 255")))
53 (define_constraint "N"
54 "A constant -(0..255)"
55 (and (match_code "const_int")
56 (match_test "ival >= -255 && ival <= 0")))