From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16991 invoked by alias); 29 Jul 2003 14:35:42 -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 16881 invoked from network); 29 Jul 2003 14:35:38 -0000 Received: from unknown (HELO mx01.uni-tuebingen.de) (134.2.3.11) by sources.redhat.com with SMTP; 29 Jul 2003 14:35:38 -0000 Received: from bellatrix.tat.physik.uni-tuebingen.de (bellatrix.tat.physik.uni-tuebingen.de [134.2.170.113]) by mx01.uni-tuebingen.de (8.12.3/8.12.3) with ESMTP id h6TEZa0w026385; Tue, 29 Jul 2003 16:35:36 +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 h6TEZaKA020063; Tue, 29 Jul 2003 16:35:36 +0200 Received: from localhost (rguenth@localhost) by bellatrix.tat.physik.uni-tuebingen.de (8.12.3/8.12.3/Submit) with ESMTP id h6TEZaDu020059; Tue, 29 Jul 2003 16:35:36 +0200 X-Authentication-Warning: bellatrix.tat.physik.uni-tuebingen.de: rguenth owned process doing -bs Date: Tue, 29 Jul 2003 15:24:00 -0000 From: Richard Guenther To: Gabriel Dos Reis cc: Steven Bosscher , Subject: Re: std::pow implementation In-Reply-To: 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/msg02002.txt.bz2 If we go back to the original question, wether std::__pow_helper and std::__cmath_power are good implementations, please. It has been shown that the current gcc unroller is not able to unroll the while loop in std::__cmath_power() and such even inlining does not help to create good code. Also inlining the loop if it is not unrolled and its contents not sufficiently cprop'ed is harmful. Isnt what one would expect to inline for constant and small __n only? This we can make work using __builtin_constant_p() as proposed. This would work for gcc3.3, too. For gcc3.4 we may want to rely on __builtin_pow() instead (which calls libc pow() for not expanded cases which may be slower than the pow(T, int) overload for small n). Richard. -- Richard Guenther WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/