0
|
1 ;; Predicate definitions for ATMEL AVR micro controllers.
|
|
2 ;; Copyright (C) 2006, 2007, 2008 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 ;; <http://www.gnu.org/licenses/>.
|
|
19
|
|
20 ;; Registers from r0 to r15.
|
|
21 (define_predicate "l_register_operand"
|
|
22 (and (match_code "reg")
|
|
23 (match_test "REGNO (op) <= 15")))
|
|
24
|
|
25 ;; Registers from r16 to r31.
|
|
26 (define_predicate "d_register_operand"
|
|
27 (and (match_code "reg")
|
|
28 (match_test "REGNO (op) >= 16 && REGNO (op) <= 31")))
|
|
29
|
|
30 (define_predicate "even_register_operand"
|
|
31 (and (match_code "reg")
|
|
32 (and (match_test "REGNO (op) <= 31")
|
|
33 (match_test "(REGNO (op) & 1) == 0"))))
|
|
34
|
|
35 (define_predicate "odd_register_operand"
|
|
36 (and (match_code "reg")
|
|
37 (and (match_test "REGNO (op) <= 31")
|
|
38 (match_test "(REGNO (op) & 1) != 0"))))
|
|
39
|
|
40 ;; SP register.
|
|
41 (define_predicate "stack_register_operand"
|
|
42 (and (match_code "reg")
|
|
43 (match_test "REGNO (op) == REG_SP")))
|
|
44
|
|
45 ;; Return true if OP is a valid address for lower half of I/O space.
|
|
46 (define_predicate "low_io_address_operand"
|
|
47 (and (match_code "const_int")
|
|
48 (match_test "IN_RANGE((INTVAL (op)), 0x20, 0x3F)")))
|
|
49
|
|
50 ;; Return true if OP is a valid address for high half of I/O space.
|
|
51 (define_predicate "high_io_address_operand"
|
|
52 (and (match_code "const_int")
|
|
53 (match_test "IN_RANGE((INTVAL (op)), 0x40, 0x5F)")))
|
|
54
|
|
55 ;; Return true if OP is a valid address of I/O space.
|
|
56 (define_predicate "io_address_operand"
|
|
57 (and (match_code "const_int")
|
|
58 (match_test "IN_RANGE((INTVAL (op)), 0x20, (0x60 - GET_MODE_SIZE(mode)))")))
|
|
59
|
|
60 ;; Return 1 if OP is the zero constant for MODE.
|
|
61 (define_predicate "const0_operand"
|
|
62 (and (match_code "const_int,const_double")
|
|
63 (match_test "op == CONST0_RTX (mode)")))
|
|
64
|
|
65 ;; Returns true if OP is either the constant zero or a register.
|
|
66 (define_predicate "reg_or_0_operand"
|
|
67 (ior (match_operand 0 "register_operand")
|
|
68 (match_operand 0 "const0_operand")))
|
|
69
|
|
70 ;; Returns 1 if OP is a SYMBOL_REF.
|
|
71 (define_predicate "symbol_ref_operand"
|
|
72 (match_code "symbol_ref"))
|
|
73
|
|
74 ;; Return true if OP is a constant that contains only one 1 in its
|
|
75 ;; binary representation.
|
|
76 (define_predicate "single_one_operand"
|
|
77 (and (match_code "const_int")
|
|
78 (match_test "exact_log2(INTVAL (op) & GET_MODE_MASK (mode)) >= 0")))
|
|
79
|
|
80 ;; Return true if OP is a constant that contains only one 0 in its
|
|
81 ;; binary representation.
|
|
82 (define_predicate "single_zero_operand"
|
|
83 (and (match_code "const_int")
|
|
84 (match_test "exact_log2(~INTVAL (op) & GET_MODE_MASK (mode)) >= 0")))
|
|
85
|
|
86 ;;
|
|
87 (define_predicate "avr_sp_immediate_operand"
|
|
88 (and (match_code "const_int")
|
|
89 (match_test "INTVAL (op) >= -6 && INTVAL (op) <= 5")))
|
|
90
|
|
91 ;; True for EQ & NE
|
|
92 (define_predicate "eqne_operator"
|
|
93 (match_code "eq,ne"))
|
|
94
|
|
95 ;; True for GE & LT
|
|
96 (define_predicate "gelt_operator"
|
|
97 (match_code "ge,lt"))
|
|
98
|
|
99 ;; True for GT, GTU, LE & LEU
|
|
100 (define_predicate "difficult_comparison_operator"
|
|
101 (match_code "gt,gtu,le,leu"))
|
|
102
|
|
103 ;; False for GT, GTU, LE & LEU
|
|
104 (define_predicate "simple_comparison_operator"
|
|
105 (and (match_operand 0 "comparison_operator")
|
|
106 (not (match_code "gt,gtu,le,leu"))))
|
|
107
|
|
108 ;; Return true if OP is a valid call operand.
|
|
109 (define_predicate "call_insn_operand"
|
|
110 (and (match_code "mem")
|
|
111 (ior (match_test "register_operand (XEXP (op, 0), mode)")
|
|
112 (match_test "CONSTANT_ADDRESS_P (XEXP (op, 0))"))))
|