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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [stormy16/] [predicates.md] - Blame information for rev 294

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

Line No. Rev Author Line
1 38 julius
;; Predicate definitions for XSTORMY16.
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
;; Return 1 if OP is a shift operator.
21
 
22
(define_predicate "shift_operator"
23
  (match_code "ashift,ashiftrt,lshiftrt")
24
{
25
  enum rtx_code code = GET_CODE (op);
26
 
27
  return (code == ASHIFT
28
          || code == ASHIFTRT
29
          || code == LSHIFTRT);
30
})
31
 
32
;; Return 1 if this is an EQ or NE operator.
33
 
34
(define_predicate "equality_operator"
35
  (match_code "eq,ne")
36
{
37
  return ((mode == VOIDmode || GET_MODE (op) == mode)
38
          && (GET_CODE (op) == EQ || GET_CODE (op) == NE));
39
})
40
 
41
;; Return 1 if this is a comparison operator but not an EQ or NE
42
;; operator.
43
 
44
(define_predicate "inequality_operator"
45
  (match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
46
{
47
  return comparison_operator (op, mode) && ! equality_operator (op, mode);
48
})
49
 
50
;; Return 1 if this is a LT, GE, LTU, or GEU operator.
51
 
52
(define_predicate "xstormy16_ineqsi_operator"
53
  (match_code "lt,ge,ltu,geu")
54
{
55
  enum rtx_code code = GET_CODE (op);
56
 
57
  return ((mode == VOIDmode || GET_MODE (op) == mode)
58
          && (code == LT || code == GE || code == LTU || code == GEU));
59
})
60
 
61
;; Predicate for MEMs that can use special 8-bit addressing.
62
 
63
(define_predicate "xstormy16_below100_operand"
64
  (match_code "mem")
65
{
66
  if (GET_MODE (op) != mode)
67
    return 0;
68
  if (GET_CODE (op) == MEM)
69
    op = XEXP (op, 0);
70
  else if (GET_CODE (op) == SUBREG
71
           && GET_CODE (XEXP (op, 0)) == MEM
72
           && !MEM_VOLATILE_P (XEXP (op, 0)))
73
    op = XEXP (XEXP (op, 0), 0);
74
  else
75
    return 0;
76
  if (GET_CODE (op) == CONST_INT)
77
    {
78
      HOST_WIDE_INT i = INTVAL (op);
79
      return (i >= 0x7f00 && i < 0x7fff);
80
    }
81
  return xstormy16_below100_symbol (op, HImode);
82
})
83
 
84
;; TODO: Add a comment here.
85
 
86
(define_predicate "xstormy16_below100_or_register"
87
  (match_code "mem,reg,subreg")
88
{
89
  return (xstormy16_below100_operand (op, mode)
90
          || register_operand (op, mode));
91
})
92
 
93
;; TODO: Add a comment here.
94
 
95
(define_predicate "xstormy16_splittable_below100_or_register"
96
  (match_code "mem,reg,subreg")
97
{
98
  if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
99
    return 0;
100
  return (xstormy16_below100_operand (op, mode)
101
          || register_operand (op, mode));
102
})
103
 
104
;; Predicate for constants with exactly one bit not set.
105
 
106
(define_predicate "xstormy16_onebit_clr_operand"
107
  (match_code "const_int")
108
{
109
  HOST_WIDE_INT i;
110
  if (GET_CODE (op) != CONST_INT)
111
    return 0;
112
  i = ~ INTVAL (op);
113
  if (mode == QImode)
114
    i &= 0xff;
115
  if (mode == HImode)
116
    i &= 0xffff;
117
  return exact_log2 (i) != -1;
118
})
119
 
120
;; Predicate for constants with exactly one bit set.
121
 
122
(define_predicate "xstormy16_onebit_set_operand"
123
  (match_code "const_int")
124
{
125
  HOST_WIDE_INT i;
126
  if (GET_CODE (op) != CONST_INT)
127
    return 0;
128
  i = INTVAL (op);
129
  if (mode == QImode)
130
    i &= 0xff;
131
  if (mode == HImode)
132
    i &= 0xffff;
133
  return exact_log2 (i) != -1;
134
})
135
 
136
;; TODO: Add a comment here.
137
 
138
(define_predicate "nonimmediate_nonstack_operand"
139
  (match_code "reg,mem,subreg")
140
{
141
  /* 'Q' is for pushes, 'R' for pops.  */
142
  return (nonimmediate_operand (op, mode)
143
          && ! xstormy16_extra_constraint_p (op, 'Q')
144
          && ! xstormy16_extra_constraint_p (op, 'R'));
145
})

powered by: WebSVN 2.1.0

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