Commit 6e3a343d by Nick Clifton Committed by Nick Clifton

predicates.md (mcore_general_movesrc_operand): Accept CONSTs.

* config/mcore/predicates.md (mcore_general_movesrc_operand): Accept CONSTs.
  (mcore_general_movdst_operand): Do not accept CONST_INTs.
  (mcore_arith_K_S_operand): Run the test for the S constraint not the test for the M constraint.
  (mcore_addsub_operand): Do not accept integer values that are larger than 32 bits.
* config/mcore/mcore.md: Remove unused constraints from split.
  (andsi3): Use HOST_WIDE_INT instead of int to hold an INTVAL.
  (addsi3): Likewise.
  (allocate_stack): Likewise.
* config/mcore/mcore.c (mcore_print_operand): Restrict output of P operands to 32 bits.
  (mcore_const_costs): Use HOST_WIDE_INT instead of int to hold an INTVAL.
  (mcore_and_cost, mcore_modify_comparison, const_ok_for_mcore,
   mcore_const_ok_for_inline, mcore_const_trick_uses_not,
   try_constant_tricks, mcore_num_ones, mcore_num_zeros,
   mcore_output_bclri, mcore_output_andn, output_inline_const,
   mcore_output_move, mcore_output_movedouble): Likewise.
  (mcore_output_cmov): Use CONST_OK_FOR_M and CONST_OK_FOR_N.
  (output_inline_const): Likewise.
  (output_inline_const): Fix format strings used in sprintf statements.
* config/mcore/mcore-protos.h: Update prototypes for changed functions in mcore.c.
* config/mcore/mcore.h (CONST_OK_FOR_I): Cast values to HOST_WIDE_INT and not int.
  (CONST_OK_FOR_J, CONST_OK_FOR_K, CONST_OK_FOR_L, CONST_OK_FOR_M,
   CONST_OK_FOR_N): Likewise.
  (LEGITIMATE_CONSTANT_P): Also check CONSTANT_P.
  (GO_IF_LEGITIMATE_INDEX): Use HOST_WIDE_INT instead of int to hold an INTVAL.

From-SVN: r120669
parent 4d499824
2007-01-11 Nick Clifton <nickc@redhat.com>
* config/mcore/predicates.md (mcore_general_movesrc_operand):
Accept CONSTs.
(mcore_general_movdst_operand): Do not accept CONST_INTs.
(mcore_arith_K_S_operand): Run the test for the S constraint not
the test for the M constraint.
(mcore_addsub_operand): Do not accept integer values that are
larger than 32 bits.
* config/mcore/mcore.md: Remove unused constraints from split.
(andsi3): Use HOST_WIDE_INT instead of int to hold an INTVAL.
(addsi3): Likewise.
(allocate_stack): Likewise.
* config/mcore/mcore.c (mcore_print_operand): Restrict output of P
operands to 32 bits.
(mcore_const_costs): Use HOST_WIDE_INT instead of int to hold an
INTVAL.
(mcore_and_cost, mcore_modify_comparison, const_ok_for_mcore,
mcore_const_ok_for_inline, mcore_const_trick_uses_not,
try_constant_tricks, mcore_num_ones, mcore_num_zeros,
mcore_output_bclri, mcore_output_andn, output_inline_const,
mcore_output_move, mcore_output_movedouble): Likewise.
(mcore_output_cmov): Use CONST_OK_FOR_M and CONST_OK_FOR_N.
(output_inline_const): Likewise.
(output_inline_const): Fix format strings used in sprintf
statements.
* config/mcore/mcore-protos.h: Update prototypes for changed
functions in mcore.c.
* config/mcore/mcore.h (CONST_OK_FOR_I): Cast values to
HOST_WIDE_INT and not int.
(CONST_OK_FOR_J, CONST_OK_FOR_K, CONST_OK_FOR_L, CONST_OK_FOR_M,
CONST_OK_FOR_N): Likewise.
(LEGITIMATE_CONSTANT_P): Also check CONSTANT_P.
(GO_IF_LEGITIMATE_INDEX): Use HOST_WIDE_INT instead of int to hold
an INTVAL.
2007-01-10 Jan Hubicka <jh@suse.cz>
* tree-vrp.c (remove_range_assertions): Release defs.
......
/* Prototypes for exported functions defined in mcore.c
Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
Contributed by Nick Clifton (nickc@redhat.com)
This file is part of GCC.
......@@ -22,13 +22,13 @@
extern const char * mcore_output_jump_label_table (void);
extern void mcore_expand_prolog (void);
extern void mcore_expand_epilog (void);
extern int mcore_const_ok_for_inline (long);
extern int mcore_num_ones (int);
extern int mcore_num_zeros (int);
extern int mcore_const_ok_for_inline (HOST_WIDE_INT);
extern int mcore_num_ones (HOST_WIDE_INT);
extern int mcore_num_zeros (HOST_WIDE_INT);
extern int mcore_initial_elimination_offset (int, int);
extern int mcore_byte_offset (unsigned int);
extern int mcore_halfword_offset (unsigned int);
extern int mcore_const_trick_uses_not (long);
extern int mcore_const_trick_uses_not (HOST_WIDE_INT);
extern void mcore_override_options (void);
extern int mcore_dllexport_name_p (const char *);
extern int mcore_dllimport_name_p (const char *);
......@@ -71,7 +71,7 @@ extern int mcore_arith_S_operand (rtx);
#ifdef HAVE_MACHINE_MODES
extern const char * mcore_output_move (rtx, rtx *, enum machine_mode);
extern const char * mcore_output_movedouble (rtx *, enum machine_mode);
extern int const_ok_for_mcore (int);
extern int const_ok_for_mcore (HOST_WIDE_INT);
#ifdef TREE_CODE
extern rtx mcore_function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int);
#endif /* TREE_CODE */
......
/* Definitions of target machine for GNU compiler,
for Motorola M*CORE Processor.
Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -452,17 +452,17 @@ extern const enum reg_class reg_class_from_letter[];
U: constant 0
xxxS: 1 cleared bit out of 32 (complement of power of 2). for bclri
xxxT: 2 cleared bits out of 32. for pairs of bclris. */
#define CONST_OK_FOR_I(VALUE) (((int)(VALUE)) >= 0 && ((int)(VALUE)) <= 0x7f)
#define CONST_OK_FOR_J(VALUE) (((int)(VALUE)) > 0 && ((int)(VALUE)) <= 32)
#define CONST_OK_FOR_L(VALUE) (((int)(VALUE)) < 0 && ((int)(VALUE)) >= -32)
#define CONST_OK_FOR_K(VALUE) (((int)(VALUE)) >= 0 && ((int)(VALUE)) <= 31)
#define CONST_OK_FOR_M(VALUE) (exact_log2 (VALUE) >= 0)
#define CONST_OK_FOR_N(VALUE) (((int)(VALUE)) == -1 || exact_log2 ((VALUE) + 1) >= 0)
#define CONST_OK_FOR_I(VALUE) (((HOST_WIDE_INT)(VALUE)) >= 0 && ((HOST_WIDE_INT)(VALUE)) <= 0x7f)
#define CONST_OK_FOR_J(VALUE) (((HOST_WIDE_INT)(VALUE)) > 0 && ((HOST_WIDE_INT)(VALUE)) <= 32)
#define CONST_OK_FOR_L(VALUE) (((HOST_WIDE_INT)(VALUE)) < 0 && ((HOST_WIDE_INT)(VALUE)) >= -32)
#define CONST_OK_FOR_K(VALUE) (((HOST_WIDE_INT)(VALUE)) >= 0 && ((HOST_WIDE_INT)(VALUE)) <= 31)
#define CONST_OK_FOR_M(VALUE) (exact_log2 (VALUE) >= 0 && exact_log2 (VALUE) <= 30)
#define CONST_OK_FOR_N(VALUE) (((HOST_WIDE_INT)(VALUE)) == -1 || (exact_log2 ((VALUE) + 1) >= 0 && exact_log2 ((VALUE) + 1) <= 30))
#define CONST_OK_FOR_O(VALUE) (CONST_OK_FOR_I(VALUE) || \
CONST_OK_FOR_M(VALUE) || \
CONST_OK_FOR_N(VALUE) || \
CONST_OK_FOR_M((int)(VALUE) - 1) || \
CONST_OK_FOR_N((int)(VALUE) + 1))
CONST_OK_FOR_M((HOST_WIDE_INT)(VALUE) - 1) || \
CONST_OK_FOR_N((HOST_WIDE_INT)(VALUE) + 1))
#define CONST_OK_FOR_P(VALUE) (mcore_const_ok_for_inline (VALUE))
......@@ -698,7 +698,8 @@ extern const enum reg_class reg_class_from_letter[];
It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
On the MCore, allow anything but a double. */
#define LEGITIMATE_CONSTANT_P(X) (GET_CODE(X) != CONST_DOUBLE)
#define LEGITIMATE_CONSTANT_P(X) (GET_CODE(X) != CONST_DOUBLE \
&& CONSTANT_P (X))
/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
and check its validity for a certain class.
......@@ -755,15 +756,15 @@ extern const enum reg_class reg_class_from_letter[];
if (GET_CODE (OP) == CONST_INT) \
{ \
if (GET_MODE_SIZE (MODE) >= 4 \
&& (((unsigned)INTVAL (OP)) % 4) == 0 \
&& ((unsigned)INTVAL (OP)) <= 64 - GET_MODE_SIZE (MODE)) \
&& (((unsigned HOST_WIDE_INT) INTVAL (OP)) % 4) == 0 \
&& ((unsigned HOST_WIDE_INT) INTVAL (OP)) <= 64 - GET_MODE_SIZE (MODE)) \
goto LABEL; \
if (GET_MODE_SIZE (MODE) == 2 \
&& (((unsigned)INTVAL (OP)) % 2) == 0 \
&& ((unsigned)INTVAL (OP)) <= 30) \
&& (((unsigned HOST_WIDE_INT) INTVAL (OP)) % 2) == 0 \
&& ((unsigned HOST_WIDE_INT) INTVAL (OP)) <= 30) \
goto LABEL; \
if (GET_MODE_SIZE (MODE) == 1 \
&& ((unsigned)INTVAL (OP)) <= 15) \
&& ((unsigned HOST_WIDE_INT) INTVAL (OP)) <= 15) \
goto LABEL; \
} \
} \
......@@ -853,7 +854,7 @@ extern const enum reg_class reg_class_from_letter[];
#define DATA_SECTION_ASM_OP "\t.data"
/* Switch into a generic section. */
#undef TARGET_ASM_NAMED_SECTION
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION mcore_asm_named_section
/* This is how to output an insn to push a register on the stack.
......
;; Machine description the Motorola MCore
;; Copyright (C) 1993, 1999, 2000, 2004, 2005
;; Copyright (C) 1993, 1999, 2000, 2004, 2005, 2007
;; Free Software Foundation, Inc.
;; Contributed by Motorola.
......@@ -192,11 +192,11 @@
(define_split
[(parallel[
(set (reg:CC 17)
(ne:CC (ne:SI (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
(match_operand:SI 1 "mcore_arith_reg_operand" "r"))
(ne:CC (ne:SI (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "")
(match_operand:SI 1 "mcore_arith_reg_operand" ""))
(const_int 0))
(const_int 0)))
(clobber (match_operand:CC 2 "mcore_arith_reg_operand" "=r"))])]
(clobber (match_operand:CC 2 "mcore_arith_reg_operand" ""))])]
""
[(set (reg:CC 17) (ne:SI (match_dup 0) (const_int 0)))
(set (reg:CC 17) (leu:CC (match_dup 0) (match_dup 1)))])
......@@ -355,7 +355,8 @@
if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0
&& ! mcore_arith_S_operand (operands[2]))
{
int not_value = ~ INTVAL (operands[2]);
HOST_WIDE_INT not_value = ~ INTVAL (operands[2]);
if ( CONST_OK_FOR_I (not_value)
|| CONST_OK_FOR_M (not_value)
|| CONST_OK_FOR_N (not_value))
......@@ -730,9 +731,11 @@
/* Convert adds to subtracts if this makes loading the constant cheaper.
But only if we are allowed to generate new pseudos. */
if (! (reload_in_progress || reload_completed)
&& GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < -32)
&& GET_CODE (operands[2]) == CONST_INT
&& INTVAL (operands[2]) < -32)
{
int neg_value = - INTVAL (operands[2]);
HOST_WIDE_INT neg_value = - INTVAL (operands[2]);
if ( CONST_OK_FOR_I (neg_value)
|| CONST_OK_FOR_M (neg_value)
|| CONST_OK_FOR_N (neg_value))
......@@ -764,7 +767,7 @@
;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
;; "*
;; {
;; int n = INTVAL(operands[2]);
;; HOST_WIDE_INT n = INTVAL(operands[2]);
;; if (n > 0)
;; {
;; operands[2] = GEN_INT(n - 32);
......@@ -822,7 +825,7 @@
;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
;; "*
;; {
;; int n = INTVAL(operands[2]);
;; HOST_WIDE_INT n = INTVAL(operands[2]);
;; if ( n > 0)
;; {
;; operands[2] = GEN_INT( n - 32);
......@@ -2976,8 +2979,9 @@
(match_operand:SI 1 "const_int_operand" ""))
(set (match_operand:SI 2 "mcore_arith_reg_operand" "")
(ior:SI (match_dup 2) (match_dup 0)))]
"TARGET_HARDLIT && mcore_num_ones (INTVAL (operands[1])) == 2 &&
mcore_is_dead (insn, operands[0])"
"TARGET_HARDLIT
&& mcore_num_ones (INTVAL (operands[1])) == 2
&& mcore_is_dead (insn, operands[0])"
"* return mcore_output_bseti (operands[2], INTVAL (operands[1]));")
(define_peephole
......@@ -3276,7 +3280,7 @@
if (GET_CODE (operands[1]) == CONST_INT
&& INTVAL (operands[1]) < 8 * STACK_UNITS_MAXSTEP)
{
int left = INTVAL(operands[1]);
HOST_WIDE_INT left = INTVAL(operands[1]);
/* If it's a long way, get close enough for a last shot. */
if (left >= STACK_UNITS_MAXSTEP)
......@@ -3295,7 +3299,7 @@
while (left > STACK_UNITS_MAXSTEP);
}
/* Perform the final adjustment. */
emit_insn (gen_addsi3 (stack_pointer_rtx,stack_pointer_rtx,GEN_INT(-left)));
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-left)));
;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
DONE;
}
......@@ -3309,7 +3313,7 @@
#if 1
emit_insn (gen_movsi (tmp, operands[1]));
emit_insn (gen_movsi (step, GEN_INT(STACK_UNITS_MAXSTEP)));
emit_insn (gen_movsi (step, GEN_INT (STACK_UNITS_MAXSTEP)));
if (GET_CODE (operands[1]) != CONST_INT)
{
......
;; Predicate definitions for Motorola MCore.
;; Copyright (C) 2005 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
......@@ -38,7 +38,7 @@
;; Nonzero if OP can be source of a simple move operation.
(define_predicate "mcore_general_movsrc_operand"
(match_code "mem,const_int,reg,subreg,symbol_ref,label_ref")
(match_code "mem,const_int,reg,subreg,symbol_ref,label_ref,const")
{
/* Any (MEM LABEL_REF) is OK. That is a pc-relative load. */
if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == LABEL_REF)
......@@ -50,7 +50,7 @@
;; Nonzero if OP can be destination of a simple move operation.
(define_predicate "mcore_general_movdst_operand"
(match_code "mem,const_int,reg,subreg")
(match_code "mem,reg,subreg")
{
if (GET_CODE (op) == REG && REGNO (op) == CC_REG)
return 0;
......@@ -141,7 +141,7 @@
if (GET_CODE (op) == CONST_INT)
{
if (CONST_OK_FOR_K (INTVAL (op)) || CONST_OK_FOR_M (~INTVAL (op)))
if (CONST_OK_FOR_K (INTVAL (op)) || (mcore_num_zeros (INTVAL (op)) <= 2))
return 1;
}
......@@ -212,18 +212,24 @@
if (GET_CODE (op) == CONST_INT)
{
return 1;
/* The following is removed because it precludes large constants from being
/* The following has been removed because it precludes large constants from being
returned as valid source operands for and add/sub insn. While large
constants may not directly be used in an add/sub, they may if first loaded
into a register. Thus, this predicate should indicate that they are valid,
and the constraint in mcore.md should control whether an additional load to
register is needed. (see mcore.md, addsi). -- DAC 4/2/1998 */
/*
if (CONST_OK_FOR_J(INTVAL(op)) || CONST_OK_FOR_L(INTVAL(op)))
return 1;
*/
register is needed. (see mcore.md, addsi). -- DAC 4/2/1998
if (CONST_OK_FOR_J (INTVAL (op)) || CONST_OK_FOR_L (INTVAL (op)))
return 1;
However we do still need to check to make sure that the constant is not too
big, especially if we are running on a 64-bit OS... Nickc 8/1/07. */
if (trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
return 0;
return 1;
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment