From e689b87000079f75748c0c105b869d22b3e6c9d4 Mon Sep 17 00:00:00 2001 From: David Ung Date: Thu, 26 May 2005 17:23:35 +0000 Subject: ext_ins.c: New test for testing the generation of MIPS32/64 rev 2 ext/ins instructions. * gcc.target/mips/ext_ins.c: New test for testing the generation of MIPS32/64 rev 2 ext/ins instructions. * config/mips/mips.c (mips_use_ins_ext_p): New helper function that determines whether the MIPS32/64 R2 ext/ins should be used. * config/mips/mips.h (ISA_HAS_EXT_INS): New macro. * config/mips/mips.md (extzv): Changed predicate for operand to nonimmediate_operand. Add code to generate insn patterns for extzvsi and extzvdi. (extzv): New pattern to match mips32/64 r2 ext insn. (insv): Similarly for insertion. (insv): Similarly. From-SVN: r100212 --- gcc/config/mips/mips.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'gcc/config/mips/mips.c') diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 9ddcf4d..76f681f 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -4158,7 +4158,39 @@ mips_expand_unaligned_store (rtx dest, rtx src, unsigned int width, int bitpos) } return true; } - + +/* Return true if (zero_extract OP SIZE POSITION) can be used as the + source of an "ext" instruction or the destination of an "ins" + instruction. OP must be a register operand and the following + conditions must hold: + + 0 <= POSITION < GET_MODE_BITSIZE (GET_MODE (op)) + 0 < SIZE <= GET_MODE_BITSIZE (GET_MODE (op)) + 0 < POSITION + SIZE <= GET_MODE_BITSIZE (GET_MODE (op)) + + Also reject lengths equal to a word as they are better handled + by the move patterns. */ + +bool +mips_use_ins_ext_p (rtx op, rtx size, rtx position) +{ + HOST_WIDE_INT len, pos; + + if (!ISA_HAS_EXT_INS + || !register_operand (op, VOIDmode) + || GET_MODE_BITSIZE (GET_MODE (op)) > BITS_PER_WORD) + return false; + + len = INTVAL (size); + pos = INTVAL (position); + + if (len <= 0 || len >= GET_MODE_BITSIZE (GET_MODE (op)) + || pos < 0 || pos + len > GET_MODE_BITSIZE (GET_MODE (op))) + return false; + + return true; +} + /* Set up globals to generate code for the ISA or processor described by INFO. */ -- cgit v1.1