2007-01-03 Paul Brook <paul@codesourcery.com>
[official-gcc.git] / gcc / config / avr / constraints.md
blobeca5cbef292895d33a8ddf2874c50ba39926a0f8
1 ;; Constraint definitions for ATMEL AVR micro controllers.
2 ;; Copyright (C) 2006 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.
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.
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.
21 ;; Register constraints
23 (define_register_constraint "t" "R0_REG"
24   "Temporary register r0")
26 (define_register_constraint "b" "BASE_POINTER_REGS"
27   "Base pointer registers (r28--r31)")
29 (define_register_constraint "e" "POINTER_REGS"
30   "Pointer registers (r26--r31)")
32 (define_register_constraint "w" "ADDW_REGS"
33   "Registers from r24 to r31.  These registers
34    can be used in @samp{adiw} command.")
36 (define_register_constraint "d" "LD_REGS"
37   "Registers from r16 to r31.")
39 (define_register_constraint "l" "NO_LD_REGS"
40   "Registers from r0 to r15.")
42 (define_register_constraint "a" "SIMPLE_LD_REGS"
43   "Registers from r16 to r23.")
45 (define_register_constraint "x" "POINTER_X_REGS"
46   "Register pair X (r27:r26).")
48 (define_register_constraint "y" "POINTER_Y_REGS"
49   "Register pair Y (r29:r28).")
51 (define_register_constraint "z" "POINTER_Z_REGS"
52   "Register pair Z (r31:r30).")
54 (define_register_constraint "q" "STACK_REG"
55   "Stack pointer register (SPH:SPL).")
57 (define_constraint "I"
58   "Integer constant in the range 0 @dots{} 63."
59   (and (match_code "const_int")
60        (match_test "ival >= 0 && ival <= 63")))
62 (define_constraint "J"
63   "Integer constant in the range -63 @dots{} 0."
64   (and (match_code "const_int")
65        (match_test "ival <= 0 && ival >= -63")))
67 (define_constraint "K"
68   "Integer constant 2."
69   (and (match_code "const_int")
70        (match_test "ival == 2")))
72 (define_constraint "L"
73   "Zero."
74   (and (match_code "const_int")
75        (match_test "ival == 0")))
77 (define_constraint "M"
78   "Integer constant in the range 0 @dots{} 0xff."
79   (and (match_code "const_int")
80        (match_test "ival >= 0 && ival <= 0xff")))
82 (define_constraint "N"
83   "Constant integer @minus{}1."
84   (and (match_code "const_int")
85        (match_test "ival == -1")))
87 (define_constraint "O"
88   "Constant integer 8, 16, or 24."
89   (and (match_code "const_int")
90        (match_test "ival == 8 || ival == 16 || ival == 24")))
92 (define_constraint "P"
93   "Constant integer 1."
94   (and (match_code "const_int")
95        (match_test "ival == 1")))
97 (define_constraint "G"
98   "Constant float 0."
99   (and (match_code "const_double")
100        (match_test "op == CONST0_RTX (SFmode)")))
102 (define_memory_constraint "Q"
103   "A memory address based on X or Y pointer with displacement."
104   (and (match_code "mem")
105        (match_test "extra_constraint_Q (op)")))