From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8AB613858414; Fri, 26 Jan 2024 19:45:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AB613858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706298341; bh=+DsK6lcp6hS3Hxt2t1fsUGZHAocGKuoLdXqdFb7txiY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wjk3ri2KSQwS5/Yqrjbb/N20KuumJhAPl7mdY04zIYaFtQAyQzFZMDaMvCSKjHD8/ z93ybkX9qLQIt0tqYPHWvrcpDUyetmlHmBoi/qU2x6UvjrArxLhHSMB5J39qhpe6lc dq7qRniwOIHLT275AMP120FfTImg7n+Ea3TpnT4k= From: "kacper.slominski72 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113467] [14 regression] libgcrypt-1.10.3 is miscompiled Date: Fri, 26 Jan 2024 19:45:39 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kacper.slominski72 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created 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=3D113467 Kacper S=C5=82omi=C5=84ski changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kacper.slominski72 at gmai= l dot co | |m --- Comment #26 from Kacper S=C5=82omi=C5=84ski --- Created attachment 57232 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57232&action=3Dedit reduced standalone failing part of the libgcrypt test I've isolated the failing part of the test, inlined the relevant libgcrypt = code and reduced it. Worth noting is that in the bad output, limbs 1-8 (inclusive) are all off b= y 1 vs the good output (limbs 0 and 9-15 stay the same). This is because, when computing the carry, the faulty code adds a whole 8-element vector of 1s to= the output, instead of only a single 1 to the output limb (because the carry lo= op terminates early after one iteration). The faulty generated code is: 8049280: b8 01 00 00 00 mov $0x1,%eax ... x =3D *s1_ptr++ + 1; 804928d: c5 f9 6e c0 vmovd %eax,%xmm0 ... x =3D *s1_ptr++ + 1; 8049296: c4 e2 7d 58 c0 vpbroadcastd %xmm0,%ymm0 804929b: c5 fd fe 42 e0 vpaddd -0x20(%edx),%ymm0,%ymm0 *res_ptr++ =3D x; 80492a0: c5 fe 7f 42 e0 vmovdqu %ymm0,-0x20(%edx) While in the working binary (produced by gcc 13) the relevant code is: x =3D *s1_ptr++ + 1; 1270: 8b 54 81 04 mov 0x4(%ecx,%eax,4),%edx 1274: 42 inc %edx *res_ptr++ =3D x; 1275: 89 54 81 04 mov %edx,0x4(%ecx,%eax,4)=