From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF6DF3858038; Wed, 10 Aug 2022 09:47:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF6DF3858038 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 09:47:07 +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 09:47:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106322 --- Comment #41 from Kewen Lin --- (In reply to Kewen Lin from comment #40) > > >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. >=20 > Good point! This is overkill then. Not sure if there is this kind of rout= ine > to special case them. When I was cooking one function to special case Andrew's concerns, I realiz= ed that the touched functions direct_optab_supported_p, convert_optab_supporte= d_p and multi_vector_optab_supported_p are only for optabs used in internal-fn.= def, for now there are not {and,ior,xor}_optab or their similars (I quickly went through binary/unary ones). So it seems we don't need to consider this for = now?=