From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 60C343858418; Tue, 12 Dec 2023 10:27:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60C343858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702376850; bh=Fidrzm3oZ2Wuzx8ZwIGwoi/VIIwEKXBvLyoiMInI5l0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ix+crUu4++huLGTdytgFrZ+OmDgVjInz1CdkEcELCpLKYj5r/82RXdRGb1394+mHM As6urIEOSkH+0ZJlNjAiYGjU8+PSBgT+yQyvEVn4enjprXIyC1Mu/kqTo0qxhK2dOA q+BpDQjfRoyHaRKxXecNjd/m6EeCNu8MLRsp06+E= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111683] [11/12/13/14 Regression] Incorrect answer when using SSE2 intrinsics with -O3 Date: Tue, 12 Dec 2023 10:27:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: needs-reduction, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc keywords 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=3D111683 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Keywords|needs-bisection | --- Comment #4 from Jakub Jelinek --- Started with r7-3163-g973625a04b3d9351f2485e37f7d3382af2aed87e Slightly reduced: #include void convn_script(const double in9[10], const double in10[7], double out5[1= 6]) { int iB =3D 0; int iC =3D 0; __builtin_memset(&out5[0], 0, 16U * sizeof(double)); for (int i =3D 0; i < 7; i++) { int b_i; int vectorUB; if (i + 10 <=3D 15) b_i =3D 9; else b_i =3D 15 - i; vectorUB =3D (((b_i + 1) / 2) << 1) - 2; for (int r =3D 0; r <=3D vectorUB; r +=3D 2) { __m128d b_r; b_i =3D iC + r; b_r =3D _mm_loadu_pd(&out5[b_i]); _mm_storeu_pd(&out5[b_i], _mm_add_pd(b_r, _mm_mul_pd(_mm_set1_pd(in10[iB]), _mm_loadu_pd(&in9[r])))); } iC =3D iB + 1; iB++; } } int main() { double in9[10] =3D {0.8147, 0.9058, 0.1270, 0.9134, 0.6324, 0.0975, 0.278= 5, 0.5469, 0.9575, 0.9649}; double in10[7] =3D {0.1576, 0.9706, 0.9572, 0.4854, 0.8003, 0.1419, 0.421= 8}; double out5[16]; convn_script(in9, in10, out5); for(int i =3D 0; i < 16; i++) __builtin_printf ("%d %f\n", i, out5[i]); }=