aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/config/epiphany/constraints.md
blob: 1c463e531a3fed18db1fb6418aff07194eaaef9a (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
;; Constraint definitions for Adaptiva epiphany
;; Copyright (C) 2007-2014 Free Software Foundation, Inc.
;; Contributed by Embecosm on behalf of Adapteva, 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/>.

;; Integer constraints

(define_constraint "U16"
  "An unsigned 16-bit constant."
  (ior (and (match_code "const_int")
	    (match_test "IMM16 (ival)"))
       (and (match_code "symbol_ref,label_ref,const")
	    (match_test "epiphany_small16 (op)"))))

(define_constraint "K"
  "An unsigned 5-bit constant."
  (and (match_code "const_int")
       (match_test "IMM5 (ival)")))

;; This could also accept symbol_ref, label_ref or const if we introduce
;; a small area and/or attribute that satisfies the 11-bit signed range.
(define_constraint "L"
  "A signed 11-bit constant."
  (and (match_code "const_int")
       (match_test "SIMM11 (ival)")))

(define_constraint "CnL"
  "A negated signed 11-bit constant."
  (and (match_code "const_int")
       (match_test "SIMM11 (-ival)")))

(define_constraint "Cm1"
  "A signed 11-bit constant added to -1"
  (and (match_code "const_int")
       (match_test "SIMM11 (ival+1)")
       (match_test "epiphany_m1reg >= 0")))

(define_constraint "Cl1"
  "Left-shift of -1"
  (and (match_code "const_int")
       (match_test "ival == (ival | ~(ival-1))")
       (match_test "epiphany_m1reg >= 0")))

(define_constraint "Cr1"
  "Right-shift of -1"
  (and (match_code "const_int")
       (match_test "ival == (ival & ~(ival+1))")
       (match_test "epiphany_m1reg >= 0")))

(define_constraint "Cal"
  "Constant for arithmetic/logical operations"
  (match_test "(flag_pic
		? nonsymbolic_immediate_operand (op, VOIDmode)
		: immediate_operand (op, VOIDmode))"))

(define_constraint "Csy"
  "Symbolic constant for call/jump instruction"
  (match_test "symbolic_operand (op, VOIDmode)"))

;; Register constraints
;; proper register constraints define a register class and can thus
;; drive register allocation and reload.  OTOH sometimes we want to
;; avoid just that.

;; The register class usable in short insns.
;; Subject to TARGET_PREFER_SHORT_INSN_REGS.
(define_register_constraint "Rcs" "SHORT_INSN_REGS"
  "short insn register class.")

; The registers that can be used to hold a sibcall call address.
; This must not conflict with any callee-saved registers.
(define_register_constraint "Rsc" "SIBCALL_REGS"
  "sibcall register class")

; The registers that can be used to hold a status value
(define_register_constraint "Rct" "CORE_CONTROL_REGS"
  "Core control register class")

;; The register group usable in short insns.
(define_constraint "Rgs"
  "short insn register group."
  (and (match_code "reg")
       (match_test "REGNO (op) >= FIRST_PSEUDO_REGISTER || REGNO (op) <= 7")))

;; Constant suitable for the addsi3_r pattern.
(define_constraint "Car"
  "addsi3_r constant."
  (and (match_code "const_int")
       (ior (match_test "RTX_OK_FOR_OFFSET_P (SImode, op)")
	    (match_test "RTX_OK_FOR_OFFSET_P (HImode, op)")
	    (match_test "RTX_OK_FOR_OFFSET_P (QImode, op)"))))

;; The return address if it can be replaced with GPR_LR.
(define_constraint "Rra"
  "return address constraint - register variant"
  (and (match_code "unspec")
       (match_test "XINT (op, 1) == UNSPEC_RETURN_ADDR")
       (match_test "!MACHINE_FUNCTION (cfun)->lr_clobbered")))

(define_constraint "Rcc"
  "integer condition code"
  (and (match_code "reg")
       (match_test "REGNO (op) == CC_REGNUM")))

;; The return address, which might be a stack slot.  */
(define_constraint "Sra"
  "return address constraint - memory variant"
  (and (match_code "unspec")
       (match_test "XINT (op, 1) == UNSPEC_RETURN_ADDR")))

(define_constraint "Cfm"
  "control register values to switch fp mode"
  (and (match_code "const")
       (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
       (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_FP_MODE")))