Reverting merge from trunk
[official-gcc.git] / gcc / config / rl78 / predicates.md
blob99ee656aad596a77dda819dbec4b7f34c0d6f805
1 ;;  Machine Description for Renesas RL78 processors
2 ;;  Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 ;;  Contributed by Red Hat.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3.  If not see
19 ;; <http://www.gnu.org/licenses/>.
21 (define_predicate "rl78_any_operand"
22   (ior (match_operand 0 "general_operand")
23        (match_code "mem,const_int,const_double,reg"))
26 (define_predicate "rl78_nonfar_operand"
27   (and (match_operand 0 "general_operand")
28        (not (match_test "rl78_far_p (op)")))
31 (define_predicate "rl78_nonfar_nonimm_operand"
32   (and (match_operand 0 "nonimmediate_operand")
33        (not (match_test "rl78_far_p (op)")))
36 (define_predicate "ubyte_operand"
37   (and (match_code "const_int")
38        (match_test "IN_RANGE (INTVAL (op), 0, 255)")))
40 (define_predicate "rl78_24_operand"
41   (and (match_code "const_int")
42        (match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
44 (define_predicate "uword_operand"
45   (ior (match_code "const")
46        (and (match_code "const_int")
47             (match_test "IN_RANGE (INTVAL (op), 0, 65536)"))))
49 (define_predicate "rl78_cmp_operator_signed"
50   (match_code "gt,ge,lt,le"))
51 (define_predicate "rl78_cmp_operator_real"
52   (match_code "eq,ne,gtu,ltu,geu,leu"))
53 (define_predicate "rl78_cmp_operator"
54   (match_code "eq,ne,gtu,ltu,geu,leu,gt,lt,ge,le"))
56 (define_predicate "rl78_ax_operand"
57   (and (match_code "reg")
58        (match_test "REGNO (op) == AX_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER")))
60 (define_predicate "rl78_addw_operand"
61   (and (match_code "reg")
62        (match_test "REGNO (op) == AX_REG || REGNO (op) == SP_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER")))
64 (define_predicate "rl78_stack_based_mem"
65   (and (match_code "mem")
66        (ior (and (match_code "reg" "0")
67                  (match_test "REGNO (XEXP (op, 0)) == SP_REG"))
68             (and (match_code "plus" "0")
69                  (and (match_code "reg" "00")
70                       (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG")
71                       (match_code "const_int" "01"))))))