From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B63543858D33; Fri, 14 Apr 2023 07:28:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B63543858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681457317; bh=nPP4dO56NFXv5fFkTvaKFYna2+b5nFqPNbhXCRvqxM8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KyaW22Ps0Bl66o96tUU8ACwSNL7mXiVvkQ6ovQVADtovqc6a057vqJrOYymhAwIdb aiBIxnKzb2Ysr++5pDQRGZd+n3Mr8ldLgO+PEQublV2iU+yKcfSOvCnFX0xgnzYx6M /tl33U6tAtPjfmtapRN55a0tXHutQzYd4nnkX8vA= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109502] [12/13 Regression] wrong code with -O -ftree-vectorize -fvect-cost-model=unlimited on aarch64 Date: Fri, 14 Apr 2023 07:28:37 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: 12.3 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=3D109502 --- Comment #3 from Richard Biener --- (In reply to Andrew Pinski from comment #2) > (In reply to Andrew Pinski from comment #1) > > SLP transforms: > >=20 > > g.0_1 =3D g; > > _2 =3D g.0_1 =3D=3D 0; > > a_7 =3D (unsigned int) _2; > > _3 =3D a_7 % 6; > > _4 =3D _3 =3D=3D 0; > > _5 =3D (unsigned int) _4; > > a_8 =3D _5 + a_7; > >=20 > > To: > >=20 > > g.0_1 =3D g; > > _2 =3D g.0_1 =3D=3D 0; > > a_7 =3D (unsigned int) _2; > > _3 =3D a_7 % 6; > > _15 =3D {_3, g.0_1}; > > mask__4.4_16 =3D { 0, 0 } =3D=3D _15; > > vect__5.5_19 =3D VIEW_CONVERT_EXPR(mask__4.4_= 16); > > _17 =3D BIT_FIELD_REF ; > > _18 =3D (bool) _17; > > _4 =3D _3 =3D=3D 0; > > _5 =3D (unsigned int) _18; > > _20 =3D .REDUC_PLUS (vect__5.5_19); > > a_8 =3D _20; > >=20 >=20 > If anything there is a missing, a negative after the > reduc_plus (or before) when it translates the bools comparisons into vect= or > comparisons. Indeed. Usually this is the failure of bool pattern detection. unsigned foo (unsigned *p) { unsigned tem1 =3D p[0] =3D=3D 0; unsigned tem2 =3D p[1] =3D=3D 0; unsigned tem3 =3D p[2] =3D=3D 0; unsigned tem4 =3D p[3] =3D=3D 0; return tem1 + tem2 + tem3 + tem4; } doesn't reproduce it - we have put in defences "after the fact" to work around this for some cases: t.c:7:29: note: =3D=3D> examining statement: tem4_16 =3D (unsigned int) _= 8; t.c:7:29: note: vect_is_simple_use: operand _7 =3D=3D 0, type of def: int= ernal t.c:7:29: missed: type conversion to/from bit-precision unsupported. t.c:7:29: note: vect_is_simple_use: operand _7 =3D=3D 0, type of def: int= ernal t.c:7:29: missed: mixed mask and nonmask vector types=