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/] [stormy16/] [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 XSTORMY16.
;; Predicate definitions for XSTORMY16.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;;
;;
;; 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 1 if OP is a shift operator.
;; Return 1 if OP is a shift operator.
(define_predicate "shift_operator"
(define_predicate "shift_operator"
  (match_code "ashift,ashiftrt,lshiftrt")
  (match_code "ashift,ashiftrt,lshiftrt")
{
{
  enum rtx_code code = GET_CODE (op);
  enum rtx_code code = GET_CODE (op);
  return (code == ASHIFT
  return (code == ASHIFT
          || code == ASHIFTRT
          || code == ASHIFTRT
          || code == LSHIFTRT);
          || code == LSHIFTRT);
})
})
;; Return 1 if this is an EQ or NE operator.
;; Return 1 if this is an EQ or NE operator.
(define_predicate "equality_operator"
(define_predicate "equality_operator"
  (match_code "eq,ne")
  (match_code "eq,ne")
{
{
  return ((mode == VOIDmode || GET_MODE (op) == mode)
  return ((mode == VOIDmode || GET_MODE (op) == mode)
          && (GET_CODE (op) == EQ || GET_CODE (op) == NE));
          && (GET_CODE (op) == EQ || GET_CODE (op) == NE));
})
})
;; Return 1 if this is a comparison operator but not an EQ or NE
;; Return 1 if this is a comparison operator but not an EQ or NE
;; operator.
;; operator.
(define_predicate "inequality_operator"
(define_predicate "inequality_operator"
  (match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
  (match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
{
{
  return comparison_operator (op, mode) && ! equality_operator (op, mode);
  return comparison_operator (op, mode) && ! equality_operator (op, mode);
})
})
;; Return 1 if this is a LT, GE, LTU, or GEU operator.
;; Return 1 if this is a LT, GE, LTU, or GEU operator.
(define_predicate "xstormy16_ineqsi_operator"
(define_predicate "xstormy16_ineqsi_operator"
  (match_code "lt,ge,ltu,geu")
  (match_code "lt,ge,ltu,geu")
{
{
  enum rtx_code code = GET_CODE (op);
  enum rtx_code code = GET_CODE (op);
  return ((mode == VOIDmode || GET_MODE (op) == mode)
  return ((mode == VOIDmode || GET_MODE (op) == mode)
          && (code == LT || code == GE || code == LTU || code == GEU));
          && (code == LT || code == GE || code == LTU || code == GEU));
})
})
;; Predicate for MEMs that can use special 8-bit addressing.
;; Predicate for MEMs that can use special 8-bit addressing.
(define_predicate "xstormy16_below100_operand"
(define_predicate "xstormy16_below100_operand"
  (match_code "mem")
  (match_code "mem")
{
{
  if (GET_MODE (op) != mode)
  if (GET_MODE (op) != mode)
    return 0;
    return 0;
  if (GET_CODE (op) == MEM)
  if (GET_CODE (op) == MEM)
    op = XEXP (op, 0);
    op = XEXP (op, 0);
  else if (GET_CODE (op) == SUBREG
  else if (GET_CODE (op) == SUBREG
           && GET_CODE (XEXP (op, 0)) == MEM
           && GET_CODE (XEXP (op, 0)) == MEM
           && !MEM_VOLATILE_P (XEXP (op, 0)))
           && !MEM_VOLATILE_P (XEXP (op, 0)))
    op = XEXP (XEXP (op, 0), 0);
    op = XEXP (XEXP (op, 0), 0);
  else
  else
    return 0;
    return 0;
  if (GET_CODE (op) == CONST_INT)
  if (GET_CODE (op) == CONST_INT)
    {
    {
      HOST_WIDE_INT i = INTVAL (op);
      HOST_WIDE_INT i = INTVAL (op);
      return (i >= 0x7f00 && i < 0x7fff);
      return (i >= 0x7f00 && i < 0x7fff);
    }
    }
  return xstormy16_below100_symbol (op, HImode);
  return xstormy16_below100_symbol (op, HImode);
})
})
;; TODO: Add a comment here.
;; TODO: Add a comment here.
(define_predicate "xstormy16_below100_or_register"
(define_predicate "xstormy16_below100_or_register"
  (match_code "mem,reg,subreg")
  (match_code "mem,reg,subreg")
{
{
  return (xstormy16_below100_operand (op, mode)
  return (xstormy16_below100_operand (op, mode)
          || register_operand (op, mode));
          || register_operand (op, mode));
})
})
;; TODO: Add a comment here.
;; TODO: Add a comment here.
(define_predicate "xstormy16_splittable_below100_or_register"
(define_predicate "xstormy16_splittable_below100_or_register"
  (match_code "mem,reg,subreg")
  (match_code "mem,reg,subreg")
{
{
  if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
  if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
    return 0;
    return 0;
  return (xstormy16_below100_operand (op, mode)
  return (xstormy16_below100_operand (op, mode)
          || register_operand (op, mode));
          || register_operand (op, mode));
})
})
;; Predicate for constants with exactly one bit not set.
;; Predicate for constants with exactly one bit not set.
(define_predicate "xstormy16_onebit_clr_operand"
(define_predicate "xstormy16_onebit_clr_operand"
  (match_code "const_int")
  (match_code "const_int")
{
{
  HOST_WIDE_INT i;
  HOST_WIDE_INT i;
  if (GET_CODE (op) != CONST_INT)
  if (GET_CODE (op) != CONST_INT)
    return 0;
    return 0;
  i = ~ INTVAL (op);
  i = ~ INTVAL (op);
  if (mode == QImode)
  if (mode == QImode)
    i &= 0xff;
    i &= 0xff;
  if (mode == HImode)
  if (mode == HImode)
    i &= 0xffff;
    i &= 0xffff;
  return exact_log2 (i) != -1;
  return exact_log2 (i) != -1;
})
})
;; Predicate for constants with exactly one bit set.
;; Predicate for constants with exactly one bit set.
(define_predicate "xstormy16_onebit_set_operand"
(define_predicate "xstormy16_onebit_set_operand"
  (match_code "const_int")
  (match_code "const_int")
{
{
  HOST_WIDE_INT i;
  HOST_WIDE_INT i;
  if (GET_CODE (op) != CONST_INT)
  if (GET_CODE (op) != CONST_INT)
    return 0;
    return 0;
  i = INTVAL (op);
  i = INTVAL (op);
  if (mode == QImode)
  if (mode == QImode)
    i &= 0xff;
    i &= 0xff;
  if (mode == HImode)
  if (mode == HImode)
    i &= 0xffff;
    i &= 0xffff;
  return exact_log2 (i) != -1;
  return exact_log2 (i) != -1;
})
})
;; TODO: Add a comment here.
;; TODO: Add a comment here.
(define_predicate "nonimmediate_nonstack_operand"
(define_predicate "nonimmediate_nonstack_operand"
  (match_code "reg,mem,subreg")
  (match_code "reg,mem,subreg")
{
{
  /* 'Q' is for pushes, 'R' for pops.  */
  /* 'Q' is for pushes, 'R' for pops.  */
  return (nonimmediate_operand (op, mode)
  return (nonimmediate_operand (op, mode)
          && ! xstormy16_extra_constraint_p (op, 'Q')
          && ! xstormy16_extra_constraint_p (op, 'Q')
          && ! xstormy16_extra_constraint_p (op, 'R'));
          && ! xstormy16_extra_constraint_p (op, 'R'));
})
})
 
 

powered by: WebSVN 2.1.0

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