OSDN Git Service

Backport from mainline
[pf3gnuchains/gcc-fork.git] / gcc / config / cr16 / constraints.md
1 ;; Predicates of machine description for CR16.
2 ;; Copyright (C) 2012 Free Software Foundation, Inc.
3 ;; Contributed by KPIT Cummins Infosystems Limited.
4 ;;
5 ;; This file is part of GCC.
6 ;;
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.
11 ;;
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.
16 ;;
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/>.  
20
21 ;; Constraints
22 ;; Register constraints
23 (define_register_constraint "b" "NOSP_REGS"
24   "@no sp registers")
25
26 (define_register_constraint "c" "SHORT_REGS"
27   "@short registers")
28
29 (define_register_constraint "d" "LONG_REGS"
30   "@long registers")
31
32 ;; Integer constraints.
33 (define_constraint "I"
34   "A signed 4-bit immediate."
35   (and (match_code "const_int")
36        (match_test "SIGNED_INT_FITS_N_BITS (ival, 4)")))
37
38 (define_constraint "J"
39   "A signed 5-bit immediate."
40   (and (match_code "const_int")
41        (match_test "SIGNED_INT_FITS_N_BITS (ival, 5)")))
42
43 (define_constraint "K"
44   "A signed 6-bit immediate."
45   (and (match_code "const_int")
46        (match_test "SIGNED_INT_FITS_N_BITS (ival, 6)")))
47
48 (define_constraint "L"
49   "A unsigned 4-bit immediate."
50   (and (match_code "const_int")
51        (match_test "UNSIGNED_INT_FITS_N_BITS (ival, 4)")))
52
53 (define_constraint "M"
54   "A unsigned and customized  4-bit immediate."
55   (and (match_code "const_int")
56        (match_test "(IN_RANGE_P (ival, 0, 15) && ((ival != 9) && (ival != 11)))")))
57
58 (define_constraint "N"
59   "A signed 16-bit immediate."
60   (and (match_code "const_int")
61        (match_test "IN_RANGE_P (ival, -32768, 32767)")))
62
63 (define_constraint "O"
64   "A unsigned 20-bit immediate."
65   (and (match_code "const_int")
66        (match_test "IN_RANGE_P (ival, 0, 1048575)")))
67
68 (define_constraint "Q"
69   "A shift QI immediate."
70   (and (match_code "const_int")
71        (match_test "IN_RANGE_P (ival, 0, 7)")))
72
73 (define_constraint "R"
74   "A shift HI immediate."
75   (and (match_code "const_int")
76        (match_test "IN_RANGE_P (ival, 0, 15)")))
77
78 (define_constraint "S"
79   "A shift SI immediate."
80   (and (match_code "const_int")
81        (match_test "IN_RANGE_P (ival, 0, 31)")))