summaryrefslogtreecommitdiffstats
path: root/gcc/config/tilegx/constraints.md
blob: fcbd22070686d1fdf8743fec45dbf40561c3d337 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
;; Constraint definitions for Tilera TILE-Gx.
;; Copyright (C) 2011, 2012
;; 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"
  "Unsigned 16-bit integer constant"
  (and (match_code "const_int")
       (match_test "(ival >= 0 && ival <= 65535)")))

(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 'bfins'"
  (and (match_code "const_int")
       (match_test "tilegx_bitfield_operand_p (ival, NULL, NULL)")))

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

(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 four shorts"
  (and (match_code "const_int")
       (match_test "(ival
                     == ((trunc_int_for_mode (ival, QImode) & 0xFFFF)
                         * 0x0001000100010001LL))")))

(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 "S"
  "Integer constant that has all 1 bits consecutive and starting at bit 0"
  (and (match_code "const_int")
       (match_test "ival != 0 && (ival & (ival + 1)) == 0")))

(define_constraint "T"
  "An unspec wrapper for a symbolc operand"
  (ior (match_operand 0 "const_last_symbolic_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"
  "An 8-element vector constant with identical elements"
  (and (match_code "const_vector")
       (match_test "CONST_VECTOR_NUNITS (op) == 8")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 2)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 3)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 4)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 5)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 6)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 7)")))

(define_constraint "Y"
  "A 4-element vector constant with identical elements"
  (and (match_code "const_vector")
       (match_test "CONST_VECTOR_NUNITS (op) == 4")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 2)")
       (match_test "CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 3)")))
(define_constraint "Z0"
 "The integer constant 0xffffffff"
 (and (match_code "const_int")
      (match_test "ival == 0xffffffff")))

(define_constraint "Z1"
 "The integer constant 0xffffffff00000000"
 (and (match_code "const_int")
      (match_test "ival == (HOST_WIDE_INT)0xffffffff00000000LL")))
OpenPOWER on IntegriCloud