From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9FEF13858D20; Sat, 18 May 2024 10:10:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FEF13858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716027004; bh=dDkZaFRgNuM1qCJUV9SYfyY2lApGrGTRKBChq7nbbWE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mij1m11mMMqb4NRwipzNrDVyBeE8ZS0LEkqJuaf2N5edC8LQBkLM6lOhKO2KP5fCa oYtJGm4/PNc6JyPObHKTx6aeTqo3SFgvXfI6f9OGSiUtb9x95WpAI/SxJNkoGAJqgN lgFt74A4/u5q4dVS4+nnhaIjeC8L4zh0rIAg9k28= From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115146] [15 Regression] Incorrect 8-byte vectorization: psrlw/psraw confusion Date: Sat, 18 May 2024 10:10:04 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org 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: --- 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=3D115146 --- Comment #1 from Sergei Trofimovich --- Specifically if I change original example to contain 16 bytes instead of 8: --- bug.c.orig 2024-05-18 11:07:47.426351557 +0100 +++ bug.c 2024-05-18 11:08:02.135601287 +0100 @@ -15,2 +15,2 @@ - u8 src[8] __attribute__((aligned(16))) =3D { 0 }; - u8 dst[8] __attribute__((aligned(16))) =3D { 0 }; + u8 src[16] __attribute__((aligned(16))) =3D { 0 }; + u8 dst[16] __attribute__((aligned(16))) =3D { 0 }; @@ -23 +23 @@ - for (unsigned long i =3D 0; i < 8; i +=3D 2) { + for (unsigned long i =3D 0; i < 16; i +=3D 2) { I get expected code: Dump of assembler code for function main: 0x0000000000401030 <+0>: sub $0x28,%rsp 0x0000000000401034 <+4>: pxor %xmm0,%xmm0 0x0000000000401038 <+8>: mov %rsp,%rdi 0x000000000040103b <+11>: movaps %xmm0,(%rsp) 0x000000000040103f <+15>: movaps %xmm0,0x10(%rsp) 0x0000000000401044 <+20>: call 0x401170 0x0000000000401049 <+25>: movdqa (%rsp),%xmm0 0x000000000040104e <+30>: lea 0x10(%rsp),%rdi 0x0000000000401053 <+35>: movdqa %xmm0,%xmm1 0x0000000000401057 <+39>: psllw $0x8,%xmm0 0x000000000040105c <+44>: psrlw $0x8,%xmm1 0x0000000000401061 <+49>: por %xmm0,%xmm1 0x0000000000401065 <+53>: movaps %xmm1,0x10(%rsp) 0x000000000040106a <+58>: call 0x401180 0x000000000040106f <+63>: xor %eax,%eax 0x0000000000401071 <+65>: add $0x28,%rsp 0x0000000000401075 <+69>: ret=