[mips] Change the definition of macro SHIFT_COUNT_TRUNCATED
Richard Sandiford
rdsandiford@googlemail.com
Thu Sep 2 18:32:00 GMT 2010
Mingjie Xing <mingjie.xing@gmail.com> writes:
> * config/mips/mips.h (SHIFT_COUNT_TRUNCATED): Change the definition.
> * config/mips/mips.c (mips_shift_truncation_mask): Implement
> TARGET_SHIFT_TRUNCATION_MASK.
I think a more canonical version would be:
* config/mips/mips.h (SHIFT_COUNT_TRUNCATED): Change the definition.
* config/mips/mips.c (mips_shift_truncation_mask): New function.
(TARGET_SHIFT_TRUNCATION_MASK): Define.
> Index: config/mips/mips.c
> ===================================================================
> --- config/mips/mips.c (revision 163495)
> +++ config/mips/mips.c (working copy)
> @@ -16335,6 +16335,20 @@ void mips_function_profiler (FILE *file)
> fprintf (file, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM],
> reg_names[2]);
> }
> +
> +/* Implement TARGET_SHIFT_TRUNCATION_MASK. We want to keep the current
> + behaviour of TARGET_SHIFT_TRUNCATION_MASK for non-vector modes even
> + when TARGET_LOONGSON_2EF is true. */
s/current/default/, since we're writing this for future readers.
Coding style says there should be two spaces after each sentence, so:
/* Implement TARGET_SHIFT_TRUNCATION_MASK. We want to keep the default
behaviour of TARGET_SHIFT_TRUNCATION_MASK for non-vector modes even
when TARGET_LOONGSON_2EF is true. */
> /* Define this to be nonzero if shift instructions ignore all but the low-order
> few bits. */
> -#define SHIFT_COUNT_TRUNCATED 1
> +#define SHIFT_COUNT_TRUNCATED (TARGET_LOONGSON_2EF ? 0 : 1)
(!TARGET_LOONGSON_2EF)
Please also document why we're doing this. Let's do that by removing
the current "Define this..." comment -- it's useless boilerplate --
and replacing it with:
/* Standard MIPS integer shifts truncate the shift amount to the
width of the shifted operand. However, Loongson vector shifts
do not truncate the shift amount at all. */
OK with those changes, thanks.
Richard
More information about the Gcc-patches
mailing list