2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / config / tilegx / constraints.md
blob2f2d7108a2e622f011bc3d92f679be54d0e04709
1 ;; Constraint definitions for Tilera TILE-Gx.
2 ;; Copyright (C) 2011-2018 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.
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 (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")
33 (define_constraint "I"
34   "A signed 8 bit constant"
35   (and (match_code "const_int")
36        (match_test "ival >= -128 && ival <= 127")))
38 (define_constraint "J"
39   "Signed 16-bit integer constant"
40   (and (match_code "const_int")
41        (match_test "ival >= -32768 && ival <= 32767")))
43 (define_constraint "K"
44   "Unsigned 16-bit integer constant"
45   (and (match_code "const_int")
46        (match_test "(ival >= 0 && ival <= 65535)")))
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")))
53 (define_constraint "M"
54   "A bit mask suitable for 'bfins'"
55   (and (match_code "const_int")
56        (match_test "tilegx_bitfield_operand_p (ival, NULL, NULL)")))
58 (define_constraint "N"
59   "Integer constant that is a byte tiled out eight times"
60   (and (match_code "const_int")
61        (match_test "(ival == (ival & 0xFF) * 0x0101010101010101LL)")))
63 (define_constraint "O"
64  "The integer zero constant"
65  (and (match_code "const_int")
66       (match_test "ival == 0")))
68 (define_constraint "P"
69   "Integer constant that is a sign-extended byte tiled out as four shorts"
70   (and (match_code "const_int")
71        (match_test "(ival
72                      == ((trunc_int_for_mode (ival, QImode) & 0xFFFF)
73                          * 0x0001000100010001LL))")))
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")))
80 (define_constraint "S"
81   "Integer constant that has all 1 bits consecutive and starting at bit 0"
82   (and (match_code "const_int")
83        (match_test "ival != 0 && (ival & (ival + 1)) == 0")))
85 (define_constraint "T"
86   "An unspec wrapper for a symbolc operand"
87   (ior (match_operand 0 "const_last_symbolic_operand")
88        (match_operand 0 "const_symbolic_operand")))
90 (define_memory_constraint "U"
91   "Non-auto-incrementing memory"
92   (and (match_code "mem")
93        (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")))
95 (define_constraint "W"
96   "An 8-element vector constant with identical elements"
97   (and (match_code "const_vector")
98        (match_test "CONST_VECTOR_NUNITS (op) == 8")
99        (match_test "const_vec_duplicate_p (op)")))
101 (define_constraint "Y"
102   "A 4-element vector constant with identical elements"
103   (and (match_code "const_vector")
104        (match_test "CONST_VECTOR_NUNITS (op) == 4")
105        (match_test "const_vec_duplicate_p (op)")))
107 (define_constraint "Z0"
108  "The integer constant 0xffffffff"
109  (and (match_code "const_int")
110       (match_test "ival == 0xffffffff")))
112 (define_constraint "Z1"
113  "The integer constant 0xffffffff00000000"
114  (and (match_code "const_int")
115       (match_test "ival == (HOST_WIDE_INT)0xffffffff00000000LL")))