OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [bfin/] [predicates.md] - Diff between revs 38 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 154
;; Predicate definitions for the Blackfin.
;; Predicate definitions for the Blackfin.
;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
;; Contributed by Analog Devices.
;; Contributed by Analog Devices.
;;
;;
;; This file is part of GCC.
;; This file is part of GCC.
;;
;;
;; GCC is free software; you can redistribute it and/or modify
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; any later version.
;;
;;
;; GCC is distributed in the hope that it will be useful,
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; GNU General Public License for more details.
;;
;;
;; You should have received a copy of the GNU General Public License
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; along with GCC; see the file COPYING3.  If not see
;; .
;; .
;; Return nonzero iff OP is one of the integer constants 1 or 2.
;; Return nonzero iff OP is one of the integer constants 1 or 2.
(define_predicate "pos_scale_operand"
(define_predicate "pos_scale_operand"
  (and (match_code "const_int")
  (and (match_code "const_int")
       (match_test "INTVAL (op) == 1 || INTVAL (op) == 2")))
       (match_test "INTVAL (op) == 1 || INTVAL (op) == 2")))
;; Return nonzero iff OP is one of the integer constants 2 or 4.
;; Return nonzero iff OP is one of the integer constants 2 or 4.
(define_predicate "scale_by_operand"
(define_predicate "scale_by_operand"
  (and (match_code "const_int")
  (and (match_code "const_int")
       (match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
       (match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
;; Return nonzero if OP is a constant that consists of two parts; lower
;; Return nonzero if OP is a constant that consists of two parts; lower
;; bits all zero and upper bits all ones.  In this case, we can perform
;; bits all zero and upper bits all ones.  In this case, we can perform
;; an AND operation with a sequence of two shifts.  Don't return nonzero
;; an AND operation with a sequence of two shifts.  Don't return nonzero
;; if the constant would be cheap to load.
;; if the constant would be cheap to load.
(define_predicate "highbits_operand"
(define_predicate "highbits_operand"
  (and (match_code "const_int")
  (and (match_code "const_int")
       (match_test "log2constp (-INTVAL (op)) && !CONST_7BIT_IMM_P (INTVAL (op))")))
       (match_test "log2constp (-INTVAL (op)) && !CONST_7BIT_IMM_P (INTVAL (op))")))
;; Return nonzero if OP is suitable as a right-hand side operand for an
;; Return nonzero if OP is suitable as a right-hand side operand for an
;; andsi3 operation.
;; andsi3 operation.
(define_predicate "rhs_andsi3_operand"
(define_predicate "rhs_andsi3_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (and (match_code "const_int")
       (and (match_code "const_int")
            (match_test "log2constp (~INTVAL (op)) || INTVAL (op) == 255 || INTVAL (op) == 65535"))))
            (match_test "log2constp (~INTVAL (op)) || INTVAL (op) == 255 || INTVAL (op) == 65535"))))
;; Return nonzero if OP is a register or a constant with exactly one bit
;; Return nonzero if OP is a register or a constant with exactly one bit
;; set.
;; set.
(define_predicate "regorlog2_operand"
(define_predicate "regorlog2_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (and (match_code "const_int")
       (and (match_code "const_int")
            (match_test "log2constp (INTVAL (op))"))))
            (match_test "log2constp (INTVAL (op))"))))
;; Return nonzero if OP is a register or an integer constant.
;; Return nonzero if OP is a register or an integer constant.
(define_predicate "reg_or_const_int_operand"
(define_predicate "reg_or_const_int_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (match_code "const_int")))
       (match_code "const_int")))
(define_predicate "const01_operand"
(define_predicate "const01_operand"
  (and (match_code "const_int")
  (and (match_code "const_int")
       (match_test "op == const0_rtx || op == const1_rtx")))
       (match_test "op == const0_rtx || op == const1_rtx")))
(define_predicate "vec_shift_operand"
(define_predicate "vec_shift_operand"
  (ior (and (match_code "const_int")
  (ior (and (match_code "const_int")
            (match_test "INTVAL (op) >= -16 && INTVAL (op) < 15"))
            (match_test "INTVAL (op) >= -16 && INTVAL (op) < 15"))
       (match_operand 0 "register_operand")))
       (match_operand 0 "register_operand")))
;; Like register_operand, but make sure that hard regs have a valid mode.
;; Like register_operand, but make sure that hard regs have a valid mode.
(define_predicate "valid_reg_operand"
(define_predicate "valid_reg_operand"
  (match_operand 0 "register_operand")
  (match_operand 0 "register_operand")
{
{
  if (GET_CODE (op) == SUBREG)
  if (GET_CODE (op) == SUBREG)
    op = SUBREG_REG (op);
    op = SUBREG_REG (op);
  if (REGNO (op) < FIRST_PSEUDO_REGISTER)
  if (REGNO (op) < FIRST_PSEUDO_REGISTER)
    return HARD_REGNO_MODE_OK (REGNO (op), mode);
    return HARD_REGNO_MODE_OK (REGNO (op), mode);
  return 1;
  return 1;
})
})
;; Return nonzero if OP is a LC register.
;; Return nonzero if OP is a LC register.
(define_predicate "lc_register_operand"
(define_predicate "lc_register_operand"
  (and (match_code "reg")
  (and (match_code "reg")
       (match_test "REGNO (op) == REG_LC0 || REGNO (op) == REG_LC1")))
       (match_test "REGNO (op) == REG_LC0 || REGNO (op) == REG_LC1")))
;; Return nonzero if OP is a LT register.
;; Return nonzero if OP is a LT register.
(define_predicate "lt_register_operand"
(define_predicate "lt_register_operand"
  (and (match_code "reg")
  (and (match_code "reg")
       (match_test "REGNO (op) == REG_LT0 || REGNO (op) == REG_LT1")))
       (match_test "REGNO (op) == REG_LT0 || REGNO (op) == REG_LT1")))
;; Return nonzero if OP is a LB register.
;; Return nonzero if OP is a LB register.
(define_predicate "lb_register_operand"
(define_predicate "lb_register_operand"
  (and (match_code "reg")
  (and (match_code "reg")
       (match_test "REGNO (op) == REG_LB0 || REGNO (op) == REG_LB1")))
       (match_test "REGNO (op) == REG_LB0 || REGNO (op) == REG_LB1")))
;; Return nonzero if OP is a register or a 7 bit signed constant.
;; Return nonzero if OP is a register or a 7 bit signed constant.
(define_predicate "reg_or_7bit_operand"
(define_predicate "reg_or_7bit_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (and (match_code "const_int")
       (and (match_code "const_int")
            (match_test "CONST_7BIT_IMM_P (INTVAL (op))"))))
            (match_test "CONST_7BIT_IMM_P (INTVAL (op))"))))
;; Return nonzero if OP is a register other than DREG and PREG.
;; Return nonzero if OP is a register other than DREG and PREG.
(define_predicate "nondp_register_operand"
(define_predicate "nondp_register_operand"
  (match_operand 0 "register_operand")
  (match_operand 0 "register_operand")
{
{
  unsigned int regno;
  unsigned int regno;
  if (GET_CODE (op) == SUBREG)
  if (GET_CODE (op) == SUBREG)
    op = SUBREG_REG (op);
    op = SUBREG_REG (op);
  regno = REGNO (op);
  regno = REGNO (op);
  return (regno >= FIRST_PSEUDO_REGISTER || !DP_REGNO_P (regno));
  return (regno >= FIRST_PSEUDO_REGISTER || !DP_REGNO_P (regno));
})
})
;; Return nonzero if OP is a register other than DREG and PREG, or MEM.
;; Return nonzero if OP is a register other than DREG and PREG, or MEM.
(define_predicate "nondp_reg_or_memory_operand"
(define_predicate "nondp_reg_or_memory_operand"
  (ior (match_operand 0 "nondp_register_operand")
  (ior (match_operand 0 "nondp_register_operand")
       (match_operand 0 "memory_operand")))
       (match_operand 0 "memory_operand")))
;; Return nonzero if OP is a register or, when negated, a 7 bit signed
;; Return nonzero if OP is a register or, when negated, a 7 bit signed
;; constant.
;; constant.
(define_predicate "reg_or_neg7bit_operand"
(define_predicate "reg_or_neg7bit_operand"
  (ior (match_operand 0 "register_operand")
  (ior (match_operand 0 "register_operand")
       (and (match_code "const_int")
       (and (match_code "const_int")
            (match_test "CONST_7BIT_IMM_P (-INTVAL (op))"))))
            (match_test "CONST_7BIT_IMM_P (-INTVAL (op))"))))
;; Used for secondary reloads, this function returns 1 if OP is of the
;; Used for secondary reloads, this function returns 1 if OP is of the
;; form (plus (fp) (const_int)).
;; form (plus (fp) (const_int)).
(define_predicate "fp_plus_const_operand"
(define_predicate "fp_plus_const_operand"
  (match_code "plus")
  (match_code "plus")
{
{
  rtx op1, op2;
  rtx op1, op2;
  op1 = XEXP (op, 0);
  op1 = XEXP (op, 0);
  op2 = XEXP (op, 1);
  op2 = XEXP (op, 1);
  return (REG_P (op1)
  return (REG_P (op1)
          && (REGNO (op1) == FRAME_POINTER_REGNUM
          && (REGNO (op1) == FRAME_POINTER_REGNUM
              || REGNO (op1) == STACK_POINTER_REGNUM)
              || REGNO (op1) == STACK_POINTER_REGNUM)
          && GET_CODE (op2) == CONST_INT);
          && GET_CODE (op2) == CONST_INT);
})
})
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
;; possibly with an offset.
;; possibly with an offset.
(define_predicate "symbolic_operand"
(define_predicate "symbolic_operand"
  (ior (match_code "symbol_ref,label_ref")
  (ior (match_code "symbol_ref,label_ref")
       (and (match_code "const")
       (and (match_code "const")
            (match_test "GET_CODE (XEXP (op,0)) == PLUS
            (match_test "GET_CODE (XEXP (op,0)) == PLUS
                         && (GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
                         && (GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
                             || GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
                             || GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
                         && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))))
                         && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))))
;; Returns 1 if OP is a plain constant or matched by symbolic_operand.
;; Returns 1 if OP is a plain constant or matched by symbolic_operand.
(define_predicate "symbolic_or_const_operand"
(define_predicate "symbolic_or_const_operand"
  (ior (match_code "const_int,const_double")
  (ior (match_code "const_int,const_double")
       (match_operand 0 "symbolic_operand")))
       (match_operand 0 "symbolic_operand")))
;; Returns 1 if OP is a SYMBOL_REF.
;; Returns 1 if OP is a SYMBOL_REF.
(define_predicate "symbol_ref_operand"
(define_predicate "symbol_ref_operand"
  (match_code "symbol_ref"))
  (match_code "symbol_ref"))
;; True for any non-virtual or eliminable register.  Used in places where
;; True for any non-virtual or eliminable register.  Used in places where
;; instantiation of such a register may cause the pattern to not be recognized.
;; instantiation of such a register may cause the pattern to not be recognized.
(define_predicate "register_no_elim_operand"
(define_predicate "register_no_elim_operand"
  (match_operand 0 "register_operand")
  (match_operand 0 "register_operand")
{
{
  if (GET_CODE (op) == SUBREG)
  if (GET_CODE (op) == SUBREG)
    op = SUBREG_REG (op);
    op = SUBREG_REG (op);
  return !(op == arg_pointer_rtx
  return !(op == arg_pointer_rtx
           || op == frame_pointer_rtx
           || op == frame_pointer_rtx
           || (REGNO (op) >= FIRST_PSEUDO_REGISTER
           || (REGNO (op) >= FIRST_PSEUDO_REGISTER
               && REGNO (op) <= LAST_VIRTUAL_REGISTER));
               && REGNO (op) <= LAST_VIRTUAL_REGISTER));
})
})
;; Test for an operator valid in a conditional branch
;; Test for an operator valid in a conditional branch
(define_predicate "bfin_cbranch_operator"
(define_predicate "bfin_cbranch_operator"
  (match_code "eq,ne"))
  (match_code "eq,ne"))
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.