X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: cbramix AT libero DOT it Newsgroups: comp.os.msdos.djgpp Subject: Re: missing optimization? Date: 8 Nov 2005 00:58:41 -0800 Organization: http://groups.google.com Lines: 41 Message-ID: <1131440321.197203.168820@z14g2000cwz.googlegroups.com> References: <1131105759 DOT 132511 DOT 231360 AT g47g2000cwa DOT googlegroups DOT com> <436eb66f$0$4419$91cee783 AT newsreader02 DOT highway DOT telekom DOT at> NNTP-Posting-Host: 82.106.2.23 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1131440326 10593 127.0.0.1 (8 Nov 2005 08:58:46 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Tue, 8 Nov 2005 08:58:46 +0000 (UTC) In-Reply-To: <436eb66f$0$4419$91cee783@newsreader02.highway.telekom.at> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse AT google DOT com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=82.106.2.23; posting-account=2QKFyAwAAACmXX-HdPjfH6A4KB1YwZKs To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hello, It's exactly you wrote into your commented assembly: the TEST opcode isn't needed. But as I wrote before, that instruction isn't emitted if I use a previous version, so I was wondering if the code could rewritten in a better way. I make you another small example: let's see these C lines: (my_structure+0)->data = my_var++; (my_structure+1)->data = my_var++; The compiler generates this: movl %ebx, %eax leal 1(%ebx), %ebx movl %eax, (%esi) movl %ebx, %eax leal 1(%ebx), %ebx movl %eax, 4(%esi) But if I rewrite it to: (my_structure+0)->data = my_var; (my_structure+1)->data = ++my_var; my_var++; I get this: movl %ebx, (%esi) incl %ebx movl %ebx, 4(%esi) incl %ebx DJ said it's probably better to forward this message to GCC mailing list and now I'm going to believe he's right. Thank you for your help. Sincerely, Carlo Bramini