delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/26/13:59:47

Message-Id: <m0xlZKT-000S29C@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "DeHackEd" <dehacked72 AT nospam DOT hotmail DOT com>, djgpp AT delorie DOT com
Date: Fri, 26 Dec 1997 16:03:22 +0000
MIME-Version: 1.0
Subject: Re: Optmization and Exceptions
In-reply-to: <OG5YUSZE9GA.170@upnetnews04>

"DeHackEd" <dehacked72 AT nospam DOT hotmail DOT com> wrote:

> I was just playing around with the C++ compiler and I noticed a few things:
> 
> 1) Without optmizations, strlen("string literal") evaluates to asm
> LC1:
>     .ascii "string literal\0"
> 
> pushl $LC1
> call _strlen
> 
> But with -O3, it just evaluates to $14 (I think - I can't count).
And what's the problem! that's what you want! optimized code!
strlen is inline and GCC with -O3 is good enough to evaluate the operation in 
compile time.

> 2) With or without optmizations, (12*5) evaluates to $60, not a long asm output
> for calculating it. This is something which came up as a problem on some
> newsgroup.
GCC EVER optimizes multiplications. GCC simply doesn't use mul in i386 platform 
if one of the values is known at compile time. That's very good. It generates 
better code than a lot of assembler programmers! 

I don't understand very well, are you showing the good things you found? We can 
saturate the list with it ;-))

SET 
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019