stormy16-protos.h: Remove the prototypes for xstormy16_ineqsi_operator...
* config/stormy16/stormy16-protos.h: Remove the prototypes for xstormy16_ineqsi_operator, equality_operator, inequality_operator, shift_operator, xstormy16_below100_operand, xstormy16_below100_or_register, xstormy16_splittable_below100_or_register, xstormy16_onebit_set_operand, xstormy16_onebit_clr_operand. * config/stormy16/stormy16.c (xstormy16_ineqsi_operator, equality_operator, inequality_operator, xstormy16_below100_operand, xstormy16_below100_or_register, xstormy16_splittable_below100_or_register, xstormy16_onebit_set_operand, xstormy16_onebit_clr_operand, nonimmediate_nonstack_operand, shift_operator): Move to predicates.md. * config/stormy16/stormy16.h (PREDICATE_CODES): Remove. * config/stormy16/stormy16.md: Include predicates.md. * config/stormy16/predicates.md: New. From-SVN: r97476
This commit is contained in:
parent
c8db7af2be
commit
25af5506aa
6 changed files with 165 additions and 139 deletions
|
@ -5,6 +5,23 @@
|
|||
xstormy16_splittable_below100_or_register, and
|
||||
nonimmediate_nonstack_operand.
|
||||
|
||||
* config/stormy16/stormy16-protos.h: Remove the prototypes for
|
||||
xstormy16_ineqsi_operator, equality_operator,
|
||||
inequality_operator, shift_operator,
|
||||
xstormy16_below100_operand, xstormy16_below100_or_register,
|
||||
xstormy16_splittable_below100_or_register,
|
||||
xstormy16_onebit_set_operand, xstormy16_onebit_clr_operand.
|
||||
* config/stormy16/stormy16.c (xstormy16_ineqsi_operator,
|
||||
equality_operator, inequality_operator,
|
||||
xstormy16_below100_operand, xstormy16_below100_or_register,
|
||||
xstormy16_splittable_below100_or_register,
|
||||
xstormy16_onebit_set_operand, xstormy16_onebit_clr_operand,
|
||||
nonimmediate_nonstack_operand, shift_operator): Move to
|
||||
predicates.md.
|
||||
* config/stormy16/stormy16.h (PREDICATE_CODES): Remove.
|
||||
* config/stormy16/stormy16.md: Include predicates.md.
|
||||
* config/stormy16/predicates.md: New.
|
||||
|
||||
2005-04-02 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* config/iq2000/iq2000.c (uns_arith_operand, arith_operand,
|
||||
|
|
146
gcc/config/stormy16/predicates.md
Normal file
146
gcc/config/stormy16/predicates.md
Normal file
|
@ -0,0 +1,146 @@
|
|||
;; Predicate definitions for XSTORMY16.
|
||||
;; Copyright (C) 2005 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)
|
||||
;; 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 COPYING. If not, write to
|
||||
;; the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;; Return 1 if OP is a shift operator.
|
||||
|
||||
(define_predicate "shift_operator"
|
||||
(match_code "ashift,ashiftrt,lshiftrt")
|
||||
{
|
||||
enum rtx_code code = GET_CODE (op);
|
||||
|
||||
return (code == ASHIFT
|
||||
|| code == ASHIFTRT
|
||||
|| code == LSHIFTRT);
|
||||
})
|
||||
|
||||
;; Return 1 if this is an EQ or NE operator.
|
||||
|
||||
(define_predicate "equality_operator"
|
||||
(match_code "eq,ne")
|
||||
{
|
||||
return ((mode == VOIDmode || GET_MODE (op) == mode)
|
||||
&& (GET_CODE (op) == EQ || GET_CODE (op) == NE));
|
||||
})
|
||||
|
||||
;; Return 1 if this is a comparison operator but not an EQ or NE
|
||||
;; operator.
|
||||
|
||||
(define_predicate "inequality_operator"
|
||||
(match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
|
||||
{
|
||||
return comparison_operator (op, mode) && ! equality_operator (op, mode);
|
||||
})
|
||||
|
||||
;; Return 1 if this is a LT, GE, LTU, or GEU operator.
|
||||
|
||||
(define_predicate "xstormy16_ineqsi_operator"
|
||||
(match_code "lt,ge,ltu,geu")
|
||||
{
|
||||
enum rtx_code code = GET_CODE (op);
|
||||
|
||||
return ((mode == VOIDmode || GET_MODE (op) == mode)
|
||||
&& (code == LT || code == GE || code == LTU || code == GEU));
|
||||
})
|
||||
|
||||
;; Predicate for MEMs that can use special 8-bit addressing.
|
||||
|
||||
(define_predicate "xstormy16_below100_operand"
|
||||
(match_code "mem")
|
||||
{
|
||||
if (GET_MODE (op) != mode)
|
||||
return 0;
|
||||
if (GET_CODE (op) == MEM)
|
||||
op = XEXP (op, 0);
|
||||
else if (GET_CODE (op) == SUBREG
|
||||
&& GET_CODE (XEXP (op, 0)) == MEM
|
||||
&& !MEM_VOLATILE_P (XEXP (op, 0)))
|
||||
op = XEXP (XEXP (op, 0), 0);
|
||||
else
|
||||
return 0;
|
||||
if (GET_CODE (op) == CONST_INT)
|
||||
{
|
||||
HOST_WIDE_INT i = INTVAL (op);
|
||||
return (i >= 0x7f00 && i < 0x7fff);
|
||||
}
|
||||
return xstormy16_below100_symbol (op, HImode);
|
||||
})
|
||||
|
||||
;; TODO: Add a comment here.
|
||||
|
||||
(define_predicate "xstormy16_below100_or_register"
|
||||
(match_code "mem,reg,subreg")
|
||||
{
|
||||
return (xstormy16_below100_operand (op, mode)
|
||||
|| register_operand (op, mode));
|
||||
})
|
||||
|
||||
;; TODO: Add a comment here.
|
||||
|
||||
(define_predicate "xstormy16_splittable_below100_or_register"
|
||||
(match_code "mem,reg,subreg")
|
||||
{
|
||||
if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
|
||||
return 0;
|
||||
return (xstormy16_below100_operand (op, mode)
|
||||
|| register_operand (op, mode));
|
||||
})
|
||||
|
||||
;; Predicate for constants with exactly one bit not set.
|
||||
|
||||
(define_predicate "xstormy16_onebit_clr_operand"
|
||||
(match_code "const_int")
|
||||
{
|
||||
HOST_WIDE_INT i;
|
||||
if (GET_CODE (op) != CONST_INT)
|
||||
return 0;
|
||||
i = ~ INTVAL (op);
|
||||
if (mode == QImode)
|
||||
i &= 0xff;
|
||||
if (mode == HImode)
|
||||
i &= 0xffff;
|
||||
return exact_log2 (i) != -1;
|
||||
})
|
||||
|
||||
;; Predicate for constants with exactly one bit set.
|
||||
|
||||
(define_predicate "xstormy16_onebit_set_operand"
|
||||
(match_code "const_int")
|
||||
{
|
||||
HOST_WIDE_INT i;
|
||||
if (GET_CODE (op) != CONST_INT)
|
||||
return 0;
|
||||
i = INTVAL (op);
|
||||
if (mode == QImode)
|
||||
i &= 0xff;
|
||||
if (mode == HImode)
|
||||
i &= 0xffff;
|
||||
return exact_log2 (i) != -1;
|
||||
})
|
||||
|
||||
;; TODO: Add a comment here.
|
||||
|
||||
(define_predicate "nonimmediate_nonstack_operand"
|
||||
(match_code "reg,mem,subreg")
|
||||
{
|
||||
/* 'Q' is for pushes, 'R' for pops. */
|
||||
return (nonimmediate_operand (op, mode)
|
||||
&& ! xstormy16_extra_constraint_p (op, 'Q')
|
||||
&& ! xstormy16_extra_constraint_p (op, 'R'));
|
||||
})
|
|
@ -68,9 +68,6 @@ extern void xstormy16_expand_andqi3 (rtx *);
|
|||
#endif
|
||||
|
||||
#if defined (HAVE_MACHINE_MODES) && defined (RTX_CODE)
|
||||
extern int xstormy16_ineqsi_operator (rtx, enum machine_mode);
|
||||
extern int equality_operator (rtx, enum machine_mode);
|
||||
extern int inequality_operator (rtx, enum machine_mode);
|
||||
extern void xstormy16_split_cbranch (enum machine_mode, rtx, rtx, rtx, rtx);
|
||||
extern int short_memory_operand (rtx, enum machine_mode);
|
||||
extern int nonimmediate_nonstack_operand (rtx, enum machine_mode);
|
||||
|
@ -85,15 +82,9 @@ extern void xstormy16_split_move (enum machine_mode, rtx, rtx);
|
|||
extern void xstormy16_expand_move (enum machine_mode, rtx, rtx);
|
||||
extern void xstormy16_expand_arith (enum machine_mode, enum rtx_code,
|
||||
rtx, rtx, rtx, rtx);
|
||||
extern int shift_operator (rtx, enum machine_mode);
|
||||
extern const char * xstormy16_output_shift (enum machine_mode, enum rtx_code,
|
||||
rtx, rtx, rtx);
|
||||
extern int xstormy16_below100_symbol (rtx, enum machine_mode);
|
||||
extern int xstormy16_below100_operand (rtx, enum machine_mode);
|
||||
extern int xstormy16_splittable_below100_operand (rtx, enum machine_mode);
|
||||
extern int xstormy16_below100_or_register (rtx, enum machine_mode);
|
||||
extern int xstormy16_splittable_below100_or_register (rtx, enum machine_mode);
|
||||
extern int xstormy16_onebit_set_operand (rtx, enum machine_mode);
|
||||
extern int xstormy16_onebit_clr_operand (rtx, enum machine_mode);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -65,34 +65,6 @@ static bool xstormy16_return_in_memory (tree, tree);
|
|||
struct rtx_def * xstormy16_compare_op0;
|
||||
struct rtx_def * xstormy16_compare_op1;
|
||||
|
||||
/* Return 1 if this is a LT, GE, LTU, or GEU operator. */
|
||||
|
||||
int
|
||||
xstormy16_ineqsi_operator (register rtx op, enum machine_mode mode)
|
||||
{
|
||||
enum rtx_code code = GET_CODE (op);
|
||||
|
||||
return ((mode == VOIDmode || GET_MODE (op) == mode)
|
||||
&& (code == LT || code == GE || code == LTU || code == GEU));
|
||||
}
|
||||
|
||||
/* Return 1 if this is an EQ or NE operator. */
|
||||
|
||||
int
|
||||
equality_operator (register rtx op, enum machine_mode mode)
|
||||
{
|
||||
return ((mode == VOIDmode || GET_MODE (op) == mode)
|
||||
&& (GET_CODE (op) == EQ || GET_CODE (op) == NE));
|
||||
}
|
||||
|
||||
/* Return 1 if this is a comparison operator but not an EQ or NE operator. */
|
||||
|
||||
int
|
||||
inequality_operator (register rtx op, enum machine_mode mode)
|
||||
{
|
||||
return comparison_operator (op, mode) && ! equality_operator (op, mode);
|
||||
}
|
||||
|
||||
/* Compute a (partial) cost for rtx X. Return true if the complete
|
||||
cost has been computed, and false if subexpressions should be
|
||||
scanned. In either case, *TOTAL contains the cost result. */
|
||||
|
@ -576,28 +548,6 @@ xstormy16_below100_symbol (rtx x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Predicate for MEMs that can use special 8-bit addressing. */
|
||||
int
|
||||
xstormy16_below100_operand (rtx x, enum machine_mode mode)
|
||||
{
|
||||
if (GET_MODE (x) != mode)
|
||||
return 0;
|
||||
if (GET_CODE (x) == MEM)
|
||||
x = XEXP (x, 0);
|
||||
else if (GET_CODE (x) == SUBREG
|
||||
&& GET_CODE (XEXP (x, 0)) == MEM
|
||||
&& !MEM_VOLATILE_P (XEXP (x, 0)))
|
||||
x = XEXP (XEXP (x, 0), 0);
|
||||
else
|
||||
return 0;
|
||||
if (GET_CODE (x) == CONST_INT)
|
||||
{
|
||||
HOST_WIDE_INT i = INTVAL (x);
|
||||
return (i >= 0x7f00 && i < 0x7fff);
|
||||
}
|
||||
return xstormy16_below100_symbol (x, HImode);
|
||||
}
|
||||
|
||||
/* Likewise, but only for non-volatile MEMs, for patterns where the
|
||||
MEM will get split into smaller sized accesses. */
|
||||
int
|
||||
|
@ -608,52 +558,6 @@ xstormy16_splittable_below100_operand (rtx x, enum machine_mode mode)
|
|||
return xstormy16_below100_operand (x, mode);
|
||||
}
|
||||
|
||||
int
|
||||
xstormy16_below100_or_register (rtx x, enum machine_mode mode)
|
||||
{
|
||||
return (xstormy16_below100_operand (x, mode)
|
||||
|| register_operand (x, mode));
|
||||
}
|
||||
|
||||
int
|
||||
xstormy16_splittable_below100_or_register (rtx x, enum machine_mode mode)
|
||||
{
|
||||
if (GET_CODE (x) == MEM && MEM_VOLATILE_P (x))
|
||||
return 0;
|
||||
return (xstormy16_below100_operand (x, mode)
|
||||
|| register_operand (x, mode));
|
||||
}
|
||||
|
||||
/* Predicate for constants with exactly one bit set. */
|
||||
int
|
||||
xstormy16_onebit_set_operand (rtx x, enum machine_mode mode)
|
||||
{
|
||||
HOST_WIDE_INT i;
|
||||
if (GET_CODE (x) != CONST_INT)
|
||||
return 0;
|
||||
i = INTVAL (x);
|
||||
if (mode == QImode)
|
||||
i &= 0xff;
|
||||
if (mode == HImode)
|
||||
i &= 0xffff;
|
||||
return exact_log2 (i) != -1;
|
||||
}
|
||||
|
||||
/* Predicate for constants with exactly one bit not set. */
|
||||
int
|
||||
xstormy16_onebit_clr_operand (rtx x, enum machine_mode mode)
|
||||
{
|
||||
HOST_WIDE_INT i;
|
||||
if (GET_CODE (x) != CONST_INT)
|
||||
return 0;
|
||||
i = ~ INTVAL (x);
|
||||
if (mode == QImode)
|
||||
i &= 0xff;
|
||||
if (mode == HImode)
|
||||
i &= 0xffff;
|
||||
return exact_log2 (i) != -1;
|
||||
}
|
||||
|
||||
/* Expand an 8-bit IOR. This either detects the one case we can
|
||||
actually do, or uses a 16-bit IOR. */
|
||||
void
|
||||
|
@ -875,15 +779,6 @@ short_memory_operand (rtx x, enum machine_mode mode)
|
|||
return (GET_CODE (XEXP (x, 0)) != PLUS);
|
||||
}
|
||||
|
||||
int
|
||||
nonimmediate_nonstack_operand (rtx op, enum machine_mode mode)
|
||||
{
|
||||
/* 'Q' is for pushes, 'R' for pops. */
|
||||
return (nonimmediate_operand (op, mode)
|
||||
&& ! xstormy16_extra_constraint_p (op, 'Q')
|
||||
&& ! xstormy16_extra_constraint_p (op, 'R'));
|
||||
}
|
||||
|
||||
/* Splitter for the 'move' patterns, for modes not directly implemented
|
||||
by hardware. Emit insns to copy a value of mode MODE from SRC to
|
||||
DEST.
|
||||
|
@ -2238,18 +2133,6 @@ xstormy16_expand_arith (enum machine_mode mode, enum rtx_code code,
|
|||
emit (gen_nop ());
|
||||
}
|
||||
|
||||
/* Return 1 if OP is a shift operator. */
|
||||
|
||||
int
|
||||
shift_operator (register rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
enum rtx_code code = GET_CODE (op);
|
||||
|
||||
return (code == ASHIFT
|
||||
|| code == ASHIFTRT
|
||||
|| code == LSHIFTRT);
|
||||
}
|
||||
|
||||
/* The shift operations are split at output time for constant values;
|
||||
variable-width shifts get handed off to a library routine.
|
||||
|
||||
|
|
|
@ -810,18 +810,6 @@ do { \
|
|||
|
||||
/* Miscellaneous Parameters. */
|
||||
|
||||
#define PREDICATE_CODES \
|
||||
{"shift_operator", {ASHIFT, ASHIFTRT, LSHIFTRT }}, \
|
||||
{"equality_operator", {EQ, NE }}, \
|
||||
{"inequality_operator", {GE, GT, LE, LT, GEU, GTU, LEU, LTU }}, \
|
||||
{"xstormy16_ineqsi_operator", {LT, GE, LTU, GEU }}, \
|
||||
{"xstormy16_below100_operand", {MEM }}, \
|
||||
{"xstormy16_below100_or_register", {MEM, REG, SUBREG }}, \
|
||||
{"xstormy16_splittable_below100_or_register", {MEM, REG, SUBREG }}, \
|
||||
{"xstormy16_onebit_clr_operand", {CONST_INT }}, \
|
||||
{"xstormy16_onebit_set_operand", {CONST_INT }}, \
|
||||
{"nonimmediate_nonstack_operand", {REG, MEM, SUBREG }},
|
||||
|
||||
#define CASE_VECTOR_MODE SImode
|
||||
|
||||
#define WORD_REGISTER_OPERATIONS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;; XSTORMY16 Machine description template
|
||||
;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004
|
||||
;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
|
||||
;; Free Software Foundation, Inc.
|
||||
;; Contributed by Red Hat, Inc.
|
||||
|
||||
|
@ -91,6 +91,7 @@
|
|||
(define_asm_attributes [(set_attr "length" "4")
|
||||
(set_attr "psw_operand" "clobber")])
|
||||
|
||||
(include "predicates.md")
|
||||
|
||||
;; ::::::::::::::::::::
|
||||
;; ::
|
||||
|
|
Loading…
Add table
Reference in a new issue