From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9BE433858D38; Thu, 28 Dec 2023 04:53:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BE433858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703739239; bh=O5KhDtMyH+0rZvIw5hh89WVfEnOFtSkiWxW6iaMmtoI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tjbU7n39V3L31zZptQM+9LwKeHkm2vDKF+f/G2BcLs12OXvHLveboXituFsxwyk3I 2GMV/Zpm3ZOpita9DurTSduuKxw6wgAEAKGZMY09x62u/zAghzuBeXVQ1HxF14gk4g vwZc0EDTUKquzsdLJSJ7sfwbBo6ULkQtNMRE/5CA= From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113134] gcc does not version loops with early break conditions that don't have side-effects Date: Thu, 28 Dec 2023 04:53:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D113134 --- Comment #15 from Tamar Christina --- (In reply to JuzheZhong from comment #14) > > > > sure, but you can't use BIT_FIELD_REF on VLA vectors. > > >=20 > > > So, for length partial vector. We can use VEC_EXTRACT with index =3D = 0 since > > > VEC_EXTRACT optab allows VLA vectors now for length target. > >=20 > > Sounds good :) >=20 > I wonder whether ARM SVE can also use this approach VEC_EXTRACT with inde= x =3D > 0. >=20 > I guess the only issue is that when mask =3D all zero. That is, there is = no > active elements, What behavior should be here for early break ? That shouldn't happen, in that case you wouldn't have entered the loop. To prevent this there's always a compare of n > 0 at the start of the loops to skip the vector body entirely.=