Daily bump.
[official-gcc.git] / gcc / config / riscv / constraints.md
blobc87d5b796a54c10506765f595ad0e929e717a24e
1 ;; Constraint definitions for RISC-V target.
2 ;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
3 ;; Contributed by Andrew Waterman (andrew@sifive.com).
4 ;; Based on MIPS target for GNU compiler.
5 ;;
6 ;; This file is part of GCC.
7 ;;
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; any later version.
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3.  If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;; Register constraints
24 (define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
25   "A floating-point register (if available).")
27 (define_register_constraint "j" "SIBCALL_REGS"
28   "@internal")
30 ;; Avoid using register t0 for JALR's argument, because for some
31 ;; microarchitectures that is a return-address stack hint.
32 (define_register_constraint "l" "JALR_REGS"
33   "@internal")
35 ;; General constraints
37 (define_constraint "I"
38   "An I-type 12-bit signed immediate."
39   (and (match_code "const_int")
40        (match_test "SMALL_OPERAND (ival)")))
42 (define_constraint "J"
43   "Integer zero."
44   (and (match_code "const_int")
45        (match_test "ival == 0")))
47 (define_constraint "K"
48   "A 5-bit unsigned immediate for CSR access instructions."
49   (and (match_code "const_int")
50        (match_test "IN_RANGE (ival, 0, 31)")))
52 (define_constraint "L"
53   "A U-type 20-bit signed immediate."
54   (and (match_code "const_int")
55        (match_test "LUI_OPERAND (ival)")))
57 ;; Floating-point constant +0.0, used for FCVT-based moves when FMV is
58 ;; not available in RV32.
59 (define_constraint "G"
60   "@internal"
61   (and (match_code "const_double")
62        (match_test "op == CONST0_RTX (mode)")))
64 (define_memory_constraint "A"
65   "An address that is held in a general-purpose register."
66   (and (match_code "mem")
67        (match_test "GET_CODE(XEXP(op,0)) == REG")))
69 (define_constraint "S"
70   "A constraint that matches an absolute symbolic address."
71   (match_operand 0 "absolute_symbolic_operand"))
73 (define_constraint "U"
74   "@internal
75    A PLT-indirect call address."
76   (match_operand 0 "plt_symbolic_operand"))
78 (define_constraint "T"
79   "@internal
80    A constant @code{move_operand}."
81   (and (match_operand 0 "move_operand")
82        (match_test "CONSTANT_P (op)")))