From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A062E3858003 for ; Tue, 16 Nov 2021 00:36:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A062E3858003 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-580-NHuEc7lPOt-GsR418x_b_w-1; Mon, 15 Nov 2021 19:36:10 -0500 X-MC-Unique: NHuEc7lPOt-GsR418x_b_w-1 Received: by mail-qk1-f199.google.com with SMTP id u8-20020a05620a454800b00468482aac5dso4612044qkp.18 for ; Mon, 15 Nov 2021 16:36:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+fhn9jcFK8wM20HBm3uQSxLGO9pbXEGQhCykolYBU9E=; b=oaBhJnPPXP5wqELi4jb4v387obhbe+ATHpGtD0l25lL7o70zPDAGY+STliZq/tNG5j X4p7xxwQygzr5NFVnO2FdUBj4TyJeBevdJPGnLWS5W7eNvbeWLrYcndvkRryGzB/VNNt T6p2nXOV61d3ZDOrNW3zTsytdzZ1dR8P6tVgEMn8bON68jujN5ur/CSBxz67AyJqZh9G ip6iLu1bonqZMJYUS8urmqVhrurEpMbZ50Ooi9rGvKFROWIX0yemu9I02SgJ8Z7r/Zcm /qttDtIXLuigYiOX4kh4+je2Um+TxrKbqMU5twxKc3lyv7ZZCGAnQB2po7T5xxeXoMGW hlpA== X-Gm-Message-State: AOAM532EOqw3KjyLfU+500Wqk1noaltPDJvipfvGfYlgWolSKZEj9FzN NZi5yaIg9rkdvU46tpMocwbNrnzV9Yy+o+aSNQpjig9OCai6mFZBbiPslzCpfYVsPpoii5ADeo2 S6uRom6mqrMo1isI= X-Received: by 2002:a05:6214:4012:: with SMTP id kd18mr41560113qvb.1.1637022969657; Mon, 15 Nov 2021 16:36:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHQMbzkr9yNoRE/oLqPywO56PIWZNztHxvyp8H03XLMNs/1kAr1TrzKFPgvQG2OjoXsMlxsQ== X-Received: by 2002:a05:6214:4012:: with SMTP id kd18mr41560092qvb.1.1637022969498; Mon, 15 Nov 2021 16:36:09 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id c7sm1185845qtc.32.2021.11.15.16.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 16:36:08 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Merge latest Ryu sources Date: Mon, 15 Nov 2021 19:36:07 -0500 Message-Id: <20211116003607.2350853-1-ppalka@redhat.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2021 00:36:13 -0000 The only source change is a speedup to pow5Factor. Tested on x86_64-pc-linux-gnu, does this look OK for trunk? libstdc++-v3/ChangeLog: * src/c++17/ryu/MERGE: Update the commit hash. * src/c++17/ryu/d2s_intrinsics.h: Merge from Ryu's master branch. --- libstdc++-v3/src/c++17/ryu/MERGE | 2 +- libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/src/c++17/ryu/MERGE b/libstdc++-v3/src/c++17/ryu/MERGE index 0ea65add2ff..9035502846e 100644 --- a/libstdc++-v3/src/c++17/ryu/MERGE +++ b/libstdc++-v3/src/c++17/ryu/MERGE @@ -1,4 +1,4 @@ -22c887c017a8512abcd4a8f6bfcdb2742829cd7d +150d0c87830756d34e76c42f7f33f811d89903a8 The first line of this file holds the git revision number of the last merge done from the master library sources. diff --git a/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h b/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h index bbac4dfd48f..e3206b5d7dd 100644 --- a/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h +++ b/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h @@ -181,15 +181,14 @@ static inline uint32_t mod1e9(const uint64_t x) { #endif // defined(RYU_32_BIT_PLATFORM) static inline uint32_t pow5Factor(uint64_t value) { + const uint64_t m_inv_5 = 14757395258967641293u; // 5 * m_inv_5 = 1 (mod 2^64) + const uint64_t n_div_5 = 3689348814741910323u; // #{ n | n = 0 (mod 2^64) } = 2^64 / 5 uint32_t count = 0; for (;;) { assert(value != 0); - const uint64_t q = div5(value); - const uint32_t r = ((uint32_t) value) - 5 * ((uint32_t) q); - if (r != 0) { + value *= m_inv_5; + if (value > n_div_5) break; - } - value = q; ++count; } return count; -- 2.34.0