1 ;; Constraint definitions for OpenRISC
2 ;; Copyright (C) 2018-2023 Free Software Foundation, Inc.
3 ;; Contributed by Stafford Horne
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; -------------------------------------------------------------------------
23 ;; -------------------------------------------------------------------------
26 ; c - sibcall registers
27 ; d - double pair base registers (excludes r0, r30 and r31 which overflow)
28 ; t - got address registers (excludes LR (r9) which is clobbered by set_got)
29 ; I - constant signed 16-bit
30 ; K - constant unsigned 16-bit
31 ; M - constant signed 16-bit shifted left 16-bits (l.movhi)
34 (define_register_constraint "c" "SIBCALL_REGS"
35 "Registers which can hold a sibling call address")
37 (define_register_constraint "d" "DOUBLE_REGS"
38 "Registers which can be used for double reg pairs.")
40 (define_register_constraint "t" "GOT_REGS"
41 "Registers which can be used to store the Global Offset Table (GOT) address.")
44 (define_constraint "I"
45 "A signed 16-bit immediate in the range -32768 to 32767."
46 (and (match_code "const_int")
47 (match_test "IN_RANGE (ival, -32768, 32767)")))
49 (define_constraint "K"
50 "An unsigned 16-bit immediate in the range 0 to 0xffff."
51 (and (match_code "const_int")
52 (match_test "IN_RANGE (ival, 0, 65535)")))
54 (define_constraint "M"
55 "A shifted signed 16-bit constant suitable for l.movhi."
56 (and (match_code "const_int")
57 (match_test "(ival & 0xffff) == 0
58 && (ival >> 31 == -1 || ival >> 31 == 0)")))
60 (define_constraint "O"
62 (and (match_code "const_int")
63 (match_test "ival == 0")))