1 ;; Constraint definitions for SPARC.
2 ;; Copyright (C) 2008, 2010 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
25 ;; Register constraints
27 (define_register_constraint "b" "(TARGET_V9 && TARGET_VIS ? EXTRA_FP_REGS : NO_REGS)"
28 "Any floating-point register in VIS mode")
30 (define_register_constraint "c" "FPCC_REGS"
31 "Floating-point condition code register")
33 (define_register_constraint "d" "(TARGET_V9 && TARGET_VIS ? FP_REGS : NO_REGS)"
34 "Lower floating-point register in VIS mode")
36 ;; In the non-V9 case, coerce V9 'e' class to 'f', so we can use 'e' in the
37 ;; MD file for V8 and V9.
38 (define_register_constraint "e" "(TARGET_FPU ? (TARGET_V9 ? EXTRA_FP_REGS : FP_REGS) : NO_REGS)"
39 "Any floating-point register")
41 (define_register_constraint "f" "(TARGET_FPU ? FP_REGS : NO_REGS)"
42 "Lower floating-point register")
44 (define_register_constraint "h" "(TARGET_V9 && TARGET_V8PLUS ? I64_REGS : NO_REGS)"
45 "64-bit global or out register in V8+ mode")
48 ;; Floating-point constant constraints
50 (define_constraint "G"
51 "The floating-point zero constant"
52 (and (match_code "const_double")
53 (match_test "const_zero_operand (op, mode)")))
55 (define_constraint "C"
56 "The floating-point all-ones constant"
57 (and (match_code "const_double")
58 (match_test "const_all_ones_operand (op, mode)")))
60 ;; Integer constant constraints
62 (define_constraint "H"
63 "Valid operand of double arithmetic operation"
64 (and (match_code "const_double")
65 (match_test "arith_double_operand (op, DImode)")))
67 (define_constraint "I"
68 "Signed 13-bit integer constant"
69 (and (match_code "const_int")
70 (match_test "SPARC_SIMM13_P (ival)")))
72 (define_constraint "J"
73 "The integer zero constant"
74 (and (match_code "const_int")
75 (match_test "ival == 0")))
77 (define_constraint "K"
78 "Signed 32-bit constant that can be loaded with a sethi instruction"
79 (and (match_code "const_int")
80 (match_test "SPARC_SETHI32_P (ival)")))
82 (define_constraint "L"
83 "Signed 11-bit integer constant"
84 (and (match_code "const_int")
85 (match_test "SPARC_SIMM11_P (ival)")))
87 (define_constraint "M"
88 "Signed 10-bit integer constant"
89 (and (match_code "const_int")
90 (match_test "SPARC_SIMM10_P (ival)")))
92 (define_constraint "N"
93 "Signed constant that can be loaded with a sethi instruction"
94 (and (match_code "const_int")
95 (match_test "SPARC_SETHI_P (ival)")))
97 (define_constraint "O"
99 (and (match_code "const_int")
100 (match_test "ival == 4096")))
102 (define_constraint "P"
103 "The integer constant -1"
104 (and (match_code "const_int")
105 (match_test "ival == -1")))
108 ;; Our memory extra constraints have to emulate the behavior of 'm' and 'o',
109 ;; i.e. accept pseudo-registers during reload.
111 (define_constraint "D"
113 (and (match_code "const_vector")
114 (match_test "GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_INT")))
116 (define_constraint "Q"
117 "Floating-point constant that can be loaded with a sethi instruction"
118 (and (match_code "const_double")
119 (match_test "fp_sethi_p (op)")))
121 (define_constraint "R"
122 "Floating-point constant that can be loaded with a move instruction"
123 (and (match_code "const_double")
124 (match_test "fp_mov_p (op)")))
126 (define_constraint "S"
127 "Floating-point constant that can be loaded with a high/lo_sum sequence"
128 (and (match_code "const_double")
129 (match_test "fp_high_losum_p (op)")))
131 ;; Not needed in 64-bit mode
132 (define_constraint "T"
133 "Memory reference whose address is aligned to 8-byte boundary"
134 (and (match_test "TARGET_ARCH32")
135 (match_code "mem,reg")
136 (match_test "memory_ok_for_ldd (op)")))
138 ;; Not needed in 64-bit mode
139 (define_constraint "U"
140 "Pseudo-register or hard even-numbered integer register"
141 (and (match_test "TARGET_ARCH32")
143 (ior (match_test "REGNO (op) < FIRST_PSEUDO_REGISTER")
144 (not (match_test "reload_in_progress && reg_renumber [REGNO (op)] < 0")))
145 (match_test "register_ok_for_ldd (op)")))
147 ;; Equivalent to 'T' but available in 64-bit mode
148 (define_constraint "W"
149 "Memory reference for 'e' constraint floating-point register"
150 (and (match_code "mem,reg")
151 (match_test "memory_ok_for_ldd (op)")))
153 (define_constraint "Y"
154 "The vector zero constant"
155 (and (match_code "const_vector")
156 (match_test "const_zero_operand (op, mode)")))
158 (define_constraint "Z"
159 "The vector all ones constant"
160 (and (match_code "const_vector")
161 (match_test "const_all_ones_operand (op, mode)")))