From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 173033858C2C; Tue, 4 Jan 2022 21:03:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 173033858C2C From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103905] [12 Regression] Miscompiled i386-expand.c with -march=bdver1 and -O3 since r12-1789-g836328b2c99f5b8d Date: Tue, 04 Jan 2022 21:03:44 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak 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.0 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 Jan 2022 21:03:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103905 --- Comment #3 from Uro=C5=A1 Bizjak --- (In reply to Martin Li=C5=A1ka from comment #1) > Created attachment 52120 [details] > Isolated test-case >=20 > Isolated test-case where only the miscompiled function > ix86_expand_vec_extract_even_odd uses -O3. >=20 > @Uros: Can you please compare -fdump-tree-optimized before and after the > revision? When compiled with -O2 -march=3Dbdver1, there are indeed a bunch of suspici= ous XOP vpperm instructions in the function: vmovd 12(%rsp), %xmm6 # 303 [c=3D9 l=3D6] *movsi_internal/10 vpperm %xmm3, %xmm0, %xmm1, %xmm0 # 124 [c=3D4 l=3D5] mmx_= ppermv64 vpaddd %xmm4, %xmm1, %xmm1 # 129 [c=3D8 l=3D4] *mmx_addv2si= 3/2 vpperm %xmm3, %xmm1, %xmm2, %xmm1 # 131 [c=3D4 l=3D5] mmx_= ppermv64 vpperm .LC165(%rip), %xmm1, %xmm0, %xmm0 # 134 [c=3D13 l= =3D9]=20 mmx_ppermv64 vpaddb %xmm0, %xmm0, %xmm0 # 137 [c=3D8 l=3D4] *mmx_addv8qi= 3/2 vpshuflw $0, %xmm6, %xmm1 # 140 [c=3D8 l=3D5]=20 *vec_dupv4hi/1 vpaddb %xmm1, %xmm0, %xmm0 # 142 [c=3D8 l=3D4] *mmx_addv8qi= 3/2 vmovq %xmm0, 32(%rsp,%rdi) # 143 [c=3D4 l=3D6] *movv8qi_int= ernal/14 je .L4198 # 150 [c=3D12 l=3D2] *jcc I was not able to test them on my target, so I bet these are the problem.=