From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29179 invoked by alias); 3 May 2002 10:14:38 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 29103 invoked from network); 3 May 2002 10:14:32 -0000 Received: from unknown (HELO mirapoint.inter.net.il) (192.114.186.20) by sources.redhat.com with SMTP; 3 May 2002 10:14:32 -0000 Received: from dlivshin (diup-217-56.inter.net.il [213.8.217.56]) by mirapoint.inter.net.il (Mirapoint Messaging Server MOS 2.9.3.2) with SMTP id ACW17843; Fri, 3 May 2002 13:14:19 +0300 (IDT) Message-ID: <000f01c1f293$ca896200$38d908d5@dlivshin> From: "David Livshin" To: "Alan Lehotsky" Cc: "Richard Henderson" , References: <001301c1f113$907bf540$91d808d5@dlivshin><001301c1f1a4$0a0ae020$73d808d5@dlivshin><20020501232220.A4494@redhat.com><000c01c1f1db$a589fc20$66d908d5@dlivshin> Subject: Re: gcc port to StarCore Date: Fri, 03 May 2002 03:14:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-SW-Source: 2002-05/txt/msg00224.txt.bz2 ----- Original Message ----- From: Alan Lehotsky To: David Livshin Cc: Richard Henderson ; Sent: Thursday, May 02, 2002 2:42 PM Subject: Re: gcc port to StarCore > At 3:16 PM +0200 5/2/02, David Livshin wrote: > >..... > > > >Are you saying that in order to benefit from constant propagation in the: > > > >x = 10; > >y = 100; > >if ( x > y ) > >... > > > >'define_expand "cmpsi"' may not be used? > > > Not to put words in Richard's mouth.....but..... > > What he's saying is that the DEFINE_EXPAND just produces the initial > RTL, and as I mentioned earlier, the compiler will normally decide to > load immediates to pseudos when it initially generates code. You > HAVE to use the "cmpsi" pattern otherwise, you'd never generate any > compare RTL (although I think it may be the case that the compiler > can generate calls to the runtime library to do compares out-of-line) > I meant to ask if I have to use 'define_insn "cmpsi"' instead of 'define_expand "cmpsi"' > > >Would you please direct me to a material ( source code and/or document ) > >that may clarify the way this optimization is implemented by the GNU > >compiler. Right now I even cant guess what it might be. For example I tried > >in md: > > > >( define_insn "addsi3" > > [ ( set > > ( match_operand:SI 0 "register_operand" "" ) > > ( plus:SI ( match_operand:SI 1 "general_operand" "" ) > > ( match_operand:SI 2 "general_operand" "" ) > > ) > > ) > > ] > >.... > > Okay. This pattern is missing all constraints. (The characters > inside the last "" on each match_operand) > I'm not certain that would prevent constant folding (in fact I can't > imagine how it could), but you should fix that before looking for > other problems.... > > The other thing that occurs to me is whether you've defined the > various COSTS macros (CONST_COSTS, ADDRESS_COST and RTX_COST). Also > check your LEGITIMATE_CONSTANT_P macro is reasonable.... I will check it out and if wouldn't find any problems I will send you RTL dump as you requested. Thank you, David > > > >and then compiled: > > > >x = 10; > >y = 100; > >z = x + y; > >... > > > >It seems from the resulting code: > > > > moveu.l #10,d0 > > move.l d0,_x > > moveu.l #100,d2 > > move.l d2,_y > > add #10,d2,d2 > > move.l d2,_z > > > >that compiler understands that 'x' is equal to 10 but misses the fact that > >'y' is also a constant and 'z' is always equal to 110( or something inside > >the compiler forces the generation of the add instruction ). Just in-case > >you are wondering: description of "movsi" in my md file allows load of any > >constant to any register. > > An RTL dump would be a good thing to see, just to insure that the RTL > you generated isn't munged in some unpredictable fashion. >