xref: /netbsd-src/external/gpl3/gcc/dist/gcc/config/mn10300/constraints.md (revision b757af438b42b93f8c6571f026d8b8ef3eaf5fc9)
1;; Constraint definitions for the MN10300.
2;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3;;
4;; This file is part of GCC.
5;;
6;; GCC is free software; you can redistribute it and/or modify
7;; it under the terms of the GNU General Public License as published by
8;; the Free Software Foundation; either version 3, or (at your option)
9;; any later version.
10;;
11;; GCC is distributed in the hope that it will be useful,
12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14;; GNU General Public License for more details.
15;;
16;; You should have received a copy of the GNU General Public License
17;; along with GCC; see the file COPYING3.  If not see
18;; <http://www.gnu.org/licenses/>.
19
20(define_register_constraint "d" "DATA_REGS"
21  "A data register.")
22
23(define_register_constraint "a" "ADDRESS_REGS"
24  "An address register.")
25
26(define_register_constraint "y" "SP_REGS"
27  "An SP register (if available).")
28
29(define_register_constraint "x" "TARGET_AM33 ? EXTENDED_REGS : NO_REGS"
30  "An extended register.")
31
32(define_register_constraint "f" "TARGET_AM33_2 ? FP_REGS : NO_REGS"
33  "A floating point register.")
34
35(define_register_constraint "A" "TARGET_AM33_2 ? FP_ACC_REGS : NO_REGS"
36  "A floating point accumulator register.")
37
38(define_memory_constraint "Q"
39  "@internal"
40  (and (match_code "mem")
41       (match_test "!CONSTANT_ADDRESS_P (XEXP (op, 0))")))
42
43(define_memory_constraint "R"
44  "@internal"
45  (and (match_code "mem")
46       (match_test "mode == QImode")
47       (ior (match_test "CONSTANT_ADDRESS_P (XEXP (op, 0))")
48	    (and (match_test "GET_CODE (XEXP (op, 0)) == REG")
49		 (match_test "REG_OK_FOR_BIT_BASE_P (XEXP (op, 0))")
50		 (match_test "XEXP (op, 0) != stack_pointer_rtx"))
51	    (and (match_test "GET_CODE (XEXP (op, 0)) == PLUS")
52		 (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == REG")
53		 (match_test "REG_OK_FOR_BIT_BASE_P (XEXP (XEXP (op, 0), 0))")
54		 (match_test "XEXP (XEXP (op, 0), 0) != stack_pointer_rtx")
55		 (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT")
56		 (match_test "INT_8_BITS (INTVAL (XEXP (XEXP (op, 0), 1)))")))))
57
58(define_memory_constraint "T"
59  "@internal"
60  (and (match_code "mem")
61       (match_test "mode == QImode")
62       (and (match_test "GET_CODE (XEXP (op, 0)) == REG")
63	    (match_test "REG_OK_FOR_BIT_BASE_P (XEXP (op, 0))")
64	    (match_test "XEXP (op, 0) != stack_pointer_rtx"))))
65
66(define_constraint "S"
67  "@internal"
68  (if_then_else (match_test "flag_pic")
69	(and (match_test "GET_CODE (op) == UNSPEC")
70	     (ior (match_test "XINT (op, 1) == UNSPEC_PLT")
71		  (match_test "XINT (op, 1) == UNSPEC_PIC")
72		  (match_test "XINT (op, 1) == UNSPEC_GOTSYM_OFF")))
73	(match_test "GET_CODE (op) == SYMBOL_REF")))
74
75;; Integer constraints
76
77(define_constraint "I"
78  "An integer zero."
79  (and (match_code "const_int")
80       (match_test "ival == 0")))
81
82(define_constraint "J"
83  "An integer one."
84  (and (match_code "const_int")
85       (match_test "ival == 1")))
86
87(define_constraint "K"
88  "An integer two."
89  (and (match_code "const_int")
90       (match_test "ival == 2")))
91
92(define_constraint "L"
93  "An integer four."
94  (and (match_code "const_int")
95       (match_test "ival == 4")))
96
97(define_constraint "M"
98  "An integer three."
99  (and (match_code "const_int")
100       (match_test "ival == 3")))
101
102(define_constraint "N"
103  "An integer of either 255 or 65535."
104  (and (match_code "const_int")
105       (ior (match_test "ival == 255")
106	    (match_test "ival == 65535"))))
107
108;; Floating-point constraints
109(define_constraint "G"
110  "Floating-point zero."
111  (and (match_code "const_double")
112       (match_test "op == CONST0_RTX (mode)")))
113