summaryrefslogtreecommitdiff
path: root/gcc/config/tilepro/constraints.md
blob: ed1946835ca0fd18ca41d5fb498c5e4c6e15ed7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;; Constraint definitions for Tilera TILEPro chip.
;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
;; Contributed by Walter Lee (walt@tilera.com)
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.
;;
;; GCC is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_register_constraint "R00" "R0_REGS"  "r0")
(define_register_constraint "R01" "R1_REGS"  "r1")
(define_register_constraint "R02" "R2_REGS"  "r2")
(define_register_constraint "R03" "R3_REGS"  "r3")
(define_register_constraint "R04" "R4_REGS"  "r4")
(define_register_constraint "R05" "R5_REGS"  "r5")
(define_register_constraint "R06" "R6_REGS"  "r6")
(define_register_constraint "R07" "R7_REGS"  "r7")
(define_register_constraint "R08" "R8_REGS"  "r8")
(define_register_constraint "R09" "R9_REGS"  "r9")
(define_register_constraint "R10" "R10_REGS" "r10")

(define_constraint "I"
  "A signed 8 bit constant"
  (and (match_code "const_int")
       (match_test "ival >= -128 && ival <= 127")))

(define_constraint "J"
  "Signed 16-bit integer constant"
  (and (match_code "const_int")
       (match_test "ival >= -32768 && ival <= 32767")))

(define_constraint "K"
  "Nonzero integer constant with low 16 bits zero"
  (and (match_code "const_int")
       (match_test "ival && (ival & 0xFFFF) == 0")))

(define_constraint "L"
  "Integer constant that fits in one signed byte when incremented"
  (and (match_code "const_int")
       (match_test "ival >= -129 && ival <= 126")))

(define_constraint "M"
  "A bit mask suitable for 'mm'"
  (and (match_code "const_int")
       (match_test "tilepro_bitfield_operand_p (ival, NULL, NULL)")))

(define_constraint "N"
  "Integer constant that is a byte tiled out four times"
  (and (match_code "const_int")
       (match_test "(ival & 0xFFFFFFFF) == (ival & 0xFF) * 0x01010101")))

(define_constraint "O"
 "The integer zero constant"
 (and (match_code "const_int")
      (match_test "ival == 0")))

(define_constraint "P"
  "Integer constant that is a sign-extended byte tiled out as two shorts"
  (and (match_code "const_int")
       (match_test "((ival & 0xFFFFFFFF)
                     == ((trunc_int_for_mode (ival, QImode) & 0xFFFF)
                         * 0x00010001))")))

(define_constraint "Q"
  "Integer constant that fits in one signed byte when incremented, but not -1"
  (and (match_code "const_int")
       (match_test "ival >= -129 && ival <= 126 && ival != -1")))

(define_constraint "T"
  "A const symbolc operand"
  (match_operand 0 "const_symbolic_operand"))

(define_memory_constraint "U"
  "Non-auto-incrementing memory"
  (and (match_code "mem")
       (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")))

(define_constraint "W"
  "A 4-element vector constant with identical elements"
  (and (match_code "const_vector")
       (match_test "CONST_VECTOR_NUNITS (op) == 4")
       (match_test "const_vec_duplicate_p (op)")))

(define_constraint "Y"
  "A 2-element vector constant with identical elements"
  (and (match_code "const_vector")
       (match_test "CONST_VECTOR_NUNITS (op) == 2")
       (match_test "const_vec_duplicate_p (op)")))