1;; Constraint definitions for Tilera TILEPro chip.
2;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
3;; Contributed by Walter Lee (walt@tilera.com)
4;;
5;; This file is part of GCC.
6;;
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.
11;;
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.
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(define_register_constraint "R00" "R0_REGS"  "r0")
22(define_register_constraint "R01" "R1_REGS"  "r1")
23(define_register_constraint "R02" "R2_REGS"  "r2")
24(define_register_constraint "R03" "R3_REGS"  "r3")
25(define_register_constraint "R04" "R4_REGS"  "r4")
26(define_register_constraint "R05" "R5_REGS"  "r5")
27(define_register_constraint "R06" "R6_REGS"  "r6")
28(define_register_constraint "R07" "R7_REGS"  "r7")
29(define_register_constraint "R08" "R8_REGS"  "r8")
30(define_register_constraint "R09" "R9_REGS"  "r9")
31(define_register_constraint "R10" "R10_REGS" "r10")
32
33(define_constraint "I"
34  "A signed 8 bit constant"
35  (and (match_code "const_int")
36       (match_test "ival >= -128 && ival <= 127")))
37
38(define_constraint "J"
39  "Signed 16-bit integer constant"
40  (and (match_code "const_int")
41       (match_test "ival >= -32768 && ival <= 32767")))
42
43(define_constraint "K"
44  "Nonzero integer constant with low 16 bits zero"
45  (and (match_code "const_int")
46       (match_test "ival && (ival & 0xFFFF) == 0")))
47
48(define_constraint "L"
49  "Integer constant that fits in one signed byte when incremented"
50  (and (match_code "const_int")
51       (match_test "ival >= -129 && ival <= 126")))
52
53(define_constraint "M"
54  "A bit mask suitable for 'mm'"
55  (and (match_code "const_int")
56       (match_test "tilepro_bitfield_operand_p (ival, NULL, NULL)")))
57
58(define_constraint "N"
59  "Integer constant that is a byte tiled out four times"
60  (and (match_code "const_int")
61       (match_test "(ival & 0xFFFFFFFF) == (ival & 0xFF) * 0x01010101")))
62
63(define_constraint "O"
64 "The integer zero constant"
65 (and (match_code "const_int")
66      (match_test "ival == 0")))
67
68(define_constraint "P"
69  "Integer constant that is a sign-extended byte tiled out as two shorts"
70  (and (match_code "const_int")
71       (match_test "((ival & 0xFFFFFFFF)
72                     == ((trunc_int_for_mode (ival, QImode) & 0xFFFF)
73                         * 0x00010001))")))
74
75(define_constraint "Q"
76  "Integer constant that fits in one signed byte when incremented, but not -1"
77  (and (match_code "const_int")
78       (match_test "ival >= -129 && ival <= 126 && ival != -1")))
79
80(define_constraint "T"
81  "A const symbolc operand"
82  (match_operand 0 "const_symbolic_operand"))
83
84(define_memory_constraint "U"
85  "Non-auto-incrementing memory"
86  (and (match_code "mem")
87       (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")))
88
89(define_constraint "W"
90  "A 4-element vector constant with identical elements"
91  (and (match_code "const_vector")
92       (match_test "CONST_VECTOR_NUNITS (op) == 4")
93       (match_test "const_vec_duplicate_p (op)")))
94
95(define_constraint "Y"
96  "A 2-element vector constant with identical elements"
97  (and (match_code "const_vector")
98       (match_test "CONST_VECTOR_NUNITS (op) == 2")
99       (match_test "const_vec_duplicate_p (op)")))
100