summaryrefslogtreecommitdiff
path: root/gcc/config/mn10300/constraints.md
blob: c8ee2d4e2d960e871edba3539ce60e3ea481c0d9 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;; Constraint definitions for the MN10300.
;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
;;
;; 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/>.

(define_register_constraint "d" "DATA_REGS"
  "A data register.")

(define_register_constraint "a" "ADDRESS_REGS"
  "An address register.")

;; This can be used for QI/HImode memory operations, and most arithmetic.
;; AM33 supports these on all registers, where MN103 needs DATA_REGS.
(define_register_constraint "D" "TARGET_AM33 ? GENERAL_REGS : DATA_REGS"
  "A general register for AM33, and a data register otherwise.")

;; Similarly for ADDRESS_REGS vs GENERAL_REGS.
(define_register_constraint "A" "TARGET_AM33 ? GENERAL_REGS : ADDRESS_REGS"
  "A general register for AM33, and an address register otherwise.")

(define_register_constraint "y" "SP_REGS"
  "An SP register (if available).")

(define_register_constraint "z" "MDR_REGS"
  "The MDR register.")

(define_register_constraint "x" "TARGET_AM33 ? EXTENDED_REGS : NO_REGS"
  "An extended register.")

(define_register_constraint "f" "TARGET_AM33_2 ? FP_REGS : NO_REGS"
  "A floating point register.")

(define_register_constraint "c" "TARGET_AM33_2 ? FP_ACC_REGS : NO_REGS"
  "A floating point accumulator register.")

(define_memory_constraint "Q"
  "@internal"
  (and (match_code "mem")
       (match_test "!CONSTANT_ADDRESS_P (XEXP (op, 0))")))

(define_constraint "S"
  "@internal"
  (if_then_else (match_test "flag_pic")
	(and (match_test "GET_CODE (op) == UNSPEC")
	     (ior (match_test "XINT (op, 1) == UNSPEC_PLT")
		  (match_test "XINT (op, 1) == UNSPEC_PIC")
		  (match_test "XINT (op, 1) == UNSPEC_GOTSYM_OFF")))
	(match_test "GET_CODE (op) == SYMBOL_REF")))

;; Integer constraints

(define_constraint "I"
  "An integer zero."
  (and (match_code "const_int")
       (match_test "ival == 0")))

(define_constraint "J"
  "An integer one."
  (and (match_code "const_int")
       (match_test "ival == 1")))

(define_constraint "K"
  "An integer two."
  (and (match_code "const_int")
       (match_test "ival == 2")))

(define_constraint "L"
  "An integer four."
  (and (match_code "const_int")
       (match_test "ival == 4")))

(define_constraint "M"
  "An integer three."
  (and (match_code "const_int")
       (match_test "ival == 3")))

(define_constraint "N"
  "An integer of either 255 or 65535."
  (and (match_code "const_int")
       (ior (match_test "ival == 255")
	    (match_test "ival == 65535"))))

(define_constraint "O"
  "An integer between -8 and +7 inclusive."
  (and (match_code "const_int")
       (and (match_test "ival >= -8")
	    (match_test "ival <=  7"))))

;; Floating-point constraints
(define_constraint "G"
  "Floating-point zero."
  (and (match_code "const_double")
       (match_test "op == CONST0_RTX (mode)")))