OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [config/] [xtensa/] [predicates.md] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
;; Predicate definitions for Xtensa.
2
;; Copyright (C) 2005 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 2, 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 COPYING.  If not, write to
18
;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19
;; Boston, MA 02110-1301, USA.
20
 
21
(define_predicate "add_operand"
22
  (ior (and (match_code "const_int")
23
            (match_test "xtensa_simm8 (INTVAL (op))
24
                         || xtensa_simm8x256 (INTVAL (op))"))
25
       (match_operand 0 "register_operand")))
26
 
27
(define_predicate "arith_operand"
28
  (ior (and (match_code "const_int")
29
            (match_test "xtensa_simm8 (INTVAL (op))"))
30
       (match_operand 0 "register_operand")))
31
 
32
;; Non-immediate operand excluding the constant pool.
33
(define_predicate "nonimmed_operand"
34
  (ior (and (match_operand 0 "memory_operand")
35
            (match_test "!constantpool_address_p (XEXP (op, 0))"))
36
       (match_operand 0 "register_operand")))
37
 
38
;; Memory operand excluding the constant pool.
39
(define_predicate "mem_operand"
40
  (and (match_operand 0 "memory_operand")
41
       (match_test "!constantpool_address_p (XEXP (op, 0))")))
42
 
43
(define_predicate "mask_operand"
44
  (ior (and (match_code "const_int")
45
            (match_test "xtensa_mask_immediate (INTVAL (op))"))
46
       (match_operand 0 "register_operand")))
47
 
48
(define_predicate "extui_fldsz_operand"
49
  (and (match_code "const_int")
50
       (match_test "xtensa_mask_immediate ((1 << INTVAL (op)) - 1)")))
51
 
52
(define_predicate "sext_operand"
53
  (if_then_else (match_test "TARGET_SEXT")
54
                (match_operand 0 "nonimmed_operand")
55
                (match_operand 0 "mem_operand")))
56
 
57
(define_predicate "sext_fldsz_operand"
58
  (and (match_code "const_int")
59
       (match_test "INTVAL (op) >= 8 && INTVAL (op) <= 23")))
60
 
61
(define_predicate "lsbitnum_operand"
62
  (and (match_code "const_int")
63
       (match_test "BITS_BIG_ENDIAN
64
                    ? (INTVAL (op) == BITS_PER_WORD - 1)
65
                    : (INTVAL (op) == 0)")))
66
 
67
(define_predicate "branch_operand"
68
  (ior (and (match_code "const_int")
69
            (match_test "xtensa_b4const_or_zero (INTVAL (op))"))
70
       (match_operand 0 "register_operand")))
71
 
72
(define_predicate "ubranch_operand"
73
  (ior (and (match_code "const_int")
74
            (match_test "xtensa_b4constu (INTVAL (op))"))
75
       (match_operand 0 "register_operand")))
76
 
77
(define_predicate "call_insn_operand"
78
  (match_code "const_int,const,symbol_ref,reg")
79
{
80
  if ((GET_CODE (op) == REG)
81
      && (op != arg_pointer_rtx)
82
      && ((REGNO (op) < FRAME_POINTER_REGNUM)
83
          || (REGNO (op) > LAST_VIRTUAL_REGISTER)))
84
    return true;
85
 
86
  if (CONSTANT_ADDRESS_P (op))
87
    {
88
      /* Direct calls only allowed to static functions with PIC.  */
89
      if (flag_pic)
90
        {
91
          tree callee, callee_sec, caller_sec;
92
 
93
          if (GET_CODE (op) != SYMBOL_REF
94
              || !SYMBOL_REF_LOCAL_P (op) || SYMBOL_REF_EXTERNAL_P (op))
95
            return false;
96
 
97
          /* Don't attempt a direct call if the callee is known to be in
98
             a different section, since there's a good chance it will be
99
             out of range.  */
100
 
101
          if (flag_function_sections
102
              || DECL_ONE_ONLY (current_function_decl))
103
            return false;
104
          caller_sec = DECL_SECTION_NAME (current_function_decl);
105
          callee = SYMBOL_REF_DECL (op);
106
          if (callee)
107
            {
108
              if (DECL_ONE_ONLY (callee))
109
                return false;
110
              callee_sec = DECL_SECTION_NAME (callee);
111
              if (((caller_sec == NULL_TREE) ^ (callee_sec == NULL_TREE))
112
                  || (caller_sec != NULL_TREE
113
                      && strcmp (TREE_STRING_POINTER (caller_sec),
114
                                 TREE_STRING_POINTER (callee_sec)) != 0))
115
                return false;
116
            }
117
          else if (caller_sec != NULL_TREE)
118
            return false;
119
        }
120
      return true;
121
    }
122
 
123
  return false;
124
})
125
 
126
(define_predicate "move_operand"
127
  (ior
128
     (ior (match_operand 0 "register_operand")
129
          (match_operand 0 "memory_operand"))
130
     (ior (and (match_code "const_int")
131
               (match_test "GET_MODE_CLASS (mode) == MODE_INT
132
                            && xtensa_simm12b (INTVAL (op))"))
133
          (and (match_code "const_int,const_double,const,symbol_ref,label_ref")
134
               (match_test "TARGET_CONST16 && CONSTANT_P (op)
135
                            && GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0")))))
136
 
137
;; Accept the floating point constant 1 in the appropriate mode.
138
(define_predicate "const_float_1_operand"
139
  (match_code "const_double")
140
{
141
  REAL_VALUE_TYPE d;
142
  REAL_VALUE_FROM_CONST_DOUBLE (d, op);
143
  return REAL_VALUES_EQUAL (d, dconst1);
144
})
145
 
146
(define_predicate "fpmem_offset_operand"
147
  (and (match_code "const_int")
148
       (match_test "xtensa_mem_offset (INTVAL (op), SFmode)")))
149
 
150
(define_predicate "branch_operator"
151
  (match_code "eq,ne,lt,ge"))
152
 
153
(define_predicate "ubranch_operator"
154
  (match_code "ltu,geu"))
155
 
156
(define_predicate "boolean_operator"
157
  (match_code "eq,ne"))

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.