diff options
author | Michael Hayes <m.hayes@elec.canterbury.ac.nz> | 1999-04-17 22:27:41 +0000 |
---|---|---|
committer | Michael Hayes <m.hayes@gcc.gnu.org> | 1999-04-17 22:27:41 +0000 |
commit | 87ba694401df1d06dda4b8c14b50528a740eef6d (patch) | |
tree | 32f706527865c786d8a46ebcdc8fb6e0dbf9ae89 | |
parent | 695ab36a1f65a94647cb24e61772af444b8f51d9 (diff) | |
download | gcc-87ba694401df1d06dda4b8c14b50528a740eef6d.zip gcc-87ba694401df1d06dda4b8c14b50528a740eef6d.tar.gz gcc-87ba694401df1d06dda4b8c14b50528a740eef6d.tar.bz2 |
c4x.c (legitimize_operands): Use rtx_cost to determine if it is worthwhile forcing a constant into a register.
* config/c4x/c4x.c (legitimize_operands): Use rtx_cost
to determine if it is worthwhile forcing a constant into a register.
* config/c4x/c4x.h (CONST_COSTS): An integer value of 255 or 65535
used with a logical and or an integer value of 16 or 24 used with
a right shift has zero cost on the C40.
From-SVN: r26529
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/c4x/c4x.c | 22 | ||||
-rw-r--r-- | gcc/config/c4x/c4x.h | 18 |
3 files changed, 38 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ae98a6..9411c20 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Sun Apr 18 17:24:10 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz> + + * config/c4x/c4x.c (legitimize_operands): Use rtx_cost + to determine if it is worthwhile forcing a constant into a register. + * config/c4x/c4x.h (CONST_COSTS): An integer value of 255 or 65535 + used with a logical and or an integer value of 16 or 24 used with + a right shift has zero cost on the C40. + Sat Apr 17 21:30:11 1999 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * gcse.c (compute_local_properties): If setp is nonzero, clear diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 0b84e02..5c5690a 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -3582,6 +3582,11 @@ c4x_valid_operands (code, operands, mode, force) /* Any valid memory operand screened by src_operand is OK. */ case MEM: +#if 0 + if (code2 != REG) + return 0; +#endif + break; /* After CSE, any remaining (ADDRESSOF:P reg) gets converted into a stack slot memory address comprising a PLUS and a @@ -3644,10 +3649,9 @@ legitimize_operands (code, operands, mode) if (! reload_in_progress && TARGET_HOIST && optimize > 0 - && ((GET_CODE (operands[1]) == CONST_INT - && ! c4x_J_constant (operands[1]) - && INTVAL (operands[1]) != 0) - || GET_CODE (operands[1]) == CONST_DOUBLE)) + && GET_CODE (operands[1]) == CONST_INT + && preserve_subexpressions_p () + && rtx_cost (operands[1], code) > 1) operands[1] = force_reg (mode, operands[1]); if (! reload_in_progress @@ -3661,11 +3665,11 @@ legitimize_operands (code, operands, mode) opportunities. */ if (! reload_in_progress && ! ((code == PLUS || code == MINUS) && mode == Pmode) - && (TARGET_HOIST && optimize > 1 - && ((GET_CODE (operands[2]) == CONST_INT - && ! c4x_J_constant (operands[2]) - && INTVAL (operands[2]) != 0) - || GET_CODE (operands[2]) == CONST_DOUBLE))) + && TARGET_HOIST + && optimize > 1 + && GET_CODE (operands[2]) == CONST_INT + && preserve_subexpressions_p () + && rtx_cost (operands[2], code) > 1) operands[2] = force_reg (mode, operands[2]); /* We can get better code on a C30 if we force constant shift counts diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 67ac4a0..1dc8d5c 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1763,7 +1763,13 @@ extern void c4x_encode_section_info (); Some small integers are effectively free for the C40. We should also consider if we are using the small memory model. With the big memory model we require an extra insn for a constant - loaded from memory. */ + loaded from memory. + + This is used by expand_binop to decide whether to force a constant + into a register. If the cost is greater than 2 and the constant + is used within a short loop, it gets forced into a register. + Ideally, there should be some weighting as to how mnay times it is used + within the loop. */ #define SHIFT_CODE_P(C) ((C) == ASHIFT || (C) == ASHIFTRT || (C) == LSHIFTRT) @@ -1776,6 +1782,16 @@ extern void c4x_encode_section_info (); case CONST_INT: \ if (c4x_J_constant (RTX)) \ return 0; \ + if (! TARGET_C3X \ + && OUTER_CODE == AND \ + && GET_CODE (RTX) == CONST_INT \ + && (INTVAL (RTX) == 255 || INTVAL (RTX) == 65535)) \ + return 0; \ + if (! TARGET_C3X \ + && (OUTER_CODE == ASHIFTRT || OUTER_CODE == LSHIFTRT) \ + && GET_CODE (RTX) == CONST_INT \ + && (INTVAL (RTX) == 16 || INTVAL (RTX) == 24)) \ + return 0; \ if (TARGET_C3X && SHIFT_CODE_P (OUTER_CODE)) \ return 3; \ if (LOGICAL_CODE_P (OUTER_CODE) \ |