1 ;; Constraint definitions for the Motorola MCore
3 ;; Free Software Foundation, Inc.
5 ;; This file is part of GCC.
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)
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/>.
21 ;; Register constraints.
22 (define_register_constraint "a" "LRW_REGS"
25 (define_register_constraint "b" "ONLYR1_REGS"
28 (define_register_constraint "c" "C_REGS"
31 (define_register_constraint "x" "ALL_REGS"
34 ;; Integer constraints.
35 (define_constraint "I"
36 "An integer in the range 0 to 127."
37 (and (match_code "const_int")
38 (match_test "IN_RANGE (ival, 0, 127)")))
40 (define_constraint "J"
41 "An integer in the range 1 to 32."
42 (and (match_code "const_int")
43 (match_test "IN_RANGE (ival, 1, 32)")))
45 (define_constraint "K"
46 "A shift operand, an integer in the range 0 to 31."
47 (and (match_code "const_int")
48 (match_test "IN_RANGE (ival, 0, 31)")))
50 (define_constraint "L"
51 "A negative arithmetic operand in the range -32 to -1."
52 (and (match_code "const_int")
53 (match_test "IN_RANGE (ival, -32, -1)")))
55 (define_constraint "M"
56 "A constant loadable by bgeni."
57 (and (match_code "const_int")
58 (match_test "exact_log2 (ival) >= 0 && exact_log2 (ival) <= 30")))
60 (define_constraint "N"
61 "A constant loadable by bmaskii, including -1."
62 (and (match_code "const_int")
63 (ior (match_test "ival == -1")
64 (and (match_test "exact_log2 (ival + 1) >= 0")
65 (match_test "exact_log2 (ival + 1) <= 30")))))
67 (define_constraint "O"
68 "A constant allowed by cmov with two constants +/- 1 of each other."
69 (and (match_code "const_int")
70 (ior (match_test "insn_const_int_ok_for_constraint (ival, CONSTRAINT_I)")
71 (match_test "insn_const_int_ok_for_constraint (ival, CONSTRAINT_M)")
72 (match_test "insn_const_int_ok_for_constraint (ival, CONSTRAINT_N)")
73 (match_test "insn_const_int_ok_for_constraint (ival - 1, CONSTRAINT_M)")
74 (match_test "insn_const_int_ok_for_constraint (ival + 1, CONSTRAINT_N)"))))
76 (define_constraint "P"
77 "A value that can be generated without an lrw instruction."
78 (and (match_code "const_int")
79 (match_test "mcore_const_ok_for_inline (ival)")))
81 ;; Floating-point constraints.
82 (define_constraint "G"
84 (and (match_code "const_double")
85 (match_test "insn_const_int_ok_for_constraint (hval, CONSTRAINT_I)")
86 (match_test "insn_const_int_ok_for_constraint (ival, CONSTRAINT_I)")))
89 (define_constraint "Q"
90 "The integer constant one."
91 (and (match_code "const_int")
92 (match_test "ival == 1")))
94 (define_constraint "R"
96 (and (match_code "mem")
97 (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")))
99 (define_constraint "S"
100 "An integer constant with 0, 1, or 2 bits clear."
101 (and (match_code "const_int")
102 (match_test "mcore_num_zeros (ival) <= 2")))
104 (define_constraint "T"
105 "An integer constant with 2 set bits."
106 (and (match_code "const_int")
107 (match_test "mcore_num_ones (ival) == 2")))
109 (define_constraint "U"
110 "The integer constant zero."
111 (and (match_code "const_int")
112 (match_test "ival == 0")))