This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

jump optimizations


hello,

how do you tell gcc, through the machine dexcription,
to do jump optimization as shown in the sample code
below:

c code:             assembly code
 i=3; 
 j=3;
 if (i > j)         cmp	r3, r2	[length = 4]
	            ble	.L3
   k=i+j;
 else
   k=i-j;


In the c code above it checks if i>j but when
converting to assembly it checks if it is <= and
branches to the label corresponding to else

In my machine description I have specified

(define_expand "bgt"
 [(set (reg:CC 32) (gt:SI (match_dup 1) (match_dup
2)))
   (set (pc)
	(if_then_else (gt (reg:CC 32) (const_int 0))
	         (label_ref (match_operand 0 "" ""))
		 (pc)))]
  ""
  "
{
operands[1] = av_compare_op0; ;;saved earlier
operands[2] = av_compare_op1;
}
")  

both the RTL patterns generated from the define_expand
have define_insns to generate assembly but my assembly
generated is not jump optimized it generates two jump
labels one for the if condition and one for the else
condition. How do I optimize it?

regards,
danish


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--- Begin Message ---
Hi. This is the qmail-send program at sources.redhat.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<gcc@gcc.gnu.org>:
ezmlm-reject: fatal: Sorry, I don't accept message with empty Subject (#5.7.0)

--- Below this line is a copy of the message.

Return-Path: <danishsamad@yahoo.com>
Received: (qmail 1292 invoked from network); 7 Mar 2002 09:55:14 -0000
Received: from unknown (HELO web13205.mail.yahoo.com) (216.136.174.190)
  by sources.redhat.com with SMTP; 7 Mar 2002 09:55:14 -0000
Message-ID: <20020307095514.74933.qmail@web13205.mail.yahoo.com>
Received: from [203.215.160.34] by web13205.mail.yahoo.com via HTTP; Thu, 07 Mar 2002 01:55:14 PST
Date: Thu, 7 Mar 2002 01:55:14 -0800 (PST)
From: Danish Samad <danishsamad@yahoo.com>
To: gcc@gcc.gnu.org, durdana@enabtech.com, saira@enabtech.com,
  umarj@enabtech.com
Cc: syed_rauf_ul_hassan@hotmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

hello,

how do you tell gcc, through the machine dexcription,
to do jump optimization as shown in the sample code
below:

c code:             assembly code
 i=3; 
 j=3;
 if (i > j)         cmp	r3, r2	[length = 4]
	            ble	.L3
   k=i+j;
 else
   k=i-j;


In the c code above it checks if i>j but when
converting to assembly it checks if it is <= and
branches to the label corresponding to else

In my machine description I have specified

(define_expand "bgt"
 [(set (reg:CC 32) (gt:SI (match_dup 1) (match_dup
2)))
   (set (pc)
	(if_then_else (gt (reg:CC 32) (const_int 0))
	         (label_ref (match_operand 0 "" ""))
		 (pc)))]
  ""
  "
{
operands[1] = av_compare_op0; ;;saved earlier
operands[2] = av_compare_op1;
}
")  

both the RTL patterns generated from the define_expand
have define_insns to generate assembly but my assembly
generated is not jump optimized it generates two jump
labels one for the if condition and one for the else
condition. How do I optimize it?

regards,
danish




__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
--- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]