summaryrefslogtreecommitdiff
path: root/gcc/config/pa/constraints.md
blob: 3617ea5e0e95b2201c259964f55b28618acb004b (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
;; Constraint definitions for pa
;; Copyright (C) 2007 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/>.

;;; Unused letters:
;;;    ABCDEF H             V XY 
;;;     bcde ghijklmnop  stuvw  z

;; Register constraints.
(define_register_constraint "a" "R1_REGS"
  "General register 1.")

(define_register_constraint "f" "FP_REGS"
  "Floating-point register.")

(define_register_constraint "q" "SHIFT_REGS"
  "Shift amount register.")

;; Keep 'x' for backward compatibility with user asm.
(define_register_constraint "x" "FP_REGS"
  "Floating-point register.")

(define_register_constraint "y" "TARGET_64BIT ? FP_REGS : FPUPPER_REGS"
  "Upper floating-point register.")

(define_register_constraint "Z" "ALL_REGS"
  "Any register.")

;; Integer constant constraints.
(define_constraint "I"
  "Signed 11-bit integer constant."
  (and (match_code "const_int")
       (match_test "VAL_11_BITS_P (ival)")))

(define_constraint "J"
  "Signed 14-bit integer constant."
  (and (match_code "const_int")
       (match_test "VAL_14_BITS_P (ival)")))

(define_constraint "K"
  "Integer constant that can be deposited with a zdepi instruction."
  (and (match_code "const_int")
       (match_test "zdepi_cint_p (ival)")))

(define_constraint "L"
  "Signed 5-bit integer constant."
  (and (match_code "const_int")
       (match_test "VAL_5_BITS_P (ival)")))

(define_constraint "M"
  "Integer constant 0."
  (and (match_code "const_int")
       (match_test "ival == 0")))

(define_constraint "N"
  "Integer constant that can be loaded with a ldil instruction."
  (and (match_code "const_int")
       (match_test "ldil_cint_p (ival)")))

(define_constraint "O"
  "Integer constant such that ival+1 is a power of 2."
  (and (match_code "const_int")
       (match_test "(ival & (ival + 1)) == 0")))

(define_constraint "P"
  "Integer constant that can be used as an and mask in depi and
   extru instructions."
  (and (match_code "const_int")
       (match_test "and_mask_p (ival)")))

(define_constraint "S"
  "Integer constant 31."
  (and (match_code "const_int")
       (match_test "ival == 31")))

(define_constraint "U"
  "Integer constant 63."
  (and (match_code "const_int")
       (match_test "ival == 63")))

;; Floating-point constant constraints.
(define_constraint "G"
  "Floating-point constant 0."
  (and (match_code "const_double")
       (match_test "GET_MODE_CLASS (mode) == MODE_FLOAT
		    && op == CONST0_RTX (mode)")))

;; Extra constraints.
(define_constraint "A"
  "A LO_SUM DLT memory operand."
  (and (match_code "mem")
       (match_test "IS_LO_SUM_DLT_ADDR_P (XEXP (op, 0))")))

(define_constraint "Q"
  "A memory operand that can be used as the destination operand of an
   integer store, or the source operand of an integer load.  That is
   any memory operand that isn't a symbolic, indexed or lo_sum memory
   operand.  Note that an unassigned pseudo register is such a memory
   operand.  We accept unassigned pseudo registers because reload
   generates them and then doesn't re-recognize the insn, causing
   constrain_operands to fail."
  (match_test "integer_store_memory_operand (op, mode)"))

(define_constraint "R"
  "A scaled or unscaled indexed memory operand that can be used as the
   source address in integer and floating-point loads."
  (and (match_code "mem")
       (match_test "IS_INDEX_ADDR_P (XEXP (op, 0))")))

(define_constraint "T"
  "A memory operand for floating-point loads and stores."
  (and (match_code "mem")
       (match_test "!IS_LO_SUM_DLT_ADDR_P (XEXP (op, 0))
		    && !IS_INDEX_ADDR_P (XEXP (op, 0))
		    && memory_address_p ((GET_MODE_SIZE (mode) == 4
					  ? SFmode : DFmode),
					 XEXP (op, 0))")))

;; We could allow short displacements but GO_IF_LEGITIMATE_ADDRESS
;; can't tell when a long displacement is valid.
(define_constraint "W"
  "A register indirect memory operand."
  (and (match_code "mem")
       (match_test "REG_P (XEXP (op, 0))
		    && REG_OK_FOR_BASE_P (XEXP (op, 0))")))