| 1 |
;; Constraint definitions for XSTORMY16. |
| 2 |
;; Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 3 |
;; |
| 4 |
;; This file is part of GCC. |
| 5 |
;; |
| 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) |
| 9 |
;; any later version. |
| 10 |
;; |
| 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. |
| 15 |
;; |
| 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/>. |
| 19 |
|
| 20 |
;; Register constraints. |
| 21 |
(define_register_constraint "a" "R0_REGS" |
| 22 |
"@internal") |
| 23 |
|
| 24 |
(define_register_constraint "b" "R1_REGS" |
| 25 |
"@internal") |
| 26 |
|
| 27 |
(define_register_constraint "c" "R2_REGS" |
| 28 |
"@internal") |
| 29 |
|
| 30 |
(define_register_constraint "d" "R8_REGS" |
| 31 |
"@internal") |
| 32 |
|
| 33 |
(define_register_constraint "e" "EIGHT_REGS" |
| 34 |
"@internal") |
| 35 |
|
| 36 |
(define_register_constraint "t" "TWO_REGS" |
| 37 |
"@internal") |
| 38 |
|
| 39 |
(define_register_constraint "z" "ICALL_REGS" |
| 40 |
"@internal") |
| 41 |
|
| 42 |
;; Integer constraints. |
| 43 |
(define_constraint "I" |
| 44 |
"An integer between 0 and 3." |
| 45 |
(and (match_code "const_int") |
| 46 |
(match_test "IN_RANGE (ival, 0, 3)"))) |
| 47 |
|
| 48 |
(define_constraint "J" |
| 49 |
"A power of two." |
| 50 |
(and (match_code "const_int") |
| 51 |
(match_test "exact_log2 (ival) != -1"))) |
| 52 |
|
| 53 |
(define_constraint "K" |
| 54 |
"A power of two when inverted." |
| 55 |
(and (match_code "const_int") |
| 56 |
(match_test "exact_log2 (~ival) != -1"))) |
| 57 |
|
| 58 |
(define_constraint "L" |
| 59 |
"An 8-bit unsigned integer." |
| 60 |
(and (match_code "const_int") |
| 61 |
(match_test "IN_RANGE (ival, 0, 255)"))) |
| 62 |
|
| 63 |
(define_constraint "M" |
| 64 |
"An integer between -255 and 0." |
| 65 |
(and (match_code "const_int") |
| 66 |
(match_test "IN_RANGE (ival, -255, 0)"))) |
| 67 |
|
| 68 |
(define_constraint "N" |
| 69 |
"An integer between -3 and 0." |
| 70 |
(and (match_code "const_int") |
| 71 |
(match_test "IN_RANGE (ival, -3, 0)"))) |
| 72 |
|
| 73 |
(define_constraint "O" |
| 74 |
"An integer between 1 and 4." |
| 75 |
(and (match_code "const_int") |
| 76 |
(match_test "IN_RANGE (ival, 1, 4)"))) |
| 77 |
|
| 78 |
(define_constraint "P" |
| 79 |
"An integer between -4 and -1." |
| 80 |
(and (match_code "const_int") |
| 81 |
(match_test "IN_RANGE (ival, -4, -1)"))) |
| 82 |
|
| 83 |
;; Extra constraints. |
| 84 |
(define_constraint "Q" |
| 85 |
"A register push operation." |
| 86 |
(and (match_code "mem") |
| 87 |
(match_code "post_inc" "0") |
| 88 |
(match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx"))) |
| 89 |
|
| 90 |
(define_constraint "R" |
| 91 |
"A register pop operation." |
| 92 |
(and (match_code "mem") |
| 93 |
(match_code "pre_dec" "0") |
| 94 |
(match_test "XEXP (XEXP (op, 0), 0) == stack_pointer_rtx"))) |
| 95 |
|
| 96 |
(define_constraint "S" |
| 97 |
"An immediate memory address." |
| 98 |
(and (match_code "mem") |
| 99 |
(match_code "const_int" "0") |
| 100 |
(match_test "xstormy16_legitimate_address_p (VOIDmode, XEXP (op, 0), false)"))) |
| 101 |
|
| 102 |
(define_constraint "T" |
| 103 |
"@internal" |
| 104 |
;; For Rx; not implemented yet. |
| 105 |
(match_test "0")) |
| 106 |
|
| 107 |
(define_constraint "U" |
| 108 |
"An integer not between 2 and 15." |
| 109 |
(and (match_code "const_int") |
| 110 |
(match_test "!IN_RANGE (ival, 2, 15)"))) |
| 111 |
|
| 112 |
(define_constraint "W" |
| 113 |
"@internal" |
| 114 |
(match_operand 0 "xstormy16_below100_operand")) |
| 115 |
|
| 116 |
(define_constraint "Z" |
| 117 |
"Zero." |
| 118 |
(and (match_code "const_int") |
| 119 |
(match_test "ival == 0"))) |