| 1 |
;; Constraint definitions for TI PRU. |
| 2 |
;; Copyright (C) 2014-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Dimitar Dimitrov <[email protected]> |
| 4 |
;; |
| 5 |
;; This file is part of GCC. |
| 6 |
;; |
| 7 |
;; GCC is free software; you can redistribute it and/or modify |
| 8 |
;; it under the terms of the GNU General Public License as published by |
| 9 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 10 |
;; any later version. |
| 11 |
;; |
| 12 |
;; GCC is distributed in the hope that it will be useful, |
| 13 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
;; GNU General Public License for more details. |
| 16 |
;; |
| 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/>. |
| 20 |
|
| 21 |
;; We use the following constraint letters for constants: |
| 22 |
;; |
| 23 |
;; I: 0 to 255. |
| 24 |
;; J: 0 to 65535. |
| 25 |
;; L: 0 to 31 (for shift counts). |
| 26 |
;; T: Text segment label. Needed to know when to select %pmem relocation. |
| 27 |
;; Z: Constant integer zero. |
| 28 |
;; |
| 29 |
;; We use the following built-in register classes: |
| 30 |
;; |
| 31 |
;; r: General purpose register (r0..r31). |
| 32 |
;; m: Memory operand. |
| 33 |
;; |
| 34 |
;; The following constraints are intended for internal use only: |
| 35 |
;; Rmd0, Rms0, Rms1: Registers for MUL instruction operands. |
| 36 |
;; Rsib: Jump address register suitable for sibling calls. |
| 37 |
;; Rrio: The R30 and R31 I/O registers. |
| 38 |
;; M: -255 to 0 (for converting ADD to SUB with suitable UBYTE OP2). |
| 39 |
;; N: -32768 to 32767 (16-bit signed integer). |
| 40 |
;; O: -128 to 127 (8-bit signed integer). |
| 41 |
;; P: 1 |
| 42 |
;; Um: -1 constant. |
| 43 |
;; Uf: A constant with a single consecutive range of 0xff bytes. Rest |
| 44 |
;; of bytes are zeros. |
| 45 |
;; Uz: A constant with a single consecutive range of 0x00 bytes. Rest |
| 46 |
;; of bytes are 0xff. |
| 47 |
|
| 48 |
;; Register constraints. |
| 49 |
|
| 50 |
(define_register_constraint "Rsib" "SIB_REGS" |
| 51 |
"@internal |
| 52 |
A register suitable for an indirect sibcall.") |
| 53 |
|
| 54 |
(define_register_constraint "Rmd0" "MULDST_REGS" |
| 55 |
"@internal |
| 56 |
The multiply destination register.") |
| 57 |
|
| 58 |
(define_register_constraint "Rms0" "MULSRC0_REGS" |
| 59 |
"@internal |
| 60 |
The multiply source 0 register.") |
| 61 |
|
| 62 |
(define_register_constraint "Rms1" "MULSRC1_REGS" |
| 63 |
"@internal |
| 64 |
The multiply source 1 register.") |
| 65 |
|
| 66 |
(define_register_constraint "Rrio" "REGIO_REGS" |
| 67 |
"@internal |
| 68 |
The R30 and R31 I/O registers.") |
| 69 |
|
| 70 |
;; Integer constraints. |
| 71 |
|
| 72 |
(define_constraint "I" |
| 73 |
"An unsigned 8-bit constant." |
| 74 |
(and (match_code "const_int") |
| 75 |
(match_test "UBYTE_INT (ival)"))) |
| 76 |
|
| 77 |
(define_constraint "J" |
| 78 |
"An unsigned 16-bit constant." |
| 79 |
(and (match_code "const_int") |
| 80 |
(match_test "UHWORD_INT (ival)"))) |
| 81 |
|
| 82 |
(define_constraint "L" |
| 83 |
"An unsigned 5-bit constant (for shift counts)." |
| 84 |
(and (match_code "const_int") |
| 85 |
(match_test "ival >= 0 && ival <= 31"))) |
| 86 |
|
| 87 |
(define_constraint "M" |
| 88 |
"@internal |
| 89 |
A constant in the range [-255, 0]." |
| 90 |
(and (match_code "const_int") |
| 91 |
(match_test "UBYTE_INT (-ival)"))) |
| 92 |
|
| 93 |
(define_constraint "N" |
| 94 |
"@internal |
| 95 |
A constant in the range [-32768, 32767]." |
| 96 |
(and (match_code "const_int") |
| 97 |
(match_test "SHWORD_INT (ival)"))) |
| 98 |
|
| 99 |
(define_constraint "O" |
| 100 |
"@internal |
| 101 |
A constant in the range [-128, 127]." |
| 102 |
(and (match_code "const_int") |
| 103 |
(match_test "SBYTE_INT (ival)"))) |
| 104 |
|
| 105 |
(define_constraint "P" |
| 106 |
"@internal |
| 107 |
A constant 1." |
| 108 |
(and (match_code "const_int") |
| 109 |
(match_test "ival == 1"))) |
| 110 |
|
| 111 |
(define_constraint "T" |
| 112 |
"A text segment (program memory) constant label." |
| 113 |
(match_test "text_segment_operand (op, VOIDmode)")) |
| 114 |
|
| 115 |
(define_constraint "Z" |
| 116 |
"An integer constant zero." |
| 117 |
(and (match_code "const_int") |
| 118 |
(match_test "ival == 0"))) |
| 119 |
|
| 120 |
(define_constraint "Um" |
| 121 |
"@internal |
| 122 |
A constant -1." |
| 123 |
(and (match_code "const_int") |
| 124 |
(match_test "ival == -1"))) |
| 125 |
|
| 126 |
(define_constraint "Uf" |
| 127 |
"@internal |
| 128 |
An integer constant with a consecutive range of 0xff bytes." |
| 129 |
(and (match_code "const_int") |
| 130 |
(match_test "const_fillbytes_operand (op, DImode)"))) |
| 131 |
|
| 132 |
(define_constraint "Uz" |
| 133 |
"@internal |
| 134 |
An integer constant with a consecutive range of 0x00 bytes." |
| 135 |
(and (match_code "const_int") |
| 136 |
(match_test "const_zerobytes_operand (op, DImode)"))) |