From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A7C1E3842426; Tue, 4 Aug 2020 14:59:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7C1E3842426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596553164; bh=mXkT+cBfA3l1sVfYw2lQHoHlTTrfJO9DWN+HJ5LBNFI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eY+qsjLIaXzgKtW4LS8fAIg30n0QAFkEeBEFLdy3c7QQjp373TfuCP7jzJAffs5lM qyvOoqSzszWwkEsqQ/LwHv5wq8VBClnrC9TMjUupql2O/LxT1pUeKCZwTO60axJkbU 5kurfCCxRFW0JNCx/W4RWRYzn4M1VVCN1esw0pz0= 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: Tue, 04 Aug 2020 14:59:24 +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: Tue, 04 Aug 2020 14:59:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96373 --- Comment #4 from rsandifo at gcc dot gnu.org --- (In reply to Richard Biener from comment #2) > (In reply to rsandifo@gcc.gnu.org from comment #1) > > I could have sworn there was a reason why we didn't do this, > > on the basis that we already failed to take FP exceptions into > > account when vectorising normal gassigns. But I can't remember > > what the reason was now, or find any notes about it. :-( >=20 > Well, we refuse to if-convert a stmt that can possibly trap. > whilelo is like "if-conversion" here. Not sure what's the reason > to ever excempt stmts from the while mask. Exempting them is mostly an optimisation. After vectorisation we lose the information about whether the predication is optional or required for correctness, so we have to assume that it's required for correctness. > > Anyway, we have all the infrastructure to do it, so it should > > be easy to fix. >=20 > So for if-conversion it is >=20 > if ((! gimple_vuse (stmt) > || gimple_could_trap_p_1 (stmt, false, false) > || ! ifcvt_memrefs_wont_trap (stmt, refs)) > && gimple_could_trap_p (stmt)) > { > if (ifcvt_can_predicate (stmt)) > { > gimple_set_plf (stmt, GF_PLF_2, true); > need_to_predicate =3D true; > return true; >=20 > which means for non-memory gimple_could_trap_p (stmt) - sth you can > easily check I guess. Yeah.=