From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C86E0385840F; Sun, 20 Feb 2022 03:58:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C86E0385840F From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104595] unvectorized loop due to bool condition loaded from memory Date: Sun, 20 Feb 2022 03:58:40 +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.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2022 03:58:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104595 --- Comment #3 from Andrew Pinski --- IR in the bool case: _1 =3D pb[i_13]; iftmp.0_7 =3D a[i_13]; iftmp.0_6 =3D b[i_13]; iftmp.0_3 =3D _1 ? iftmp.0_7 : iftmp.0_6; c[i_13] =3D iftmp.0_3; IR in the char case: _1 =3D pc[i_13]; iftmp.1_7 =3D a[i_13]; iftmp.1_6 =3D b[i_13]; iftmp.1_3 =3D _1 =3D=3D 0 ? iftmp.1_6 : iftmp.1_7; c[i_13] =3D iftmp.1_3; details in the bool case: /app/example.cpp:12:21: note: =3D=3D> examining statement: iftmp.0_3 =3D = _1 ? iftmp.0_7 : iftmp.0_6; /app/example.cpp:12:21: note: vect_is_simple_use: operand pb[i_13], type = of def: internal /app/example.cpp:12:21: note: vect_is_simple_use: vectype vector(32) unsi= gned char /app/example.cpp:11:6: missed: not vectorized: relevant stmt not supporte= d: iftmp.0_3 =3D _1 ? iftmp.0_7 : iftmp.0_6; details in the char case: /app/example.cpp:17:21: note: =3D=3D> examining statement: iftmp.1_3 =3D = _1 =3D=3D 0 ? iftmp.1_6 : iftmp.1_7; /app/example.cpp:17:21: note: vect_is_simple_use: operand pc[i_13], type = of def: internal /app/example.cpp:17:21: note: vect_is_simple_use: vectype vector(32) char /app/example.cpp:17:21: note: vect_is_simple_use: operand b[i_13], type of def: internal /app/example.cpp:17:21: note: vect_is_simple_use: vectype vector(32) char /app/example.cpp:17:21: note: vect_is_simple_use: operand a[i_13], type of def: internal /app/example.cpp:17:21: note: vect_is_simple_use: vectype vector(32) char /app/example.cpp:17:21: note: vect_model_simple_cost: inside_cost =3D 4, prologue_cost =3D 4 . It should not be too hard to if we had _1 ? : to change it to _1 !=3D 0 rig= ht?=