From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D2A5C385780D; Wed, 30 Sep 2020 06:30:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2A5C385780D From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/97249] New: Missing vec_select and subreg optimization Date: Wed, 30 Sep 2020 06:30:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone cf_gcchost Message-ID: 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: Wed, 30 Sep 2020 06:30:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97249 Bug ID: 97249 Summary: Missing vec_select and subreg optimization Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: hjl.tools at gmail dot com, wwwhhhyyy333 at gmail dot c= om Target Milestone: --- Host: x86_64-pc-linux-gnu Cat test.c --- void foo (unsigned char* p1, unsigned char* p2, short* __restrict p3) { for (int i =3D 0 ; i !=3D 8; i++) p3[i] =3D p1[i] + p2[i]; return; } --- gcc11 -Ofast -mavx2 test.c got --- foo: .LFB0: .cfi_startproc vmovq (%rdi), %xmm0 vmovq (%rsi), %xmm1 vpmovzxbw %xmm0, %xmm0 vpmovzxbw %xmm1, %xmm1 vpaddw %xmm1, %xmm0, %xmm0 vmovdqu %xmm0, (%rdx) ret .cfi_endproc --- memory operand doesn't propagate into *vpmovzxbw* because rtl didn't simpli= fy --- (insn 9 8 10 2 (set (reg:V8HI 92 [ vect__33.6 ]) (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI (reg:V8QI 91 [ vect__40.5 ]) 0) (parallel [ (const_int 0 [0]) (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) (const_int 5 [0x5]) (const_int 6 [0x6]) (const_int 7 [0x7]) ])))) "test.c":5:16 4638 {sse4_1_zero_extendv8qiv8hi2} (expr_list:REG_DEAD (reg:V8QI 91 [ vect__40.5 ]) (nil))) ---=20 to=20 --- (insn 9 8 10 2 (set (reg:V8HI 92 [ vect__33.6 ]) (zero_extend:V8HI (reg:V8QI 91 [ vect__40.5 ])))) "test.c":5:16 4638 {sse4_1_zero_extendv8qiv8hi2} (expr_list:REG_DEAD (reg:V8QI 91 [ vect__40.5 ]) (nil))) --- Similar for other vector modes.=