From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FB123857373; Wed, 10 Aug 2022 06:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FB123857373 From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106322] [12/13 Regression] tree-vectorize: Wrong code at O2 level (-fno-tree-vectorize is working) since r12-2404-ga1d27560770818c5 Date: Wed, 10 Aug 2022 06:24:22 +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.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: linkw at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.2 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: Wed, 10 Aug 2022 06:24:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106322 --- Comment #40 from Kewen Lin --- > >diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc > >index d666ccccf67..7d8b4ac2200 100644 > >--- a/gcc/internal-fn.cc > >+++ b/gcc/internal-fn.cc > >@@ -3750,7 +3750,12 @@ static bool > > direct_optab_supported_p (direct_optab optab, tree_pair types, > > optimization_type opt_type) > > { > >- machine_mode mode =3D TYPE_MODE (types.first); > >+ tree type =3D types.first; > >+ machine_mode mode =3D TYPE_MODE (type); > >+ /* Scalar mode optab can't work for vector type, return false if > >+ the given type is vector type but the mode isn't vector mode. */ > >+ if (VECTOR_TYPE_P (type) !=3D VECTOR_MODE_P (mode)) > >+ return false; >=20 > There are a few which scalar mode and vector types can differ and still > work: IOR, XOR, and AND. I wonder if those should be special cased here or > somewhere else. Good point! This is overkill then. Not sure if there is this kind of routin= e to special case them.=