From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 8561B3858D3C; Sun, 5 Nov 2023 19:55:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8561B3858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8561B3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699214113; cv=none; b=UMPpaLD8ko5z9l3HefTSM1DSxg1GPa9i0GliOJS79HapVlEaH9/1eK6cCII25ZezSLveb3ixqeC2QaH36JZ9VpA2QYe+ZsY7le1fWb13ZJZtVwv1sliNfu/2MsIh/ElFIgV3DvqVLl2ttZVnOV2BQilNAzYfTCSxmpOdbPwlGU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699214113; c=relaxed/simple; bh=0gXnG29w3/p7TGZ8wy6lzRZT1+4ZVjyi0gA0hld6SKA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=fxTrM6OsCL57zyOSLHYJWrEFygf2Amkmb+47TS3T4a38/WM47zQVZtWNCnfLy8EmIGbdYuFbE4f9K/MKT7Jzp44BbJ6UQAbtn4E9E/+pY1lGDgm9HTnuwBO93ANYF1Lne5qSA9qi2udM637oyQbSCWAqjfeacWoAQwi0HRahovk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2800f7c8125so3848080a91.1; Sun, 05 Nov 2023 11:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699214111; x=1699818911; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fYnegHOb7gt+sxw9LggsQMZb374eBSQte0/epviBKj4=; b=hcaHjCKxgsX6BJlOauxGgH5o5DebbfSZ2fj5AHIVG3d59qS1uX4D5sk20wgrT8ZHhH MvMJUJR3Iml0TiTk6GzRINX7pDSEteFdIhNmgk9iBaKEsQRd8wv9/q5Ue06ihaSnSoa3 AccEo5FaYNWIRwEIPMv6hwwbgjMPb7IaKJJTuWkpxkWyhdvEYnx2VIgCiqGdpClNmQAG KfhISRnDSsZCQ15K19Az8P6DM8nHWKWcYYu46nuM5S01VYh+0C5L2NNKmmR6kCWNoqyA CgGb2z3E1DWqoICdt62KaHSDTzvtqjJYDZOdJknIOVZUrkYfHPyBUZGiGxu+sGAUohCQ j0Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699214111; x=1699818911; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fYnegHOb7gt+sxw9LggsQMZb374eBSQte0/epviBKj4=; b=V9C0WYvicr5th1gpf6iWkpzCToaPBhtXRd3bqvC9swjj4dC02TLlB/UxtYTlonwViL z35eq6p/bfg4rgr8RrGG/C8h3Gr0Lv88uod8bDSivCm5oZJFZEymOEMUlNnoomItnoFL vA5SZRaDLVxNDI6udnTDMUFFDI4wYFhXXg7j1wbbjxyoGxG6VtomYh25ae0Q1qCBakpM /ap6SfMM0ZjbLc0TuTxFrAwOxuggemwve3DpCfOh7fqSMwzqjyqZuWIkG6mAVFMxoPRX jdoTZ4reKEB1BX6u17aXRUwI0XR5ikcORF66qyezae0sAvjIaEV3jamcqb3rlPYcL1Jv V3CQ== X-Gm-Message-State: AOJu0YxD4LzSuOKRQyiTpVvp2vGXa4q+dflZjueNqvH/yhohCcbpOPnu aVILApeKzYoWdFdoVaJyptyoujNyuMeQhr/0YXQ= X-Google-Smtp-Source: AGHT+IFfqKAMm352NrE3Y/VL+HZt9PRehjELWk+9qWVVyEx8NjrwZI/8H2g8PDwRF0vhJMvUYBpXJdGLiLh+PqO/KaI= X-Received: by 2002:a17:90a:fb94:b0:280:4796:59b8 with SMTP id cp20-20020a17090afb9400b00280479659b8mr12797920pjb.9.1699214111151; Sun, 05 Nov 2023 11:55:11 -0800 (PST) MIME-Version: 1.0 References: <2c114d39-4c87-65a1-3371-63e856cd0d37@inria.fr> In-Reply-To: From: Andrew Pinski Date: Sun, 5 Nov 2023 11:54:59 -0800 Message-ID: Subject: Re: [PATCH] Remove unnecessary "& 1" in year_month_day_last::day() To: cassio.neri@gmail.com Cc: libstdc++@gcc.gnu.org, Gcc-patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Nov 5, 2023 at 9:13=E2=80=AFAM Cassio Neri = wrote: > > I could not find any entry in gcc's bugzilla for that. Perhaps my search = wasn't good enough. I filed https://gcc.gnu.org/PR112395 with a first attempt at the patch (will double check it soon). Thanks, Andrew > > > On Sun, 5 Nov 2023 at 15:58, Marc Glisse wrote: >> >> On Sun, 5 Nov 2023, Cassio Neri wrote: >> >> > When year_month_day_last::day() was implemented, Dr. Matthias Kretz re= alised >> > that the operation "& 1" wasn't necessary but we did not patch it at t= hat >> > time. This patch removes the unnecessary operation. >> >> Is there an entry in gcc's bugzilla about having the optimizer handle th= is >> kind of optimization? >> >> unsigned f(unsigned x){ >> if(x>=3D32)__builtin_unreachable(); >> return 30|(x&1); // --> 30|x >> } >> >> (that optimization would come in addition to your patch, doing the >> optimization by hand is still a good idea) >> >> It looks like the criterion would be a|(b&c) when the possible 1 bits of= b >> are included in the certainly 1 bits of a|c. >> >> -- >> Marc Glisse