1 ;; Constraint definitions for OpenRISC
2 ;; Copyright (C) 2018-2019 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 ; I - constant signed 16-bit
28 ; K - constant unsigned 16-bit
29 ; M - constant signed 16-bit shifted left 16-bits (l.movhi)
32 (define_register_constraint "c" "SIBCALL_REGS"
33 "Registers which can hold a sibling call address")
36 (define_constraint "I"
37 "A signed 16-bit immediate in the range -32768 to 32767."
38 (and (match_code "const_int")
39 (match_test "IN_RANGE (ival, -32768, 32767)")))
41 (define_constraint "K"
42 "An unsigned 16-bit immediate in the range 0 to 0xffff."
43 (and (match_code "const_int")
44 (match_test "IN_RANGE (ival, 0, 65535)")))
46 (define_constraint "M"
47 "A shifted signed 16-bit constant suitable for l.movhi."
48 (and (match_code "const_int")
49 (match_test "(ival & 0xffff) == 0
50 && (ival >> 31 == -1 || ival >> 31 == 0)")))
52 (define_constraint "O"
54 (and (match_code "const_int")
55 (match_test "ival == 0")))