From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ECC793857C47; Wed, 5 Aug 2020 10:28:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECC793857C47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596623325; bh=FPQX2GuC4535McSKZI58Db5Xux7Dz+fJFqKRLktscyc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=w7hf2U16VuTPysyj9AsEPjRqBq87rRh98dvO8QVxnELTrsHwY/rJkKmYzJ59iTrWe riX0y+sYSEsftq/Qr6nQ4I9ALVBEFAvclIrHY3NztUKwe+qyTENXZity4Jhyty3oU+ L9UPCjZObkuMDBhbte4BnaUPZWLiKZ54kjPMio9E= From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96373] SVE miscompilation on vectorized division loop, leading to FP exception Date: Wed, 05 Aug 2020 10:28:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rsandifo 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: Wed, 05 Aug 2020 10:28:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96373 --- Comment #8 from rsandifo at gcc dot gnu.org --- (In reply to rguenther@suse.de from comment #7) > On Wed, 5 Aug 2020, rsandifo at gcc dot gnu.org wrote: >=20 > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96373 > >=20 > > --- Comment #6 from rsandifo at gcc dot gnu.org --- > > FWIW, I think the reason I mentioned for skimping on this originally > > was that we don't e.g. prevent if-conversion of: > >=20 > > void > > foo (int *c, float *f) > > { > > for (int i =3D 0; i < 16; ++i) > > f[i] =3D c[i] ? __builtin_sqrtf (f[i]) : f[i]; > > } > >=20 > > for -O2 -ftree-vectorize -fno-math-errno. So it seemed like things > > weren't very consistent. >=20 > I think that's a bug in if-conversion - gimple_could_trap_p only > says that the call instruction itself doesn't trap, it doesn't > say anything about something in the callee body. When's that distinction useful in practice though? It seems odd that an FP x / y is seen as potentially trapping, but a function call that wraps (or might wrap) an FP x / y isn't. > You should need -fno-trapping-math to get the above if-converted. Is there an existing ECF flag that we can check? ECF_NOTHROW is related but seems different enough not to be reliable. And is trapping a =E2=80=9Cside effect=E2=80=9C for the purposes of: /* Nonzero if this is a call to a function whose return value depends=20=20= =20=20=20=20=20=20=20=20=20 solely on its arguments, has no side effects, and does not read=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 global memory. This corresponds to TREE_READONLY for function=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 decls. */ #define ECF_CONST (1 << 0) I.e. can a function still be const (on the basis that a given argument always produces the same result) while still trapping for some arguments? What about pure, where the trapping might come from a memory dereference?=