summaryrefslogtreecommitdiff
path: root/gcc/config/cr16/constraints.md
blob: 9d9789bce8e0f85da09112ca20c7791939e3ae76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;; Predicates of machine description for CR16.
;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
;; Contributed by KPIT Cummins Infosystems Limited.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.
;;
;; GCC is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.  

;; Constraints
;; Register constraints
(define_register_constraint "b" "NOSP_REGS"
  "@no sp registers")

(define_register_constraint "c" "SHORT_REGS"
  "@short registers")

(define_register_constraint "d" "LONG_REGS"
  "@long registers")

;; Integer constraints.
(define_constraint "I"
  "A signed 4-bit immediate."
  (and (match_code "const_int")
       (match_test "SIGNED_INT_FITS_N_BITS (ival, 4)")))

(define_constraint "J"
  "A signed 5-bit immediate."
  (and (match_code "const_int")
       (match_test "SIGNED_INT_FITS_N_BITS (ival, 5)")))

(define_constraint "K"
  "A signed 6-bit immediate."
  (and (match_code "const_int")
       (match_test "SIGNED_INT_FITS_N_BITS (ival, 6)")))

(define_constraint "L"
  "A unsigned 4-bit immediate."
  (and (match_code "const_int")
       (match_test "UNSIGNED_INT_FITS_N_BITS (ival, 4)")))

(define_constraint "M"
  "A unsigned and customized  4-bit immediate."
  (and (match_code "const_int")
       (match_test "(IN_RANGE_P (ival, 0, 15) && ((ival != 9) && (ival != 11)))")))

(define_constraint "N"
  "A signed 16-bit immediate."
  (and (match_code "const_int")
       (match_test "IN_RANGE_P (ival, -32768, 32767)")))

(define_constraint "O"
  "A unsigned 20-bit immediate."
  (and (match_code "const_int")
       (match_test "IN_RANGE_P (ival, 0, 1048575)")))

(define_constraint "Q"
  "A shift QI immediate."
  (and (match_code "const_int")
       (match_test "IN_RANGE_P (ival, 0, 7)")))

(define_constraint "R"
  "A shift HI immediate."
  (and (match_code "const_int")
       (match_test "IN_RANGE_P (ival, 0, 15)")))

(define_constraint "S"
  "A shift SI immediate."
  (and (match_code "const_int")
       (match_test "IN_RANGE_P (ival, 0, 31)")))