public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to mips16 truncdi{h,q}i2
@ 1998-02-10  6:57 Gavin Koch
  1998-02-10 23:58 ` Jeffrey A Law
  1998-02-11  0:47 ` Jeffrey A Law
  0 siblings, 2 replies; 3+ messages in thread
From: Gavin Koch @ 1998-02-10  6:57 UTC (permalink / raw)
  To: egcs

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 ""

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to mips16 truncdi{h,q}i2
  1998-02-10  6:57 patch to mips16 truncdi{h,q}i2 Gavin Koch
@ 1998-02-10 23:58 ` Jeffrey A Law
  1998-02-11  0:47 ` Jeffrey A Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 1998-02-10 23:58 UTC (permalink / raw)
  To: Gavin Koch; +Cc: egcs

  In message < m0y2H5D-0006vBC@cetus.cygnus.com >you write:
  > 
  > 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?
Looks good to me.  Please install it.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch to mips16 truncdi{h,q}i2
  1998-02-10  6:57 patch to mips16 truncdi{h,q}i2 Gavin Koch
  1998-02-10 23:58 ` Jeffrey A Law
@ 1998-02-11  0:47 ` Jeffrey A Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 1998-02-11  0:47 UTC (permalink / raw)
  To: Gavin Koch; +Cc: egcs

  In message < m0y2H5D-0006vBC@cetus.cygnus.com >you write:
  > 
  > 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.
Actually, wait, I don't see any "double" shift instructions in 
my mips16 info....

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-02-11  0:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-10  6:57 patch to mips16 truncdi{h,q}i2 Gavin Koch
1998-02-10 23:58 ` Jeffrey A Law
1998-02-11  0:47 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).