public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ip2k port] bugfix
@ 2002-08-13  3:00 Denis Chertykov
  2002-08-26  0:39 ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Chertykov @ 2002-08-13  3:00 UTC (permalink / raw)
  To: gcc-patches


2002-08-13  Denis Chertykov  <denisc@overta.ru>

	* config/ip2k/ip2k.c (commands_in_file): Variable removed.
	(function_epilogue): Don't calculate function size.
	(ip2k_set_compare): Don't use lookup_const_double.
	(asm_file_start): Initialization of commands_in_file removed.
	(asm_file_end): Output of commands_in_file removed.
	
	* config/ip2k/ip2k.c (CPP_PREDEFINES): Remove definition of
	__INT_MAX__.


Index: config/ip2k/ip2k.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ip2k/ip2k.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 ip2k.c
*** config/ip2k/ip2k.c	11 Aug 2002 19:24:08 -0000	1.4
--- config/ip2k/ip2k.c	13 Aug 2002 09:49:57 -0000
*************** static void mdr_try_wreg_elim PARAMS ((r
*** 90,98 ****
  
  struct gcc_target targetm = TARGET_INITIALIZER;
  
- /* Commands count in the compiled file.  */
- static int commands_in_file;
- 
  /* Commands in the functions prologues in the compiled file.  */
  static int commands_in_prologues;
  
--- 90,95 ----
*************** function_epilogue (file, size)
*** 304,310 ****
  {
    int leaf_func_p;
    int reg,savelimit;
-   int function_size;
    rtx operands[2];		/* Dummy used by OUT_ASn  */
    int need_ret = 1;
  
--- 301,306 ----
*************** function_epilogue (file, size)
*** 324,332 ****
      }
  
    leaf_func_p = leaf_function_p ();
-   function_size = (INSN_ADDRESSES (INSN_UID (get_last_insn ()))
- 		   - INSN_ADDRESSES (INSN_UID (get_insns ())));
-   
    epilogue_size = 0;
    fprintf (file, "/* epilogue: frame size=%d */\n", size);
  
--- 320,325 ----
*************** function_epilogue (file, size)
*** 508,516 ****
      }
    
    fprintf (file, "/* epilogue end (size=%d) */\n", epilogue_size);
-   fprintf (file, "/* function %s size %d (%d) */\n", current_function_name,
- 	   prologue_size + function_size + epilogue_size, function_size);
-   commands_in_file += prologue_size + function_size + epilogue_size;
    commands_in_prologues += prologue_size;
    commands_in_epilogues += epilogue_size;
  }
--- 501,506 ----
*************** ip2k_set_compare (x, y)
*** 1091,1097 ****
      {
        rtx value;
        size_t i;
!       
        value = rtx_alloc (CONST_DOUBLE);
        PUT_MODE (value, VOIDmode);
  
--- 1081,1087 ----
      {
        rtx value;
        size_t i;
! 
        value = rtx_alloc (CONST_DOUBLE);
        PUT_MODE (value, VOIDmode);
  
*************** ip2k_set_compare (x, y)
*** 1101,1107 ****
        for (i = 2; i < (sizeof CONST_DOUBLE_FORMAT - 1); i++)
  	XWINT (value, i) = 0;
        
!       y = lookup_const_double (value);
      }
    
    ip2k_compare_operands[0] = x;
--- 1091,1097 ----
        for (i = 2; i < (sizeof CONST_DOUBLE_FORMAT - 1); i++)
  	XWINT (value, i) = 0;
        
!       y = value;
      }
    
    ip2k_compare_operands[0] = x;
*************** asm_file_start (file)
*** 3196,3202 ****
  {
    output_file_directive (file, main_input_filename);
    
-   commands_in_file = 0;
    commands_in_prologues = 0;
    commands_in_epilogues = 0;
  }
--- 3186,3191 ----
*************** asm_file_end (file)
*** 3210,3221 ****
  {
    fprintf
      (file,
!      "/* File %s: code %4d = 0x%04x (%4d), prologues %3d, epilogues %3d */\n",
!      main_input_filename,
!      commands_in_file,
!      commands_in_file,
!      commands_in_file - commands_in_prologues - commands_in_epilogues,
!      commands_in_prologues, commands_in_epilogues);
  }
  
  /* Cost functions.  */
--- 3199,3206 ----
  {
    fprintf
      (file,
!      "/* File %s: prologues %3d, epilogues %3d */\n",
!      main_input_filename, commands_in_prologues, commands_in_epilogues);
  }
  
  /* Cost functions.  */
Index: config/ip2k/ip2k.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ip2k/ip2k.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 ip2k.h
*** config/ip2k/ip2k.h	31 Jul 2002 02:13:31 -0000	1.5
--- config/ip2k/ip2k.h	13 Aug 2002 09:50:32 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 28,34 ****
  #undef ASM_SPEC			/* But we have a GAS assembler.  */
  
  #define CPP_PREDEFINES \
!   "-DIP2K -D__INT_MAX__=SHRT_MAX -D_DOUBLE_IS_32BITS -D__BUFSIZ__=512 -D__FILENAME_MAX__=128"
  /* Define this to be a string constant containing `-D' options to
     define the predefined macros that identify this machine and system.
     These macros will be predefined unless the `-ansi' option is
--- 28,34 ----
  #undef ASM_SPEC			/* But we have a GAS assembler.  */
  
  #define CPP_PREDEFINES \
!   "-DIP2K -D_DOUBLE_IS_32BITS -D__BUFSIZ__=512 -D__FILENAME_MAX__=128"
  /* Define this to be a string constant containing `-D' options to
     define the predefined macros that identify this machine and system.
     These macros will be predefined unless the `-ansi' option is

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

* Re: [ip2k port] bugfix
  2002-08-13  3:00 [ip2k port] bugfix Denis Chertykov
@ 2002-08-26  0:39 ` Zack Weinberg
  2002-08-26 11:01   ` Denis Chertykov
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2002-08-26  0:39 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: gcc-patches

On Tue, Aug 13, 2002 at 02:00:23PM +0400, Denis Chertykov wrote:
> 
> 2002-08-13  Denis Chertykov  <denisc@overta.ru>
> 
> 	* config/ip2k/ip2k.c (commands_in_file): Variable removed.
> 	(function_epilogue): Don't calculate function size.
> 	(ip2k_set_compare): Don't use lookup_const_double.
> 	(asm_file_start): Initialization of commands_in_file removed.
> 	(asm_file_end): Output of commands_in_file removed.

ip2k_set_compare is still constructing its own CONST_DOUBLEs, which is
verboten.  CONST_DOUBLEs are opaque entities and may be manipulated
*only* by the interfaces exposed in real.h and rtl.h.

Looking at the function, it appears to be forcing the creation of
non-canonical RTL, which is also a no-no.  What are you actually
trying to achieve here?

zw

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

* Re: [ip2k port] bugfix
  2002-08-26  0:39 ` Zack Weinberg
@ 2002-08-26 11:01   ` Denis Chertykov
  2002-08-29 10:38     ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Chertykov @ 2002-08-26 11:01 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Denis Chertykov, gcc-patches

Zack Weinberg <zack@codesourcery.com> writes:

> On Tue, Aug 13, 2002 at 02:00:23PM +0400, Denis Chertykov wrote:
> > 
> > 2002-08-13  Denis Chertykov  <denisc@overta.ru>
> > 
> > 	* config/ip2k/ip2k.c (commands_in_file): Variable removed.
> > 	(function_epilogue): Don't calculate function size.
> > 	(ip2k_set_compare): Don't use lookup_const_double.
> > 	(asm_file_start): Initialization of commands_in_file removed.
> > 	(asm_file_end): Output of commands_in_file removed.
> 
> ip2k_set_compare is still constructing its own CONST_DOUBLEs, which is
> verboten.  CONST_DOUBLEs are opaque entities and may be manipulated
> *only* by the interfaces exposed in real.h and rtl.h.

Will be fixed.

> Looking at the function, it appears to be forcing the creation of
> non-canonical RTL, which is also a no-no.  What are you actually
> trying to achieve here?

It was not me :-(

Denis.


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

* Re: [ip2k port] bugfix
  2002-08-26 11:01   ` Denis Chertykov
@ 2002-08-29 10:38     ` Zack Weinberg
  2002-08-30 10:13       ` Denis Chertykov
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2002-08-29 10:38 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: gcc-patches

On Mon, Aug 26, 2002 at 10:07:39PM +0400, Denis Chertykov wrote:
> Zack Weinberg <zack@codesourcery.com> writes:
> > ip2k_set_compare is still constructing its own CONST_DOUBLEs, which is
> > verboten.  CONST_DOUBLEs are opaque entities and may be manipulated
> > *only* by the interfaces exposed in real.h and rtl.h.
> 
> Will be fixed.

Thanks.

I imagine it is as simple as changing the body of ip2k_set_compare to

{
  ip2k_compare_operands[0] = x;
  ip2k_compare_operands[1] = y;
  return "";
}

and then finding out what breaks, and fixing it.

> > Looking at the function, it appears to be forcing the creation of
> > non-canonical RTL, which is also a no-no.  What are you actually
> > trying to achieve here?
> 
> It was not me :-(

You will probably find it easier to locate the real problem and fix
it, though.  (It should be a case of some code somewhere expecting
DImode compares against an immediate value to come with a CONST_DOUBLE
second operand, even if the sign-extended quantity fits in a
CONST_INT.)

zw

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

* Re: [ip2k port] bugfix
  2002-08-29 10:38     ` Zack Weinberg
@ 2002-08-30 10:13       ` Denis Chertykov
  2002-08-30 11:18         ` Denis Chertykov
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Chertykov @ 2002-08-30 10:13 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Denis Chertykov, gcc-patches

Zack Weinberg <zack@codesourcery.com> writes:

> On Mon, Aug 26, 2002 at 10:07:39PM +0400, Denis Chertykov wrote:
> > Zack Weinberg <zack@codesourcery.com> writes:
> > > ip2k_set_compare is still constructing its own CONST_DOUBLEs, which is
> > > verboten.  CONST_DOUBLEs are opaque entities and may be manipulated
> > > *only* by the interfaces exposed in real.h and rtl.h.
> > 
> > Will be fixed.
> 
> Thanks.
> 
> I imagine it is as simple as changing the body of ip2k_set_compare to
> 
> {
>   ip2k_compare_operands[0] = x;
>   ip2k_compare_operands[1] = y;
>   return "";
> }
> 
> and then finding out what breaks, and fixing it.
> 
> > > Looking at the function, it appears to be forcing the creation of
> > > non-canonical RTL, which is also a no-no.  What are you actually
> > > trying to achieve here?
> > 
> > It was not me :-(
> 
> You will probably find it easier to locate the real problem and fix
> it, though.  (It should be a case of some code somewhere expecting
> DImode compares against an immediate value to come with a CONST_DOUBLE
> second operand, even if the sign-extended quantity fits in a
> CONST_INT.)

Thanks for suggestion. I just havn't time to fix this bug right now.
Will be fixed in one/two days.

Denis.

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

* Re: [ip2k port] bugfix
  2002-08-30 10:13       ` Denis Chertykov
@ 2002-08-30 11:18         ` Denis Chertykov
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Chertykov @ 2002-08-30 11:18 UTC (permalink / raw)
  To: Denis Chertykov; +Cc: Zack Weinberg, gcc-patches

Denis Chertykov <denisc@overta.ru> writes:

> Zack Weinberg <zack@codesourcery.com> writes:
> 
> > On Mon, Aug 26, 2002 at 10:07:39PM +0400, Denis Chertykov wrote:
> > > Zack Weinberg <zack@codesourcery.com> writes:
> > > > ip2k_set_compare is still constructing its own CONST_DOUBLEs, which is
> > > > verboten.  CONST_DOUBLEs are opaque entities and may be manipulated
> > > > *only* by the interfaces exposed in real.h and rtl.h.
> > > 
> > > Will be fixed.
> > 
> > Thanks.
> > 
> > I imagine it is as simple as changing the body of ip2k_set_compare to
> > 
> > {
> >   ip2k_compare_operands[0] = x;
> >   ip2k_compare_operands[1] = y;
> >   return "";
> > }
> > 
> > and then finding out what breaks, and fixing it.
> > 
> > > > Looking at the function, it appears to be forcing the creation of
> > > > non-canonical RTL, which is also a no-no.  What are you actually
> > > > trying to achieve here?
> > > 
> > > It was not me :-(
> > 
> > You will probably find it easier to locate the real problem and fix
> > it, though.  (It should be a case of some code somewhere expecting
> > DImode compares against an immediate value to come with a CONST_DOUBLE
> > second operand, even if the sign-extended quantity fits in a
> > CONST_INT.)
> 
> Thanks for suggestion. I just havn't time to fix this bug right now.

I found the time.

2002-08-30  Denis Chertykov  <denisc@overta.ru>

	* config/ip2k/ip2k.c (ip2k_set_compare): Remove all CONST_DOUBLE
	stuff.
	(ip2k_gen_unsigned_comp_branch): Handle CONST_INT and
	CONST_DOUBLE constants.
	
diff -c -3 -p -r1.5 ip2k.c
*** ip2k.c	13 Aug 2002 09:58:37 -0000	1.5
--- ip2k.c	30 Aug 2002 18:10:47 -0000
*************** ip2k_set_compare (x, y)
*** 1075,1099 ****
       rtx x;
       rtx y;
  {
-   /* If we're doing a DImode compare then force any CONST_INT second
-      operand to be CONST_DOUBLE.  */
-   if (GET_MODE (x) == DImode && GET_CODE (y) == CONST_INT)
-     {
-       rtx value;
-       size_t i;
- 
-       value = rtx_alloc (CONST_DOUBLE);
-       PUT_MODE (value, VOIDmode);
- 
-       CONST_DOUBLE_LOW (value) = INTVAL (y);
-       CONST_DOUBLE_HIGH (value) = INTVAL (y) > 0 ? 0 : -1;
- 
-       for (i = 2; i < (sizeof CONST_DOUBLE_FORMAT - 1); i++)
- 	XWINT (value, i) = 0;
-       
-       y = value;
-     }
-   
    ip2k_compare_operands[0] = x;
    ip2k_compare_operands[1] = y;
    return "";
--- 1075,1080 ----
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 1675,1680 ****
--- 1656,1663 ----
    int imm_cmp = 0;
    int can_use_skip = 0;
    rtx ninsn;
+   HOST_WIDE_INT const_low;
+   HOST_WIDE_INT const_high;
  
    operands[2] = label;
  
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2332,2341 ****
  	    {
  	      if (INTVAL (operands[0]) == 0)
  		{
!                   OUT_AS2 (mov, w, %A0);
!                   OUT_AS2 (or, w, %B0);
!                   OUT_AS2 (or, w, %C0);
!                   OUT_AS2 (or, w, %D0);
  		  OUT_AS1 (snz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
--- 2315,2324 ----
  	    {
  	      if (INTVAL (operands[0]) == 0)
  		{
!                   OUT_AS2 (mov, w, %A1);
!                   OUT_AS2 (or, w, %B1);
!                   OUT_AS2 (or, w, %C1);
!                   OUT_AS2 (or, w, %D1);
  		  OUT_AS1 (snz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2377,2386 ****
  	    {
  	      if (INTVAL (operands[0]) == 0)
  	        {
!                   OUT_AS2 (mov, w, %A0);
!                   OUT_AS2 (or, w, %B0);
!                   OUT_AS2 (or, w, %C0);
!                   OUT_AS2 (or, w, %D0);
  		  OUT_AS1 (sz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
--- 2360,2369 ----
  	    {
  	      if (INTVAL (operands[0]) == 0)
  	        {
!                   OUT_AS2 (mov, w, %A1);
!                   OUT_AS2 (or, w, %B1);
!                   OUT_AS2 (or, w, %C1);
!                   OUT_AS2 (or, w, %D1);
  		  OUT_AS1 (sz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2465,2470 ****
--- 2448,2463 ----
        break;
  
      case DImode:
+       if (GET_CODE (operands[1]) == CONST_INT)
+ 	{
+ 	  const_low = INTVAL (operands[1]);
+ 	  const_high = (const_low >= 0) - 1;
+ 	}
+       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
+ 	{
+ 	  const_low = CONST_DOUBLE_LOW (operands[1]);
+ 	  const_high = CONST_DOUBLE_HIGH (operands[1]);
+ 	}
        switch (code)
          {
  	case EQ:
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2519,2532 ****
  	      {
  		if (imm_cmp)
  		  {
! 		    s = (CONST_DOUBLE_HIGH (operands[1]) >> 24) & 0xff;
! 		    t = (CONST_DOUBLE_HIGH (operands[1]) >> 16) & 0xff;
! 		    u = (CONST_DOUBLE_HIGH (operands[1]) >> 8) & 0xff;
! 		    v = CONST_DOUBLE_HIGH (operands[1]) & 0xff;
! 		    w = (CONST_DOUBLE_LOW (operands[1]) >> 24) & 0xff;
! 		    x = (CONST_DOUBLE_LOW (operands[1]) >> 16) & 0xff;
! 		    y = (CONST_DOUBLE_LOW (operands[1]) >> 8) & 0xff;
! 		    z = CONST_DOUBLE_LOW (operands[1]) & 0xff;
  		  }
  
  		OUT_AS2 (mov, w, %S1);
--- 2512,2525 ----
  	      {
  		if (imm_cmp)
  		  {
! 		    s = (const_high >> 24) & 0xff;
! 		    t = (const_high >> 16) & 0xff;
! 		    u = (const_high >> 8) & 0xff;
! 		    v = const_high & 0xff;
! 		    w = (const_low >> 24) & 0xff;
! 		    x = (const_low >> 16) & 0xff;
! 		    y = (const_low >> 8) & 0xff;
! 		    z = const_low & 0xff;
  		  }
  
  		OUT_AS2 (mov, w, %S1);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2648,2661 ****
  	      {
  		if (imm_cmp)
  		  {
! 		    s = (CONST_DOUBLE_HIGH (operands[1]) >> 24) & 0xff;
! 		    t = (CONST_DOUBLE_HIGH (operands[1]) >> 16) & 0xff;
! 		    u = (CONST_DOUBLE_HIGH (operands[1]) >> 8) & 0xff;
! 		    v = CONST_DOUBLE_HIGH (operands[1]) & 0xff;
! 		    w = (CONST_DOUBLE_LOW (operands[1]) >> 24) & 0xff;
! 		    x = (CONST_DOUBLE_LOW (operands[1]) >> 16) & 0xff;
! 		    y = (CONST_DOUBLE_LOW (operands[1]) >> 8) & 0xff;
! 		    z = CONST_DOUBLE_LOW (operands[1]) & 0xff;
  		  }
  
  		OUT_AS2 (mov, w, %S1);
--- 2641,2654 ----
  	      {
  		if (imm_cmp)
  		  {
! 		    s = (const_high >> 24) & 0xff;
! 		    t = (const_high >> 16) & 0xff;
! 		    u = (const_high >> 8) & 0xff;
! 		    v = const_high & 0xff;
! 		    w = (const_low >> 24) & 0xff;
! 		    x = (const_low >> 16) & 0xff;
! 		    y = (const_low >> 8) & 0xff;
! 		    z = const_low & 0xff;
  		  }
  
  		OUT_AS2 (mov, w, %S1);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2734,2746 ****
  	  if (imm_sub)
  	    {
  	      /* > 0xffffffffffffffff never suceeds!  */
! 	      if (((CONST_DOUBLE_HIGH (operands[1]) & 0xffffffff)
! 		   != 0xffffffff)
! 		  || ((CONST_DOUBLE_LOW (operands[1]) & 0xffffffff)
! 		      != 0xffffffff))
  		{
! 	          operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) + 1);
! 		  operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1])
  					 + (INTVAL (operands[3]) ? 0 : 1));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z0);
--- 2727,2737 ----
  	  if (imm_sub)
  	    {
  	      /* > 0xffffffffffffffff never suceeds!  */
! 	      if (((const_high & 0xffffffff) != 0xffffffff)
! 		  || ((const_low & 0xffffffff) != 0xffffffff))
  		{
! 	          operands[3] = GEN_INT (const_low + 1);
! 		  operands[4] = GEN_INT (const_high
  					 + (INTVAL (operands[3]) ? 0 : 1));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z0);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2790,2816 ****
  	case GEU:
  	  if (imm_sub)
  	    {
! 	      if ((CONST_DOUBLE_HIGH (operands[0]) == 0)
! 		  && (CONST_DOUBLE_LOW (operands[0]) == 0))
  		{
!                   OUT_AS2 (mov, w, %S0);
!                   OUT_AS2 (or, w, %T0);
!                   OUT_AS2 (or, w, %U0);
!                   OUT_AS2 (or, w, %V0);
!                   OUT_AS2 (or, w, %W0);
!                   OUT_AS2 (or, w, %X0);
!                   OUT_AS2 (or, w, %Y0);
!                   OUT_AS2 (or, w, %Z0);
  		  OUT_AS1 (snz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
  		}
  	      else
  	        {
! 	          operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[0]) - 1);
! 		  operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[0])
! 					 - (CONST_DOUBLE_LOW (operands[0])
! 					    ? 1 : 0));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z1);
  	          OUT_AS2 (mov, w, %C3);
--- 2781,2818 ----
  	case GEU:
  	  if (imm_sub)
  	    {
! 	      HOST_WIDE_INT const_low0;
! 	      HOST_WIDE_INT const_high0;
! 	      
! 	      if (GET_CODE (operands[0]) == CONST_INT)
! 		{
! 		  const_low0 = INTVAL (operands[0]);
! 		  const_high0 = (const_low >= 0) - 1;
! 		}
! 	      else if (GET_CODE (operands[0]) == CONST_DOUBLE)
! 		{
! 		  const_low0 = CONST_DOUBLE_LOW (operands[0]);
! 		  const_high0 = CONST_DOUBLE_HIGH (operands[0]);
! 		}
! 	      
! 	      if (const_high0 == 0 && const_low0 == 0)
  		{
!                   OUT_AS2 (mov, w, %S1);
!                   OUT_AS2 (or, w, %T1);
!                   OUT_AS2 (or, w, %U1);
!                   OUT_AS2 (or, w, %V1);
!                   OUT_AS2 (or, w, %W1);
!                   OUT_AS2 (or, w, %X1);
!                   OUT_AS2 (or, w, %Y1);
!                   OUT_AS2 (or, w, %Z1);
  		  OUT_AS1 (snz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
  		}
  	      else
  	        {
! 	          operands[3] = GEN_INT (const_low0 - 1);
! 		  operands[4] = GEN_INT (const_high0 - (const_low0 ? 1 : 0));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z1);
  	          OUT_AS2 (mov, w, %C3);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2859,2885 ****
  	case LTU:
  	  if (imm_sub)
  	    {
! 	      if ((CONST_DOUBLE_HIGH (operands[0]) == 0)
! 		  && (CONST_DOUBLE_LOW (operands[0]) == 0))
  		{
!                   OUT_AS2 (mov, w, %S0);
!                   OUT_AS2 (or, w, %T0);
!                   OUT_AS2 (or, w, %U0);
!                   OUT_AS2 (or, w, %V0);
!                   OUT_AS2 (or, w, %W0);
!                   OUT_AS2 (or, w, %X0);
!                   OUT_AS2 (or, w, %Y0);
!                   OUT_AS2 (or, w, %Z0);
  		  OUT_AS1 (sz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
  		}
  	      else
  	        {
! 	          operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[0]) - 1);
! 		  operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[0])
! 					 - (CONST_DOUBLE_LOW (operands[0])
! 					    ? 1 : 0));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z1);
  	          OUT_AS2 (mov, w, %C3);
--- 2861,2898 ----
  	case LTU:
  	  if (imm_sub)
  	    {
! 	      HOST_WIDE_INT const_low0;
! 	      HOST_WIDE_INT const_high0;
! 	      
! 	      if (GET_CODE (operands[0]) == CONST_INT)
! 		{
! 		  const_low0 = INTVAL (operands[0]);
! 		  const_high0 = (const_low >= 0) - 1;
! 		}
! 	      else if (GET_CODE (operands[0]) == CONST_DOUBLE)
! 		{
! 		  const_low0 = CONST_DOUBLE_LOW (operands[0]);
! 		  const_high0 = CONST_DOUBLE_HIGH (operands[0]);
! 		}
! 	      
! 	      if (const_high0 == 0 && const_low0 == 0)
  		{
!                   OUT_AS2 (mov, w, %S1);
!                   OUT_AS2 (or, w, %T1);
!                   OUT_AS2 (or, w, %U1);
!                   OUT_AS2 (or, w, %V1);
!                   OUT_AS2 (or, w, %W1);
!                   OUT_AS2 (or, w, %X1);
!                   OUT_AS2 (or, w, %Y1);
!                   OUT_AS2 (or, w, %Z1);
  		  OUT_AS1 (sz,);
  	          OUT_AS1 (page, %2);
  	          OUT_AS1 (jmp, %2);
  		}
  	      else
  	        {
! 	          operands[3] = GEN_INT (const_low0 - 1);
! 		  operands[4] = GEN_INT (const_high0 - (const_low0 ? 1 : 0));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z1);
  	          OUT_AS2 (mov, w, %C3);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2928,2937 ****
  	case LEU:
  	  if (imm_sub)
  	    {
! 	      if (((CONST_DOUBLE_HIGH (operands[1]) & 0xffffffff)
! 		   == 0xffffffff)
! 		  && ((CONST_DOUBLE_LOW (operands[1]) & 0xffffffff)
! 		      == 0xffffffff))
  	        {
  		  /* <= 0xffffffffffffffff always suceeds.  */
  		  OUT_AS1 (page, %2);
--- 2941,2948 ----
  	case LEU:
  	  if (imm_sub)
  	    {
! 	      if (((const_high & 0xffffffff) == 0xffffffff)
! 		  && ((const_low & 0xffffffff) == 0xffffffff))
  	        {
  		  /* <= 0xffffffffffffffff always suceeds.  */
  		  OUT_AS1 (page, %2);
*************** ip2k_gen_unsigned_comp_branch (insn, cod
*** 2939,2946 ****
  		}
  	      else
  		{
! 	          operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) + 1);
! 		  operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1])
  					 + (INTVAL (operands[3]) ? 0 : 1));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z0);
--- 2950,2957 ----
  		}
  	      else
  		{
! 	          operands[3] = GEN_INT (const_low + 1);
! 		  operands[4] = GEN_INT (const_high
  					 + (INTVAL (operands[3]) ? 0 : 1));
  	          OUT_AS2 (mov, w, %D3);
  	          OUT_AS2 (sub, w, %Z0);

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

end of thread, other threads:[~2002-08-30 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13  3:00 [ip2k port] bugfix Denis Chertykov
2002-08-26  0:39 ` Zack Weinberg
2002-08-26 11:01   ` Denis Chertykov
2002-08-29 10:38     ` Zack Weinberg
2002-08-30 10:13       ` Denis Chertykov
2002-08-30 11:18         ` Denis Chertykov

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).