From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2DF33858D1E; Mon, 9 Jan 2023 16:22:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2DF33858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673281335; bh=01n8iVMPYE3PKQKJprLOvBeWOEOwiWk115ZoL3DrFIs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hiw7pAWYG/iAo/txEIqm2/NybWDnmHL462Qy4DguF+he5fnfDtu+tZd9ZFgPFVfvw ycxeZy0MfF2bN082VoBUEIEC4LxWxeF1ftTKkVXKCClUUgPIUKEJjE1P+uy/Q8OSuY s2vedN/IjjUJ8jrBEceMn0GEPYb65TP30OvNaqdI= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108341] argument to `__builtin_ctz` should be assumed non-zero Date: Mon, 09 Jan 2023 16:22:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108341 --- Comment #3 from Andrew Pinski --- Not always. It depends on the definition of CTZ_DEFINED_VALUE_AT_ZERO. /* The value at zero is only defined for the BMI instructions LZCNT and TZCNT, not the BSR/BSF insns in the original isa. */ #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ ((VALUE) =3D GET_MODE_BITSIZE (MODE), TARGET_BMI ? 2 : 0) #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ ((VALUE) =3D GET_MODE_BITSIZE (MODE), TARGET_LZCNT ? 2 : 0) So assuming !=3D0 with -mbmi would be an invalid assumitation.=