This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
patch to mips16 truncdi{h,q}i2
- To: egcs at cygnus dot com
- Subject: patch to mips16 truncdi{h,q}i2
- From: Gavin Koch <gavin at cygnus dot com>
- Date: Tue, 10 Feb 1998 09:54:47 -0500 (EST)
For the 4100 -mips16, the following bit of code causes gcc
to recur in convert_move until it runs out of stack; similar
code useing a long and a char will also cause this. The
following patch defines a mips16 version of of truncdihi2
and truncdiqi2.
OK to push?
-gavin...
./cc1 yy.c -quiet -mips16 -O0 -o yy.s
long l;
short i;
void x()
{
i = l;
}
* mips.md (trucndihi2,truncdiqi2): Change these to support
mips16.
Index: mips.md
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/mips/mips.md,v
retrieving revision 1.95
diff -c -3 -p -r1.95 mips.md
*** mips.md 1998/01/23 07:20:09 1.95
--- mips.md 1998/02/09 21:00:03
*************** move\\t%0,%z4\\n\\
*** 3301,3320 ****
(define_insn "truncdihi2"
[(set (match_operand:HI 0 "register_operand" "=d")
(truncate:HI (match_operand:DI 1 "se_register_operand" "d")))]
! "TARGET_64BIT && !TARGET_MIPS16"
! "andi\\t%0,%1,0xffff"
[(set_attr "type" "darith")
(set_attr "mode" "HI")
! (set_attr "length" "1")])
!
(define_insn "truncdiqi2"
[(set (match_operand:QI 0 "register_operand" "=d")
(truncate:QI (match_operand:DI 1 "se_register_operand" "d")))]
! "TARGET_64BIT && !TARGET_MIPS16"
! "andi\\t%0,%1,0x00ff"
[(set_attr "type" "darith")
(set_attr "mode" "QI")
! (set_attr "length" "1")])
;; Combiner patterns to optimize shift/truncate combinations.
(define_insn ""
--- 3301,3333 ----
(define_insn "truncdihi2"
[(set (match_operand:HI 0 "register_operand" "=d")
(truncate:HI (match_operand:DI 1 "se_register_operand" "d")))]
! "TARGET_64BIT"
! "*
! {
! if (TARGET_MIPS16)
! return \"dsll\\t%0,%1,48\;dsra\\t%0,48\";
! return \"andi\\t%0,%1,0xffff\";
! }"
[(set_attr "type" "darith")
(set_attr "mode" "HI")
! (set (attr "length") (if_then_else (eq (symbol_ref "mips16") (const_int 0))
! (const_int 1)
! (const_int 4)))])
(define_insn "truncdiqi2"
[(set (match_operand:QI 0 "register_operand" "=d")
(truncate:QI (match_operand:DI 1 "se_register_operand" "d")))]
! "TARGET_64BIT"
! "*
! {
! if (TARGET_MIPS16)
! return \"dsll\\t%0,%1,56\;dsra\\t%0,56\";
! return \"andi\\t%0,%1,0x00ff\";
! }"
[(set_attr "type" "darith")
(set_attr "mode" "QI")
! (set (attr "length") (if_then_else (eq (symbol_ref "mips16") (const_int 0))
! (const_int 1)
! (const_int 4)))])
;; Combiner patterns to optimize shift/truncate combinations.
(define_insn ""