From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 31794385040B; Wed, 5 Aug 2020 13:02:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31794385040B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596632552; bh=77NDt1G/AIhixbr8+T+GbTdtNMgwn7zTBLHVSoyRYtQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vPgR8ppZUcH1N/bjciR7P8A0AFVKQ3Aku/skh91ruX46TCqLljIEzQG42AqCfMTrH CxHoG0+LFoQKWsVkgxk8gsvJ2HjhG7j5Icq+Vreu8GbJL2BYNdQNMCJsmF1cHCqvyt k4ecdXIMtnx542XhXkw40l+7lcOmZnf4kbenmD5M= From: "matz 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 13:02:31 +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: matz 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 13:02:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96373 --- Comment #11 from Michael Matz --- (In reply to rguenther@suse.de from comment #9) > How do we represent sNaNs with -fnon-call-exceptions? That is, I think we're currently simply buggy at various stages as soon as sNaNs are involved _and_ STDC FENV_ACCESS is ON. > y_1 =3D x_2 + 1.; >=20 > may trap. Does >=20 > foo (x_2); >=20 > get transformed to >=20 > tem_3 =3D x_2; > foo (tem_3); >=20 > and the SSA assignment now traps dependent on whether the call > ABI requires pushing x_2 to a stack slot (which might trap)? If copying a sNaN (to registers or memory) signals an invalid-op depends on= the CPU (and is implementation defined in ieee754). And GCC doesn't necessarily preserve such signals even on CPUs that do signal (if there are any), becau= se it could e.g. use integer stores to transfer the bit patterns. > sNaNs are odd anyway I guess. > But yes, a pure function can still trap (and also throw). >=20 > I think we don't have a good notion for trappingness of calls > and I do expect inconsistencies here. __builtin_sqrtf isn't an arbitrary call. FP operations aren't arbitrary expressions. We don't really have the problem of generating calls to arbitrary arguments out of the blue, not even with non-throwing calls. I'm not sure = if we should mix this problem here with that more generic problem. Btw, that we if-convert calls to builtinf_sqrt is indeed a bug without special options giving a license for that. But doing that for the original testcase instead of the division would _not_ be a problem on SVE: the inact= ive lanes are zeroed and that doesn't signal anything for square root. (We could perhaps extend the meaning of -fno-math-errno to give this licens= e, i.e. guarantee that the user hasn't enabled stops for any FP exceptions; but that might be too aggressive).=