OSDN Git Service

* doc/invoke.texi: Document -mbitops for SH.
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / predicates.md
index 1578afb..ff6a1a2 100644 (file)
@@ -1,11 +1,11 @@
 ;; Predicate definitions for Renesas / SuperH SH.
-;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007 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 2, or (at your option)
+;; 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,
@@ -14,9 +14,8 @@
 ;; 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 COPYING.  If not, write to
-;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
 
 ;; TODO: Add a comment here.
 
   if (GET_CODE (cond) == CONST)
     {
       cond = XEXP (cond, 0);
-      if (!EXTRA_CONSTRAINT_Csy (tar))
+      if (!satisfies_constraint_Csy (tar))
        return 0;
       if (GET_CODE (tar) == CONST)
        tar = XEXP (tar, 0);
     }
   else if (!arith_reg_operand (tar, VOIDmode)
-          && ! EXTRA_CONSTRAINT_Csy (tar))
+          && ! satisfies_constraint_Csy (tar))
     return 0;
   if (GET_CODE (cond) != EQ)
     return 0;
@@ -70,8 +69,7 @@
   /* Check mshflo.l / mshflhi.l opportunities.  */
   if (TARGET_SHMEDIA
       && mode == DImode
-      && GET_CODE (op) == CONST_INT
-      && CONST_OK_FOR_J16 (INTVAL (op)))
+      && satisfies_constraint_J16 (op))
     return 1;
 
   return 0;
   if (TARGET_SHMEDIA)
     {
       /* FIXME: We should be checking whether the CONST_INT fits in a
-        CONST_OK_FOR_I16 here, but this causes reload_cse to crash when
+        signed 16-bit here, but this causes reload_cse to crash when
         attempting to transform a sequence of two 64-bit sets of the
         same register from literal constants into a set and an add,
         when the difference is too wide for an add.  */
       if (GET_CODE (op) == CONST_INT
-         || EXTRA_CONSTRAINT_Css (op))
+         || satisfies_constraint_Css (op))
        return 1;
       else if (GET_CODE (op) == TRUNCATE
               && ! system_reg_operand (XEXP (op, 0), VOIDmode)
       else
        return 0;
     }
-  else if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_I08 (INTVAL (op)))
+  else if (satisfies_constraint_I08 (op))
     return 1;
 
   return 0;
   if (arith_reg_operand (op, mode))
     return 1;
 
-  if (EXTRA_CONSTRAINT_Z (op))
+  if (satisfies_constraint_Z (op))
     return 1;
 
   return 0;
 (define_predicate "cmp_operand"
   (match_code "subreg,reg,const_int")
 {
-  if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_N (INTVAL (op)))
+  if (satisfies_constraint_N (op))
     return 1;
   if (TARGET_SHMEDIA
       && mode != DImode && GET_CODE (op) == SUBREG
 
   if (TARGET_SHMEDIA)
     {
-      if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_I10 (INTVAL (op)))
+      if (satisfies_constraint_I10 (op))
        return 1;
       else
        return 0;
     }
-  else if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_K08 (INTVAL (op)))
+  else if (satisfies_constraint_K08 (op))
     return 1;
 
   return 0;
     return 0;
 
   if ((GET_MODE (op) == Pmode || GET_MODE (op) == VOIDmode)
-      && EXTRA_CONSTRAINT_Csy (op))
+      && satisfies_constraint_Csy (op))
     return ! reload_completed;
 
   return target_reg_operand (op, mode);
   (match_code "subreg,reg,plus")
 {
   if (GET_CODE (op) == PLUS
-      && (GET_CODE (XEXP (op, 1)) != CONST_INT
-         || ! CONST_OK_FOR_I06 (INTVAL (XEXP (op, 1)))))
+      && (! satisfies_constraint_I06 (XEXP (op, 1))))
     return 0;
   return address_operand (op, QImode);
 })
 (define_predicate "ua_offset"
   (match_code "const_int")
 {
-  return GET_CODE (op) == CONST_INT && CONST_OK_FOR_I06 (INTVAL (op));
+  return satisfies_constraint_I06 (op);
 })
 
 ;; TODO: Add a comment here.
 {
   if (GET_CODE (op) == CONST_INT)
     return (TARGET_SHMEDIA
-           ? (CONST_OK_FOR_I06 (INTVAL (op))
-              || (no_new_pseudos && INTVAL (op) == 0xff))
-           : CONST_OK_FOR_K08 (INTVAL (op)));
+           ? (satisfies_constraint_I06 (op)
+              || (!can_create_pseudo_p () && INTVAL (op) == 0xff))
+           : satisfies_constraint_K08 (op));
   if (TARGET_SHMEDIA
       && mode != DImode && GET_CODE (op) == SUBREG
       && GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))) > 4)
     return 0;
   return arith_reg_operand (op, mode);
 })
+
+(define_predicate "bitwise_memory_operand"
+  (match_code "mem")
+{
+  if (GET_CODE (op) == MEM)
+    {
+      if (REG_P (XEXP (op, 0)))
+       return 1;
+
+      if (GET_CODE (XEXP (op, 0)) == PLUS
+         && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
+         && satisfies_constraint_K12 (XEXP (XEXP (op, 0), 1)))
+        return 1;
+    }
+  return 0;
+})