From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2411 invoked by alias); 29 Jul 2003 12:55:03 -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 2329 invoked from network); 29 Jul 2003 12:55:02 -0000 Received: from unknown (HELO mx03.uni-tuebingen.de) (134.2.3.13) by sources.redhat.com with SMTP; 29 Jul 2003 12:55:02 -0000 Received: from bellatrix.tat.physik.uni-tuebingen.de (bellatrix.tat.physik.uni-tuebingen.de [134.2.170.113]) by mx03.uni-tuebingen.de (8.12.3/8.12.3) with ESMTP id h6TCt0en002368; Tue, 29 Jul 2003 14:55:00 +0200 Received: from bellatrix.tat.physik.uni-tuebingen.de (localhost [127.0.0.1]) by bellatrix.tat.physik.uni-tuebingen.de (8.12.3/8.12.2/SuSE Linux 0.6) with ESMTP id h6TCt0KA004872; Tue, 29 Jul 2003 14:55:00 +0200 Received: from localhost (rguenth@localhost) by bellatrix.tat.physik.uni-tuebingen.de (8.12.3/8.12.3/Submit) with ESMTP id h6TCt0wU004869; Tue, 29 Jul 2003 14:55:00 +0200 X-Authentication-Warning: bellatrix.tat.physik.uni-tuebingen.de: rguenth owned process doing -bs Date: Tue, 29 Jul 2003 13:22:00 -0000 From: Richard Guenther To: Paolo Carlini cc: Steven Bosscher , Gabriel Dos Reis , Subject: Re: std::pow implementation In-Reply-To: <3F266DD6.30607@unitus.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-AntiVirus: checked by AntiVir Milter 1.0.2; AVE 6.20.0.1; VDF 6.20.0.50 X-SW-Source: 2003-07/txt/msg01980.txt.bz2 On Tue, 29 Jul 2003, Paolo Carlini wrote: > Steven Bosscher wrote: > > >I would expect that the RTL inliner can deduce the number of iterations > >and unroll the loop. All other code is dead at that point and you'd end > >up with x*x. > > > Cool! Unfortunately not, double foo2(double x) { pow(x, 2); } gets to (with gcc3.4, __cmath_power declared inline, -O2 -funroll-loops -ffast-math) _Z4foo2d: .LFB12: pushl %ebp # .LCFI4: movl %esp, %ebp #, .LCFI5: fldl 8(%ebp) # x fld1 movl $1, %eax #, __n jmp .L62 # .p2align 4,,7 .L73: fxch %st(1) # .L62: fxch %st(1) # testb $1, %al #, __n fmul %st(0), %st #, je .L59 #, fmul %st, %st(1) #, .L59: shrl %eax # __n jne .L73 #, fstp %st(0) # popl %ebp # ret yay! Richard. -- Richard Guenther WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/