aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authorMingjie Xing <mingjie.xing@gmail.com>2010-09-03 09:29:19 +0000
committerMingjie Xing <xmj@gcc.gnu.org>2010-09-03 09:29:19 +0000
commit4904231323789b7d5a0f6fa70fe7f55ee6fba109 (patch)
tree9e1bc64b5068f033b640c01b28e05460daa9b49b /gcc/config/mips
parente5ca969363516ec05db3357c22079d7fdcd70ccf (diff)
downloadgcc-4904231323789b7d5a0f6fa70fe7f55ee6fba109.zip
gcc-4904231323789b7d5a0f6fa70fe7f55ee6fba109.tar.gz
gcc-4904231323789b7d5a0f6fa70fe7f55ee6fba109.tar.bz2
Fix shift count truncate problem for loongson.
From-SVN: r163799
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips.c17
-rw-r--r--gcc/config/mips/mips.h7
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 052e805..3fe7f8b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16338,6 +16338,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 default
+ behaviour of TARGET_SHIFT_TRUNCATION_MASK for non-vector modes even
+ when TARGET_LOONGSON_2EF is true. */
+
+static unsigned HOST_WIDE_INT
+mips_shift_truncation_mask (enum machine_mode mode)
+{
+ if (TARGET_LOONGSON_2EF && VECTOR_MODE_P (mode))
+ return 0;
+
+ return GET_MODE_BITSIZE (mode) - 1;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -16546,6 +16560,9 @@ void mips_function_profiler (FILE *file)
#undef TARGET_ASM_OUTPUT_SOURCE_FILENAME
#define TARGET_ASM_OUTPUT_SOURCE_FILENAME mips_output_filename
+#undef TARGET_SHIFT_TRUNCATION_MASK
+#define TARGET_SHIFT_TRUNCATION_MASK mips_shift_truncation_mask
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-mips.h"
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 4dd86d4..74bf3d25 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2423,9 +2423,10 @@ typedef struct mips_args {
(often extended) would be needed for byte accesses. */
#define SLOW_BYTE_ACCESS (!TARGET_MIPS16)
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
+/* 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. */
+#define SHIFT_COUNT_TRUNCATED (!TARGET_LOONGSON_2EF)
/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
is done just by pretending it is already truncated. */