Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1095967rwb; Thu, 10 Nov 2022 11:06:28 -0800 (PST) X-Google-Smtp-Source: AMsMyM65oHYUFnNkn4pqPdu9T0vR02Mr5k0kqypFRwMIsLfgVQL+z9wkL5/Fj7B/TQHaNFSapa30 X-Received: by 2002:a17:906:9be5:b0:7ae:3684:2118 with SMTP id de37-20020a1709069be500b007ae36842118mr3469241ejc.127.1668107188459; Thu, 10 Nov 2022 11:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668107188; cv=none; d=google.com; s=arc-20160816; b=tNrzItYEmnZaKXMqK3Db9Py0uwB4Ye1h73xg19iZDTOsYXpL+z189nEdUYGSfKhoJI MGQWe8M+ilvb7UDpBU7/phDW7lX8vIL6H70eQ1aK0raTIvoo+rZPRUetU6XbfxED8R0M 6k68ZzmA6X5lhU95N6wZEglB4f/9/nSj6xw7aEN5zs5K6zFtMu5cpCbck+8boyf2hwxb T2i2WtVIKv6Jc1YPTP1acs65u2c8tiMJ1llPmKAgd+RBRjPP7x4lB/vLAUIE24paArjJ I4DUCE7S+qAbRWXWBPvp7YSOI3j13IdZNvHZigrSeYG9zuFX+xvPluO2k8hd9hzPamJ2 fmbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oQ4iusZn3r+L1hT830DTYjpIyjYe1oSN3vop8euZ9js=; b=i7Z77BQiNPtsji/kJHTxtJTwWidnlZQ5gdHbbi6god+Jo+NqHVPMOgHVyu4WR8fzG7 fD0gf+ZswvMgx0asUOEZ4TMgfnDlfMMNQgUHkI3i/pRo4QeQb9tsK2PSfhNgTA5VZwho FcmhEXZHU0bwLvPVQb4XfCB1mjb6v0Fv6nfX5daa83lplnl72v4cfj0xf76KRhtPySd5 mOyFMc1z1A5SV5KQMxxcn/MdvXiehgKg1p17KuRVXlW3muqKvdvPxQlPNTYzmW3RwjxI QbkARI2bq8E6ANJsim4WoIUo5aWKuBxPq9bbHoQX+NCQLpthg+PeAmRJCsYSn5xh9KHZ Btgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dX+k1YnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gu7-20020a170906f28700b007adb3888afbsi76951ejb.136.2022.11.10.11.06.05; Thu, 10 Nov 2022 11:06:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dX+k1YnO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbiKJTBY (ORCPT + 93 others); Thu, 10 Nov 2022 14:01:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbiKJTBP (ORCPT ); Thu, 10 Nov 2022 14:01:15 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00F5A31FB9 for ; Thu, 10 Nov 2022 11:01:15 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id e129so2535343pgc.9 for ; Thu, 10 Nov 2022 11:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oQ4iusZn3r+L1hT830DTYjpIyjYe1oSN3vop8euZ9js=; b=dX+k1YnOeAISPqobM+n+g0B46aJ5fAG0J2icXb75RVgG7m4M4JAPreDmVp9TF/QWCx SIYxqYixGj5DCJ6xRMUmqee0H6CdlOFz6QrWkpC8hOaHc43jy0B+bY2R7jhmFP6IOUjQ ZBCWl4wpzdiWXhB5fM0kK+rNoQ+eN33Dr39xn2rBc+htjyWsMzNQsbm4wgHWFhPbAp9v kjNlUwAYLJ5lAupS13Ed36qmjFUCvJki24AMPeH8mwZk+ryLrqd+XSY53Gjpge338tAM focXQhiB6s1N7m5+FGGICce46iDvv5MvpJfmOwJmmMcNN8wX2F0frI8KoPt4xc8vsFOS do/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=oQ4iusZn3r+L1hT830DTYjpIyjYe1oSN3vop8euZ9js=; b=N87Qstn9L/I81cdhJWXQ31LESPKn9eYi1c+1FywU3SIa6YEEN8Re+He1etpzWGsG8I eYVA7zwx+tbQJlwqHh28RBWtPTpqWWg6Gs75dp6phBs73ZdnK2J09+Q8/XEaIJNv2+4q bfEMculcsywkyE4f6ccjH9KF1Ppus6NRNNjYXKDNGZYLAflJLJx4c71rAA9KfLTO/HSJ mlbjqcoo+PkNeX0B5cm572h6BrQTKLq4oxYswlhO/Av/QHPTWnvR77zCLbRfd3bBkODy q5kTsw+GPA7m8yRubz1ElIRnLmG+iiTLNL1biE1XR0ZXJQy4bVKkY6/X+VPas7rtXhRu 2JgQ== X-Gm-Message-State: ACrzQf32OOJuPF4+AwKbZPDvPKPrvALoqRYg7CqaA0yyA7TjHiKkh4GE wPrNkyfm/5HMuSXkoyKLDybM9rDeI0NUq8SB5g7fgQ== X-Received: by 2002:a63:586:0:b0:46f:75bb:cfc4 with SMTP id 128-20020a630586000000b0046f75bbcfc4mr3099016pgf.403.1668106874281; Thu, 10 Nov 2022 11:01:14 -0800 (PST) MIME-Version: 1.0 References: <20221106095106.849154-1-mailhol.vincent@wanadoo.fr> <20221106095106.849154-3-mailhol.vincent@wanadoo.fr> In-Reply-To: <20221106095106.849154-3-mailhol.vincent@wanadoo.fr> From: Nick Desaulniers Date: Thu, 10 Nov 2022 11:01:02 -0800 Message-ID: Subject: Re: [PATCH v1 2/2] x86/asm/bitops: Use __builtin_clz*() to evaluate constant expressions To: Vincent Mailhol Cc: x86@kernel.org, Ingo Molnar , Borislav Petkov , Thomas Gleixner , linux-kernel@vger.kernel.org, Yury Norov , llvm@lists.linux.dev, Borislav Petkov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 6, 2022 at 1:51 AM Vincent Mailhol wrote: > > #ifdef CONFIG_X86_64 > -static __always_inline int fls64(__u64 x) > +static __always_inline int constant_fls64(u64 x) > +{ > + BUILD_BUG_ON(sizeof(unsigned long long) != sizeof(x)); Thanks for the patches! They LGTM; but why do we need this BUILD_BUG_ON here? > + > + if (!x) > + return 0; > + > + return BITS_PER_TYPE(x) - __builtin_clzll(x); > +} -- Thanks, ~Nick Desaulniers