From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44288 invoked by alias); 30 May 2017 12:31:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 43580 invoked by uid 89); 30 May 2017 12:31:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=HTo:U*rguenth X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-yw0-f174.google.com Received: from mail-yw0-f174.google.com (HELO mail-yw0-f174.google.com) (209.85.161.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 May 2017 12:31:55 +0000 Received: by mail-yw0-f174.google.com with SMTP id b68so39132489ywe.3; Tue, 30 May 2017 05:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=AvPosftFvdp+MTLR2le48kF705ASKrm/PbFO+SX8iAM=; b=qYcHhRj3xTA8IPNgV/hVFZTz924SmoHEngRNFXv6EtiOtePn3WWb+aLX2szN4CER/X exXesdv5G/oCgpmHWKze0MzwLWOwc0lAeoTz8gZY7//TI+5Ul4mlSbfe90iYqnNCgNXo LW3/LbYoDMWPFmMX7mvMN9IZKZzAD580zT0P9VkiClTbSEqRfWGEw9MrrlmxX9JKcdxy 6SZr07DYm8DbPHPceWwYp6pk2SLDCyl2UQiKD53RiCGQgC+S68UcZX0DucW566bWMonu 0CTF1BPUssInK1fra37UcPeO7CMJbu6s4oJttImhQV+H5vHj/wcW+VMXDSh8biBPcLla 3HiQ== X-Gm-Message-State: AODbwcCLC1wI9qAhBqrTGG0qAvwCUflfZvoifr2daf2xIPpwHAk2Ce9N w3nH5g5S1LqfV4bPH2Xq0dCqHMBsgw== X-Received: by 10.129.71.214 with SMTP id u205mr15948054ywa.174.1496147517518; Tue, 30 May 2017 05:31:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.194.199 with HTTP; Tue, 30 May 2017 05:31:57 -0700 (PDT) In-Reply-To: <87lgpeocnf.fsf@linaro.org> References: <87tw42onqo.fsf@linaro.org> <87lgpeocnf.fsf@linaro.org> From: Yuri Gribov Date: Tue, 30 May 2017 12:35:00 -0000 Message-ID: Subject: Re: [PATCH 3/4 v3][PR 67328] Added bool conversion for wide_ints To: Yuri Gribov , GCC Patches , Alan Modra , rguenth@gcc.gnu.org, richard.sandiford@linaro.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg02267.txt.bz2 On Tue, May 30, 2017 at 11:35 AM, Richard Sandiford wrote: > Yuri Gribov writes: >> On Tue, May 30, 2017 at 7:35 AM, Richard Sandiford >> wrote: >>> Yuri Gribov writes: >>>> From 330209f721a598ec393dcb5d62de3457ee282153 Mon Sep 17 00:00:00 2001 >>>> From: Yury Gribov >>>> Date: Fri, 26 May 2017 07:53:10 +0100 >>>> Subject: [PATCH 3/4] Added bool conversion for wide_ints. >>>> >>>> gcc/ >>>> 2017-05-26 Yury Gribov >>>> >>>> * wide-int.cc (wi::zero_p_large): New method. >>>> * wide-int.h (wi::zero_p): New method. >>> >>> Do you still need this bit? It looks like it isn't used by the other >>> parts of the series. >>> >>> The idea was that wi::eq_p (x, 0) (or just x == 0, if x is a >>> wide-int-based type) is supposed to be as fast as a dedicated zero check. >>> It'd be OK to have a helper function anyway, but it should probably be >>> defined using wi::eq_p. >>> >>> The zero_p_large fallback can never return true, since a zero of >>> any precision will have a length of 1. >> >> Thanks Richard, I'll update the patch. The bool check is used in >> successive patch (4/4), in >> widest_int mask = wi::to_widest (@2); >> bool mask_all_ones_p = !(mask & (mask + 1)); > > Ah, OK. That's equivalent to mask == -1 (or wi::eq_p (@2, -1), to avoid > the temporary). Hm, is it? Current check ensures that N consecutive LSBs are set, not that all bits are set. Perhaps variable name should be changed to reflect this better. > I think it'd be better to use one of those instead. > There's an argument that if ! is defined, it should return an integer > of the same precision as the argument. True. Perhaps I should make separate wide_int operator !() and bool operator bool() -I