OSDN Git Service

Backport from mainline
[pf3gnuchains/gcc-fork.git] / gcc / config / v850 / constraints.md
1 ;; Constraint definitions for V850.
2 ;; Copyright (C) 2011 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 "e" "EVEN_REGS"
21   "@internal")
22
23 ;; Integer constraints.
24 (define_constraint "I"
25   "Integer constant 0."
26   (and (match_code "const_int")
27        (match_test "ival == 0")))
28
29 (define_constraint "J"
30   "A signed 5-bit immediate."
31   (and (match_code "const_int")
32        (match_test "ival >= -16 && ival <= 15")))
33
34 (define_constraint "K"
35   "A signed 16-bit immediate."
36   (and (match_code "const_int")
37        (match_test "ival >= -32768 && ival <= 32767")))
38
39 (define_constraint "L"
40   "A valid constant for a movhi instruction."
41   (and (match_code "const_int")
42        (ior (match_test "(ival | 0x7fff0000) == 0x7fff0000")
43             (match_test "(ival | 0x7fff0000) + 0x10000 == 0"))))
44
45 (define_constraint "M"
46   "An unsigned 16-bit immediate."
47   (and (match_code "const_int")
48        (match_test "ival >= 0 && ival <= 65535")))
49
50 (define_constraint "N"
51   "An unsigned 5-bit immediate in shift instructions."
52   (and (match_code "const_int")
53        (match_test "ival >= 0 && ival <= 31")))
54
55 (define_constraint "O"
56   "A signed 9-bit immediate for word multiply instructions."
57   (and (match_code "const_int")
58        (match_test "ival >= -255 && ival <= 255")))
59
60 (define_constraint "P"
61   "@internal"
62   (and (match_code "const_int")
63        (match_test "0")))
64
65 ;; Floating-point constraints.
66 (define_constraint "G"
67   "A zero of some form."
68   (and (match_code "const_double")
69        (ior (match_test "GET_MODE_CLASS (mode) == MODE_FLOAT")
70             (match_test "GET_MODE_CLASS (mode) == MODE_INT"))
71        (match_test "op == CONST0_RTX (mode)")))
72
73 (define_constraint "H"
74   "@internal"
75   (and (match_code "const_double")
76        (match_test "0")))
77
78 ;;; Extra constraints.
79 (define_constraint "Q"
80   "A memory address that does not contain a symbol address."
81   (and (match_code "mem")
82        (match_test "ep_memory_operand (op, mode, FALSE)")))
83
84 (define_constraint "R"
85   "@internal"
86   (match_test "special_symbolref_operand (op, VOIDmode)"))
87
88 (define_constraint "S"
89   "@internal"
90   (and (match_code "symbol_ref")
91        (match_test "!SYMBOL_REF_ZDA_P (op)")))
92
93 (define_constraint "T"
94   "@internal"
95   (match_test "ep_memory_operand (op, mode, TRUE)"))
96
97 (define_constraint "U"
98   "@internal"
99   (ior (and (match_code "symbol_ref")
100             (match_test "SYMBOL_REF_ZDA_P (op)"))
101        (and (match_code "const")
102             (match_test "GET_CODE (XEXP (op, 0)) == PLUS")
103             (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF")
104             (match_test "SYMBOL_REF_ZDA_P (XEXP (XEXP (op, 0), 0))"))))
105
106 (define_constraint "W"
107   "@internal"
108   (match_test "disp23_operand (op, VOIDmode)"))