Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp312101pxu; Wed, 25 Nov 2020 04:00:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYV61jSdTN+IAub3CLDd1vBSSz0JdtM75zRghDviTl/QRT/mDuGxyHQo0Y1r1HXfAoYb9M X-Received: by 2002:a17:906:b791:: with SMTP id dt17mr2941954ejb.438.1606305658522; Wed, 25 Nov 2020 04:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606305658; cv=none; d=google.com; s=arc-20160816; b=equW5RcsXBeDf+hbCNZ79IsVbT821tt+GYtirEnuoH7P96GX3PMfHz03WYSFsfdCy+ DaxsnhP4+SIr/fnYMURV3+126Hv3YUTddkifYk1fja6onkTPYGwwE24VLmSpVGze+GFA aFy+0GcXSW4EqcMLYSLl1FCUgyYckeEBpYGVLSDu2hjDrRnBt5UwcVEG7zG8z1nhKC47 FzZV0aK15wysk2nzJ/xzTI6QyJlJawonojpyUwMZhCTs1SEH0WkP6eZMjAHF8dcrSLZH WMQoiuNbmWKx3ZBTVAb54LzjfJETV7litdhiFcv7WydxeTi5iO4ziIfbxv4JMxm6a5OQ f4sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:subject:references:in-reply-to :cc:to:from; bh=l0if353gVBmhXUGKUCYnwKg7Fwkg9ZR1UymEuqmMXYs=; b=bS47fhgdROapVFKqtbU2jOXfDu8AMyNYKyhpusa2FBQNquY6QwsVS0Hyira1VcKoQh rpllfH5H+47ym36CG37yfgCuXxHVUVfsAiE6L/VQLUrbl7t5HDnfQA9PzPfeOLa/APT0 qGCql5JOA4TQdfNZuWE33EH6Cc1+OVBlj1QJMRklo4BWDDf9bRt1oy28CIBax0sG9mLd c4ieq3Sf0yV07vLnfNHEF3pNta6yavLz81IjkcCdfXuFnE2qVvgUtdDp3sxd9Dr4UdgP yi3wd9FzDeWEkkS4XI7u/UFUC2CBDI2gCBjJryRQX0wep8Veo1nKq1o5doC6nhHzzYvc 9ZWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si1103698edv.118.2020.11.25.04.00.35; Wed, 25 Nov 2020 04:00:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728722AbgKYL5r (ORCPT + 99 others); Wed, 25 Nov 2020 06:57:47 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:51751 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbgKYL5q (ORCPT ); Wed, 25 Nov 2020 06:57:46 -0500 Received: by ozlabs.org (Postfix, from userid 1034) id 4Cgzsf37flz9sVD; Wed, 25 Nov 2020 22:57:41 +1100 (AEDT) From: Michael Ellerman To: Michael Ellerman , Paul Mackerras , jakub@redhat.com, Benjamin Herrenschmidt , Christophe Leroy , segher@kernel.crashing.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org In-Reply-To: <348c2d3f19ffcff8abe50d52513f989c4581d000.1603375524.git.christophe.leroy@csgroup.eu> References: <348c2d3f19ffcff8abe50d52513f989c4581d000.1603375524.git.christophe.leroy@csgroup.eu> Subject: Re: [PATCH] powerpc/bitops: Fix possible undefined behaviour with fls() and fls64() Message-Id: <160630540248.2174375.3049361746995827520.b4-ty@ellerman.id.au> Date: Wed, 25 Nov 2020 22:57:41 +1100 (AEDT) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Oct 2020 14:05:46 +0000 (UTC), Christophe Leroy wrote: > fls() and fls64() are using __builtin_ctz() and _builtin_ctzll(). > On powerpc, those builtins trivially use ctlzw and ctlzd power > instructions. > > Allthough those instructions provide the expected result with > input argument 0, __builtin_ctz() and __builtin_ctzll() are > documented as undefined for value 0. > > [...] Applied to powerpc/next. [1/1] powerpc/bitops: Fix possible undefined behaviour with fls() and fls64() https://git.kernel.org/powerpc/c/1891ef21d92c4801ea082ee8ed478e304ddc6749 cheers