From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 385503858D20; Fri, 17 May 2024 18:10:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 385503858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715969459; bh=RRDrERy6BjUHtluwpUnAv6c6AIgL5V29WtBdC/IpWqg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dGNLAQ+W31OEWl6ILfjGKx/QtiknVGOc36z4YJtonT+cLNST0gkZLGVxY4upw4qF0 pP3gsU/0EYFTS+TkUIZtHUNan6h4ZPonjqQz+LRpPwflqay7kx0YKJfQxFk5W9wxpu EmwsItJq0vPDOC3lRz2jnxgDAvsUQWQGF68gcc4E= From: "jan.wassenberg at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115115] [12/13/14/15 Regression] highway-1.0.7 wrong _mm_cvttps_epi32() constant fold Date: Fri, 17 May 2024 18:10:58 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jan.wassenberg at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115115 --- Comment #10 from Jan Wassenberg --- We have a workaround. I changed the ConvertTo (round to nearest int) code t= o=20 const auto overflow =3D RebindMask(di, Ge(v, Set(df, 2147483648.0f))); return IfThenElse(overflow, Set(di, LimitsMax()), ConvertInRangeTo= (di, v))); However, this requires an additional workaround, inserting in the middle #if HWY_COMPILER_GCC_ACTUAL v =3D IfThenZeroElse(RebindMask(df, overflow), v); #endif It seems that passing an out of bounds value to _mm_cvtps_epi32 (bug is abo= ut cvttps, but cvtps also had the problem), even if its return value will be unused due to the IfThenElse (blending), still causes breakage. This is unfortunate. Wrapping the workaround in __builtin_constant_p(v) causes it to fail, so it seems the error is not in constant folding.=