Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / config / mmix / constraints.md
1 ;; MMIX constraints
2 ;; Copyright (C) 2012-2013 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 it
7 ;; 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, but WITHOUT
12 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14 ;; 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 "x" "SYSTEM_REGS"
21   "@internal")
22
23 (define_register_constraint "y" "REMAINDER_REG"
24   "@internal")
25
26 (define_register_constraint "z" "HIMULT_REG"
27   "@internal")
28
29 (define_constraint "I"
30   "A 8-bit unsigned integer"
31   (and (match_code "const_int")
32        (match_test "IN_RANGE (ival, 0, 255)")))
33
34 (define_constraint "J"
35   "A 16-bit unsigned integer."
36   (and (match_code "const_int")
37        (match_test "IN_RANGE (ival, 0, 65535)")))
38
39 (define_constraint "K"
40   "An integer between -255 and 0."
41   (and (match_code "const_int")
42        (match_test "IN_RANGE (ival, -255, 0)")))
43
44 (define_constraint "L"
45   "@internal"
46   (and (match_code "const_int")
47        (match_test "mmix_shiftable_wyde_value (ival)")))
48
49 (define_constraint "M"
50   "The value 0."
51   (and (match_code "const_int")
52        (match_test "ival == 0")))
53
54 (define_constraint "N"
55   "@internal"
56   (and (match_code "const_int")
57        (match_test "mmix_shiftable_wyde_value (~ival)")))
58
59 (define_constraint "O"
60   "The value 3, 5, 9, or 17."
61   (and (match_code "const_int")
62        (ior (match_test "ival == 3")
63             (match_test "ival == 5")
64             (match_test "ival == 9")
65             (match_test "ival == 17"))))
66
67 ;; FIXME: M (or G) is redundant.
68
69 (define_constraint "G"
70   "Floating-point zero."
71   (and (match_code "const_double")
72        (match_test "op == CONST0_RTX (mode)")))
73
74 ;; R asks whether x is to be loaded with GETA or something else.  Right
75 ;; now, only a SYMBOL_REF and LABEL_REF can fit for
76 ;; TARGET_BASE_ADDRESSES.
77 ;;
78 ;; Only constant symbolic addresses apply.  With TARGET_BASE_ADDRESSES,
79 ;; we just allow straight LABEL_REF or SYMBOL_REFs with SYMBOL_REF_FLAG
80 ;; set right now; only function addresses and code labels.  If we change
81 ;; to let SYMBOL_REF_FLAG be set on other symbols, we have to check
82 ;; inside CONST expressions.  When TARGET_BASE_ADDRESSES is not in
83 ;; effect, a "raw" constant check together with mmix_constant_address_p
84 ;; is all that's needed; we want all constant addresses to be loaded
85 ;; with GETA then.
86
87 (define_constraint "R"
88   "@internal"
89   (and (not (match_code "const_int,const_double"))
90        (match_test "mmix_constant_address_p (op)")
91        (ior (match_test "!TARGET_BASE_ADDRESSES")
92             (match_code "LABEL_REF")
93             (and (match_code "SYMBOL_REF")
94                  (match_test "SYMBOL_REF_FLAG (op)")))))
95
96 ;; FIXME: L (or S) is redundant.
97
98 (define_constraint "S"
99   "@internal"
100   (and (match_code "const_int,const_double")
101        (match_test "mmix_shiftable_wyde_value (mmix_intval (op))")))
102
103 ;; FIXME: N (or T) is redundant.
104
105 (define_constraint "T"
106   "@internal"
107   (and (match_code "const_int,const_double")
108        (match_test "mmix_shiftable_wyde_value (~mmix_intval (op))")))
109
110 (define_address_constraint "U"
111   "@internal"
112   (match_operand 0 "mmix_address_operand"))
113
114 (define_constraint "Yf"
115   "@internal"
116   (match_operand 0 "frame_pointer_operand"))