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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [xtensa/] [predicates.md] - Blame information for rev 831

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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