diff options
Diffstat (limited to 'gcc/config/sh/sh.c')
| -rw-r--r-- | gcc/config/sh/sh.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 81c7872..a9cafec 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -1,6 +1,6 @@ /* Output routines for GCC for Renesas / SuperH SH. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Steve Chamberlain (sac@cygnus.com). Improved by Jim Wilson (wilson@cygnus.com). @@ -976,35 +976,38 @@ print_operand (FILE *stream, rtx x, int code) case CONST: if (TARGET_SHMEDIA - && GET_CODE (XEXP (x, 0)) == SIGN_EXTEND + && (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND + || GET_CODE (XEXP (x, 0)) == ZERO_EXTEND) && (GET_MODE (XEXP (x, 0)) == DImode || GET_MODE (XEXP (x, 0)) == SImode) && GET_CODE (XEXP (XEXP (x, 0), 0)) == TRUNCATE && GET_MODE (XEXP (XEXP (x, 0), 0)) == HImode) { rtx val = XEXP (XEXP (XEXP (x, 0), 0), 0); + rtx val2 = val; + bool nested_expr = false; fputc ('(', stream); if (GET_CODE (val) == ASHIFTRT) { fputc ('(', stream); - if (GET_CODE (XEXP (val, 0)) == CONST) - fputc ('(', stream); - output_addr_const (stream, XEXP (val, 0)); - if (GET_CODE (XEXP (val, 0)) == CONST) - fputc (')', stream); + val2 = XEXP (val, 0); + } + if (GET_CODE (val2) == CONST + || GET_RTX_CLASS (GET_CODE (val2)) != RTX_OBJ) + { + fputc ('(', stream); + nested_expr = true; + } + output_addr_const (stream, val2); + if (nested_expr) + fputc (')', stream); + if (GET_CODE (val) == ASHIFTRT) + { fputs (" >> ", stream); output_addr_const (stream, XEXP (val, 1)); fputc (')', stream); } - else - { - if (GET_CODE (val) == CONST) - fputc ('(', stream); - output_addr_const (stream, val); - if (GET_CODE (val) == CONST) - fputc (')', stream); - } fputs (" & 65535)", stream); break; } @@ -1971,12 +1974,12 @@ andcosts (rtx x) if (TARGET_SHMEDIA) { - if ((GET_CODE (XEXP (x, 1)) == CONST_INT - && CONST_OK_FOR_I16 (INTVAL (XEXP (x, 1)))) - || EXTRA_CONSTRAINT_C16 (XEXP (x, 1))) + if (GET_CODE (XEXP (x, 1)) == CONST_INT + && (CONST_OK_FOR_I10 (INTVAL (XEXP (x, 1))) + || CONST_OK_FOR_J16 (INTVAL (XEXP (x, 1))))) return 1; else - return 2; + return 1 + rtx_cost (XEXP (x, 1), AND); } /* These constants are single cycle extu.[bw] instructions. */ @@ -2096,9 +2099,9 @@ sh_rtx_costs (rtx x, int code, int outer_code, int *total) else if (CONST_OK_FOR_I16 (INTVAL (x) >> 16)) *total = COSTS_N_INSNS ((outer_code != SET) + 1); else if (CONST_OK_FOR_I16 ((INTVAL (x) >> 16) >> 16)) - *total = COSTS_N_INSNS (3); + *total = COSTS_N_INSNS ((outer_code != SET) + 2); else - *total = COSTS_N_INSNS (4); + *total = COSTS_N_INSNS ((outer_code != SET) + 3); return true; } if (CONST_OK_FOR_I08 (INTVAL (x))) |
