From patchwork Tue Feb 19 21:51:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 221902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 243FB2C0089 for ; Wed, 20 Feb 2013 08:52:05 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361915526; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=41WfUdQx18GLTWNN2dFW 9hR0KF0=; b=ZTaQAaQlfEcJwrQxs8SmzIMFjdbhuU97VTz4N2dK/d5haqyyR6ti 3plrB4WpQuYospVpqHNRmvm1m9hJn++Hzl6zMe16N0RJ2G3vsP6C6JBwVfBOB9Ls w3O9GXr2q59XdRFLbfdn8DRtneFAlYEABK+0ThKNzH3mp/KvqmRufpY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ezJ2IpIxQZd26Y2wpSEU3fz8uP3kBzEmoOyFDxzhllnGRSjgnjdk21A1BiVxoy 0rB63Geq3FV1bCr3sye0KsWeJFYAH3DBCzp85YuglJm2kshv78uU6+t/PNp9Z6wz hNYk6hgBdYARUZCUw0l5S9aov9ZlOQJioTvh48EJQ+GYg=; Received: (qmail 12702 invoked by alias); 19 Feb 2013 21:52:00 -0000 Received: (qmail 12693 invoked by uid 22791); 19 Feb 2013 21:52:00 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_IB X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Feb 2013 21:51:52 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1JLpp5X006244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Feb 2013 16:51:51 -0500 Received: from zalov.redhat.com (vpn1-7-182.ams2.redhat.com [10.36.7.182]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1JLpnvY027291 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Feb 2013 16:51:51 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id r1JLpn5Q027471 for ; Tue, 19 Feb 2013 22:51:49 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r1JLpnHO027427 for gcc-patches@gcc.gnu.org; Tue, 19 Feb 2013 22:51:49 +0100 Date: Tue, 19 Feb 2013 22:51:48 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix libquadmath strtoflt128 at -O0 (PR libquadmath/56379) Message-ID: <20130219215148.GN1215@tucnak.zalov.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! I've committed to trunk what has been accepted earlier today for glibc strtod_l.c, a fix for -O0 compilation of the file. Bootstrapped/regtested on x86_64-linux and i686-linux. 2013-02-19 Jakub Jelinek PR libquadmath/56379 * strtod/strtod_l.c (mpn_lshift_1): Rewritten as function-like macro. Jakub --- libquadmath/strtod/strtod_l.c +++ libquadmath/strtod/strtod_l.c @@ -444,28 +444,30 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize, /* Shift {PTR, SIZE} COUNT bits to the left, and fill the vacated bits with the COUNT most significant bits of LIMB. - Tege doesn't like this function so I have to write it here myself. :) + Implemented as a macro, so that __builtin_constant_p works even at -O0. + + Tege doesn't like this macro so I have to write it here myself. :) --drepper */ -static inline void -__attribute ((always_inline)) -mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count, - mp_limb_t limb) -{ - if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) - { - /* Optimize the case of shifting by exactly a word: - just copy words, with no actual bit-shifting. */ - mp_size_t i; - for (i = size - 1; i > 0; --i) - ptr[i] = ptr[i - 1]; - ptr[0] = limb; - } - else - { - (void) mpn_lshift (ptr, ptr, size, count); - ptr[0] |= limb >> (BITS_PER_MP_LIMB - count); - } -} +#define mpn_lshift_1(ptr, size, count, limb) \ + do \ + { \ + mp_limb_t *__ptr = (ptr); \ + if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) \ + { \ + mp_size_t i; \ + for (i = (size) - 1; i > 0; --i) \ + __ptr[i] = __ptr[i - 1]; \ + __ptr[0] = (limb); \ + } \ + else \ + { \ + /* We assume count > 0 && count < BITS_PER_MP_LIMB here. */ \ + unsigned int __count = (count); \ + (void) mpn_lshift (__ptr, __ptr, size, __count); \ + __ptr[0] |= (limb) >> (BITS_PER_MP_LIMB - __count); \ + } \ + } \ + while (0) #define INTERNAL(x) INTERNAL1(x)