* config/cris/constraints.md: New file.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2011 21:33:24 +0000 (21:33 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2011 21:33:24 +0000 (21:33 +0000)
* config/cris/cris.h (REG_CLASS_FROM_LETTER, CONSTRAINT_LEN,
CRIS_CONST_OK_FOR_LETTER_P, CONST_OK_FOR_CONSTRAINT_P,
CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_MEMORY_CONSTRAINT,
EXTRA_CONSTRAINT, EXTRA_CONSTRAINT_Q, EXTRA_CONSTRAINT_R,
EXTRA_CONSTRAINT_T, EXTRA_CONSTRAINT_S, EXTRA_CONSTRAINT_U): Remove.
* config/cris/cris.c: Incule "tm-constrs.h".
(cris_print_operand): Use satisfies_constraint_O.
(cris_normal_notice_update_cc, cris_rtx_costs): Use
satisfies_constraint_I.
(cris_address_cost): Use satisfies_constraint_L.
* config/cris/cris.md: Include "constraints.md".
(*mov_side<mode>, *mov_sidesisf, *mov_side<mode>_mem,
*mov_sidesisf_mem, *clear_side<mode>, *ext_sideqihi,
*ext_side<mode>si, *op_side<mode>, *op_swap_side<mode>,
*extopqihi_side, *extop<mode>si_side, *extopqihi_swap_side,
*extop<mode>si_swap_side): Use satisfies_constraint_N and
satisfies_constraint_J.
(moversideqi movemsideqi mover2side peephole2): Use
satisfies_constraint_N and satisfies_constraint_J.
(andu peephole2): Use satisfies_constraint_I and
satisfies_constraint_O.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181120 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/cris/constraints.md [new file with mode: 0644]
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/cris/cris.md

index 16e14dd..db6749b 100644 (file)
@@ -1,3 +1,28 @@
+2011-11-07  Anatoly Sokolov  <aesok@post.ru>
+
+       * config/cris/constraints.md: New file.
+       * config/cris/cris.h (REG_CLASS_FROM_LETTER, CONSTRAINT_LEN,
+       CRIS_CONST_OK_FOR_LETTER_P, CONST_OK_FOR_CONSTRAINT_P,
+       CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_MEMORY_CONSTRAINT,
+       EXTRA_CONSTRAINT, EXTRA_CONSTRAINT_Q, EXTRA_CONSTRAINT_R,
+       EXTRA_CONSTRAINT_T, EXTRA_CONSTRAINT_S, EXTRA_CONSTRAINT_U): Remove.
+       * config/cris/cris.c: Incule "tm-constrs.h".
+       (cris_print_operand): Use satisfies_constraint_O.
+       (cris_normal_notice_update_cc, cris_rtx_costs): Use
+       satisfies_constraint_I.
+       (cris_address_cost): Use satisfies_constraint_L.
+       * config/cris/cris.md: Include "constraints.md".
+       (*mov_side<mode>, *mov_sidesisf, *mov_side<mode>_mem,
+       *mov_sidesisf_mem, *clear_side<mode>, *ext_sideqihi,
+       *ext_side<mode>si, *op_side<mode>, *op_swap_side<mode>,
+       *extopqihi_side, *extop<mode>si_side, *extopqihi_swap_side,
+       *extop<mode>si_swap_side): Use satisfies_constraint_N and
+       satisfies_constraint_J.
+       (moversideqi movemsideqi mover2side peephole2): Use
+       satisfies_constraint_N and satisfies_constraint_J.
+       (andu peephole2): Use satisfies_constraint_I and
+       satisfies_constraint_O.
+
 2011-11-07  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (ix86_builtin_vectorized_function): Handle
diff --git a/gcc/config/cris/constraints.md b/gcc/config/cris/constraints.md
new file mode 100644 (file)
index 0000000..42944e7
--- /dev/null
@@ -0,0 +1,164 @@
+;; Constraint definitions for CRIS.
+;; Copyright (C) 2011 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Register constraints.
+(define_register_constraint "a" "ACR_REGS"
+  "@internal")
+
+(define_register_constraint "b" "GENNONACR_REGS"
+  "@internal")
+
+(define_register_constraint "h" "MOF_REGS"
+  "@internal")
+
+(define_register_constraint "x" "SPECIAL_REGS"
+  "@internal")
+
+(define_register_constraint "c" "CC0_REGS"
+  "@internal")
+
+;; Integer constraints.
+(define_constraint "I"
+  "MOVEQ, CMPQ, ANDQ, ORQ."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, -32, 31)")))
+
+(define_constraint "J"
+  "ADDQ, SUBQ."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, 0, 63)")))
+
+(define_constraint "Kc"
+  "ASRQ, BTSTQ, LSRQ, LSLQ."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, 0, 31)")))
+
+(define_constraint "Kp"
+  "A power of two."
+  (and (match_code "const_int")
+       (match_test "exact_log2 (ival) >= 0")))
+
+(define_constraint "L"
+  "A 16-bit signed number."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, -32768, 32767)")))
+
+(define_constraint "M"
+  "The constant 0 for CLEAR."
+  (and (match_code "const_int")
+       (match_test "ival == 0")))
+
+(define_constraint "N"
+  "A negative ADDQ or SUBQ."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, -63, -1)")))
+
+(define_constraint "O"
+  "Quickened ints, QI and HI."
+  (and (match_code "const_int")
+       (ior (match_test "IN_RANGE (ival, (65535 - 31), 65535)")
+           (match_test "IN_RANGE (ival, (255 - 31), 255)"))))
+
+(define_constraint "P"
+  "A 16-bit number signed *or* unsigned."
+  (and (match_code "const_int")
+       (match_test "IN_RANGE (ival, -32768, 65535)")))
+
+;; Floating-point constant constraints.
+(define_constraint "G"
+  "The floating point zero constant"
+  (and (match_code "const_double")
+       (match_test "GET_MODE_CLASS (mode) == MODE_FLOAT")
+       (match_test "op == CONST0_RTX (mode)")))
+
+;; Memory constraints.
+
+;; Just an indirect register (happens to also be "all" slottable
+;; memory addressing modes not covered by other constraints, i.e. '>').
+(define_memory_constraint "Q"
+  "@internal"
+  (and (match_code "mem")
+       (match_test "cris_base_p (XEXP (op, 0), reload_in_progress
+                                              || reload_completed)")))
+
+;; Extra constraints.
+(define_constraint "R"
+  "An operand to BDAP or BIAP."
+       ;; A BIAP; r.S?
+  (ior (match_test "cris_biap_index_p (op, reload_in_progress
+                                          || reload_completed)")
+       ;; A [reg] or (int) [reg], maybe with post-increment.
+       (match_test "cris_bdap_index_p (op, reload_in_progress
+                                          || reload_completed)")
+       (match_test "cris_constant_index_p (op)")))
+
+(define_constraint "T"
+  "Memory three-address operand."
+  ;; All are indirect-memory:
+  (and (match_code "mem")
+           ;; Double indirect: [[reg]] or [[reg+]]?
+       (ior (and (match_code "mem" "0")
+                (match_test "cris_base_or_autoincr_p (XEXP (XEXP (op, 0), 0),
+                                                      reload_in_progress
+                                                      || reload_completed)"))
+           ;; Just an explicit indirect reference: [const]?
+           (match_test "CONSTANT_P (XEXP (op, 0))")
+           ;; Something that is indexed; [...+...]?
+           (and (match_code "plus" "0")
+                     ;; A BDAP constant: [reg+(8|16|32)bit offset]?
+                (ior (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
+                                                    reload_in_progress
+                                                    || reload_completed)")
+                          (match_test "cris_constant_index_p (XEXP (XEXP (op, 0), 1))"))
+                     ;; A BDAP register: [reg+[reg(+)].S]?
+                     (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
+                                                    reload_in_progress
+                                                    || reload_completed)")
+                          (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 1),
+                                                          reload_in_progress
+                                                          || reload_completed)"))
+                     ;; Same, but with swapped arguments (no canonical
+                     ;; ordering between e.g. REG and MEM as of LAST_UPDATED
+                     ;; "Thu May 12 03:59:11 UTC 2005").
+                     (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
+                                                    reload_in_progress
+                                                    || reload_completed)")
+                          (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 0),
+                                                          reload_in_progress
+                                                          || reload_completed)"))
+                     ;; A BIAP: [reg+reg.S] (MULT comes first).
+                     (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
+                                                    reload_in_progress
+                                                    || reload_completed)")
+                          (match_test "cris_biap_index_p (XEXP (XEXP (op, 0), 0),
+                                                          reload_in_progress
+                                                          || reload_completed)")))))))
+
+(define_constraint "S"
+  "PIC-constructs for symbols."
+  (and (match_test "flag_pic")
+       (match_code "const")
+       (match_test "cris_valid_pic_const (op, false)")))
+
+(define_constraint "U"
+  "@internal"
+  (and (match_test "flag_pic")
+       (match_test "CONSTANT_P (op)")
+       (match_operand 0 "cris_nonmemory_operand_or_callable_symbol")))
+
index 4a08ae0..0656802 100644 (file)
@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm_p.h"
 #include "debug.h"
 #include "output.h"
+#include "tm-constrs.h"
 #include "target.h"
 #include "target-def.h"
 #include "ggc.h"
@@ -703,8 +704,7 @@ cris_print_operand (FILE *file, rtx x, int code)
     case 'b':
       /* Print the unsigned supplied integer as if it were signed
         and < 0, i.e print 255 or 65535 as -1, 254, 65534 as -2, etc.  */
-      if (!CONST_INT_P (x)
-         || !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (x), 'O'))
+      if (!satisfies_constraint_O (x))
        LOSE_AND_RETURN ("invalid operand for 'b' modifier", x);
       fprintf (file, HOST_WIDE_INT_PRINT_DEC,
               INTVAL (x)| (INTVAL (x) <= 255 ? ~255 : ~65535));
@@ -1692,9 +1692,7 @@ cris_normal_notice_update_cc (rtx exp, rtx insn)
                       && (REGNO (SET_SRC (exp))
                           > CRIS_LAST_GENERAL_REGISTER))
                   || (TARGET_V32
-                      && GET_CODE (SET_SRC (exp)) == CONST_INT
-                      && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (SET_SRC (exp)),
-                                                     'I')))
+                      && satisfies_constraint_I (SET_SRC (exp))))
            {
              /* There's no CC0 change for this case.  Just check
                 for overlap.  */
@@ -2037,7 +2035,7 @@ cris_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
       if (CONST_INT_P (XEXP (x, 1))
           /* Two constants may actually happen before optimization.  */
           && !CONST_INT_P (XEXP (x, 0))
-          && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x, 1)), 'I'))
+         && !satisfies_constraint_I (XEXP (x, 1)))
        {
          *total
            = (rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code,
@@ -2118,8 +2116,7 @@ cris_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
 
       /* A BDAP -32768 .. 32767 is like BDAP quick, but with 2 extra
         bytes.  */
-      if (CONST_INT_P (tem2)
-         && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (tem2), 'L'))
+      if (satisfies_constraint_L (tem2))
        return (2 + 2) / 2;
 
       /* A BDAP with some other constant is 2 bytes extra.  */
index 135b03b..a9a68b8 100644 (file)
@@ -550,16 +550,6 @@ enum reg_class
 
 #define INDEX_REG_CLASS GENERAL_REGS
 
-#define REG_CLASS_FROM_LETTER(C)               \
-  (                                            \
-   (C) == 'a' ? ACR_REGS :                     \
-   (C) == 'b' ? GENNONACR_REGS :               \
-   (C) == 'h' ? MOF_REGS :                     \
-   (C) == 'x' ? SPECIAL_REGS :                 \
-   (C) == 'c' ? CC0_REGS :                     \
-   NO_REGS                                     \
-  )
-
 /* Since it uses reg_renumber, it is safe only once reg_renumber
    has been allocated, which happens in local-alloc.c.  */
 #define REGNO_OK_FOR_BASE_P(REGNO)                                     \
@@ -609,127 +599,6 @@ enum reg_class
   ? 1 /* + cris_fatal ("CLASS_MAX_NREGS with VOIDmode")        */              \
   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
-/* We are now out of letters; we could use ten more.  This forces us to
-   use C-code in the 'md' file.  FIXME: Use some EXTRA_CONSTRAINTS.  */
-#define CRIS_CONST_OK_FOR_LETTER_P(VALUE, C)           \
- (                                                     \
-  /* MOVEQ, CMPQ, ANDQ, ORQ.  */                       \
-  (C) == 'I' ? (VALUE) >= -32 && (VALUE) <= 31 :       \
-  /* ADDQ, SUBQ.  */                                   \
-  (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 :         \
-  /* ASRQ, BTSTQ, LSRQ, LSLQ.  */                      \
-  (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 31 :         \
-  /* A 16-bit signed number.  */                       \
-  (C) == 'L' ? (VALUE) >= -32768 && (VALUE) <= 32767 : \
-  /* The constant 0 for CLEAR.  */                     \
-  (C) == 'M' ? (VALUE) == 0 :                          \
-  /* A negative ADDQ or SUBQ.  */                      \
-  (C) == 'N' ? (VALUE) >= -63 && (VALUE) < 0 :         \
-  /* Quickened ints, QI and HI.  */                    \
-  (C) == 'O' ? (VALUE) >= 0 && (VALUE) <= 65535                \
-               && ((VALUE) >= (65535-31)               \
-                   || ((VALUE) >= (255-31)             \
-                       && (VALUE) <= 255 )) :          \
-  /* A 16-bit number signed *or* unsigned.  */         \
-  (C) == 'P' ? (VALUE) >= -32768 && (VALUE) <= 65535 : \
-  0)
-
-#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, S) \
- (                                             \
-  ((C) != 'K' || (S)[1] == 'c')                        \
-   ? CRIS_CONST_OK_FOR_LETTER_P (VALUE, C) :   \
-  ((C) == 'K' && (S)[1] == 'p')                        \
-   ? exact_log2 (VALUE) >= 0 :                 \
-  0)
-
-#define CONSTRAINT_LEN(C, S) ((C) == 'K' ? 2 : DEFAULT_CONSTRAINT_LEN (C, S))
-
-/* It is really simple to make up a 0.0; it is the same as int-0 in
-   IEEE754.  */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)                 \
- ((C) == 'G' && ((VALUE) == CONST0_RTX (DFmode)                        \
-                || (VALUE) == CONST0_RTX (SFmode)))
-
-/* We need this on cris to distinguish delay-slottable addressing modes.  */
-#define EXTRA_CONSTRAINT(X, C)                 \
- (                                             \
-  /* Slottable address mode?  */               \
-  (C) == 'Q' ? EXTRA_CONSTRAINT_Q (X) :                \
-  /* Operand to BDAP or BIAP?  */              \
-  (C) == 'R' ? EXTRA_CONSTRAINT_R (X) :                \
-  /* A local PIC symbol?  */                   \
-  (C) == 'S' ? EXTRA_CONSTRAINT_S (X) :                \
-  /* A three-address addressing-mode?  */      \
-  (C) == 'T' ? EXTRA_CONSTRAINT_T (X) :                \
-  /* A PLT symbol?  */                         \
-  (C) == 'U' ? EXTRA_CONSTRAINT_U (X) :                \
-  0)
-
-#define EXTRA_MEMORY_CONSTRAINT(X, STR) ((X) == 'Q')
-
-#define EXTRA_CONSTRAINT_Q(X)                          \
- (                                                     \
-  /* Just an indirect register (happens to also be     \
-     "all" slottable memory addressing modes not       \
-     covered by other constraints, i.e. '>').  */      \
-  MEM_P (X)                                            \
-  && cris_base_p (XEXP (X, 0), reload_in_progress || reload_completed) \
- )
-
-#define EXTRA_CONSTRAINT_R(X)                                  \
- (                                                             \
-  /* An operand to BDAP or BIAP:                               \
-     A BIAP; r.S? */                                           \
-  cris_biap_index_p (X, reload_in_progress || reload_completed)  \
-  /* A [reg] or (int) [reg], maybe with post-increment.  */    \
-  || cris_bdap_index_p (X, reload_in_progress || reload_completed) \
-  || cris_constant_index_p (X)                                 \
- )
-
-#define EXTRA_CONSTRAINT_T(X)                                          \
- (                                                                     \
-  /* Memory three-address operand.  All are indirect-memory:  */       \
-  MEM_P (X)                                                            \
-  && ((MEM_P (XEXP (X, 0))                                             \
-       /* Double indirect: [[reg]] or [[reg+]]?  */                    \
-       && (cris_base_or_autoincr_p (XEXP (XEXP (X, 0), 0),             \
-                             reload_in_progress || reload_completed))) \
-      /* Just an explicit indirect reference: [const]?  */             \
-      || CONSTANT_P (XEXP (X, 0))                                      \
-      /* Something that is indexed; [...+...]?  */                     \
-      || (GET_CODE (XEXP (X, 0)) == PLUS                               \
-         /* A BDAP constant: [reg+(8|16|32)bit offset]?  */            \
-         && ((cris_base_p (XEXP (XEXP (X, 0), 0),                      \
-                              reload_in_progress || reload_completed)  \
-              && cris_constant_index_p (XEXP (XEXP (X, 0), 1)))        \
-             /* A BDAP register: [reg+[reg(+)].S]?  */                 \
-             || (cris_base_p (XEXP (XEXP (X, 0), 0),                   \
-                              reload_in_progress || reload_completed)  \
-                 && cris_bdap_index_p (XEXP(XEXP(X, 0), 1),            \
-                              reload_in_progress || reload_completed)) \
-             /* Same, but with swapped arguments (no canonical         \
-                ordering between e.g. REG and MEM as of LAST_UPDATED   \
-                "Thu May 12 03:59:11 UTC 2005").  */                   \
-             || (cris_base_p (XEXP (XEXP (X, 0), 1),                   \
-               reload_in_progress | reload_completed)                  \
-                 && cris_bdap_index_p (XEXP (XEXP (X, 0), 0),          \
-                              reload_in_progress || reload_completed)) \
-             /* A BIAP: [reg+reg.S] (MULT comes first).  */            \
-             || (cris_base_p (XEXP (XEXP (X, 0), 1),                   \
-                               reload_in_progress || reload_completed) \
-                 && cris_biap_index_p (XEXP (XEXP (X, 0), 0),          \
-                           reload_in_progress || reload_completed))))) \
- )
-
-/* PIC-constructs for symbols.  */
-#define EXTRA_CONSTRAINT_S(X)                                          \
- (flag_pic && GET_CODE (X) == CONST && cris_valid_pic_const (X, false))
-
-#define EXTRA_CONSTRAINT_U(X)                                          \
- (flag_pic                                                             \
-  && CONSTANT_P (X)                                                    \
-  && cris_nonmemory_operand_or_callable_symbol (X, VOIDmode))
-
 
 /* Node: Frame Layout */
 
index 428132c..5352594 100644 (file)
 ;; Operand and operator predicates.
 
 (include "predicates.md")
+(include "constraints.md")
 \f
 ;; Test insns.
 
       && (!CONST_INT_P (operands[2])
          || INTVAL (operands[2]) > 127
          || INTVAL (operands[2]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+         || satisfies_constraint_N (operands[2])
+         || satisfies_constraint_J (operands[2])))
     return "#";
   if (which_alternative == 4)
     return "move<m> [%3=%2%S1],%0";
       && (!CONST_INT_P (operands[2])
          || INTVAL (operands[2]) > 127
          || INTVAL (operands[2]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+         || satisfies_constraint_N (operands[2])
+         || satisfies_constraint_J (operands[2])))
     return "#";
   if (which_alternative < 3)
     return "move.%s0 [%3=%1%S2],%0";
       && (!CONST_INT_P (operands[1])
          || INTVAL (operands[1]) > 127
          || INTVAL (operands[1]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+         || satisfies_constraint_N (operands[1])
+         || satisfies_constraint_J (operands[1])))
     return "#";
   if (which_alternative == 1 || which_alternative == 5)
     return "#";
       && (!CONST_INT_P (operands[1])
          || INTVAL (operands[1]) > 127
          || INTVAL (operands[1]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+         || satisfies_constraint_N (operands[1])
+         || satisfies_constraint_J (operands[1])))
     return "#";
   if (which_alternative == 1
       || which_alternative == 7
       && (!CONST_INT_P (operands[1])
          || INTVAL (operands[1]) > 127
          || INTVAL (operands[1]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
+         || satisfies_constraint_N (operands[1])
+         || satisfies_constraint_J (operands[1])))
     return "#";
   if (which_alternative == 4)
     return "clear<m> [%2=%1%S0]";
       && (!CONST_INT_P (operands[2])
          || INTVAL (operands[2]) > 127
          || INTVAL (operands[2]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+         || satisfies_constraint_N (operands[2])
+         || satisfies_constraint_J (operands[2])))
     return "#";
   if (which_alternative == 4)
     return "mov%e4.%m4 [%3=%2%S1],%0";
       && (!CONST_INT_P (operands[2])
          || INTVAL (operands[2]) > 127
          || INTVAL (operands[2]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')))
+         || satisfies_constraint_N (operands[2])
+         || satisfies_constraint_J (operands[2])))
     return "#";
   if (which_alternative == 4)
     return "mov%e4<m> [%3=%2%S1],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return "%x5.%s0 [%4=%3%S2],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return "%x5<m> [%4=%3%S2],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return "%x5%E6.%m6 [%4=%3%S2],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return "%x5%E6<m> [%4=%3%S2],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return "add%e5.b [%4=%3%S2],%0";
       && (!CONST_INT_P (operands[3])
          || INTVAL (operands[3]) > 127
          || INTVAL (operands[3]) < -128
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
-         || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
+         || satisfies_constraint_N (operands[3])
+         || satisfies_constraint_J (operands[3])))
     return "#";
   if (which_alternative == 4)
     return \"%x6%E5.%m5 [%4=%3%S2],%0\";
   "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
    && REGNO (operands[3]) != REGNO (operands[0])
    && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+   && !satisfies_constraint_J (operands[2])
+   && !satisfies_constraint_N (operands[2])
    && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
    && TARGET_SIDE_EFFECT_PREFIXES"
   [(parallel
   "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
    && REGNO (operands[4]) != REGNO (operands[0])
    && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+   && !satisfies_constraint_J (operands[2])
+   && !satisfies_constraint_N (operands[2])
    && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
    && TARGET_SIDE_EFFECT_PREFIXES"
   [(parallel
   ;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD?
   "GET_MODE (operands[3]) != DImode
    && REGNO (operands[0]) != REGNO (operands[3])
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N')
+   && !satisfies_constraint_J (operands[2])
+   && !satisfies_constraint_N (operands[2])
    && INTVAL (operands[2]) >= -128
    && INTVAL (operands[2]) <= 127
    && TARGET_SIDE_EFFECT_PREFIXES"
    ;; don't do this for a mem-volatile access.
   "REGNO (operands[2]) == REGNO (operands[0])
    && INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
-   && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'I')
+   && !satisfies_constraint_I (operands[3])
    && !side_effects_p (operands[1])
    && (!REG_P (operands[1])
        || REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
 {
   enum machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode;
   enum machine_mode amode
-    = CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'O') ? SImode : zmode;
+    = satisfies_constraint_O (operands[3]) ? SImode : zmode;
   rtx op1
     = (REG_S_P (operands[1])
        ? gen_rtx_REG (zmode, REGNO (operands[1]))