From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B6F73383F851; Fri, 5 Mar 2021 14:23:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6F73383F851 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/99409] New: s252 benchmark of TSVC is vectorized by clang and not by gcc Date: Fri, 05 Mar 2021 14:23:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone 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: Fri, 05 Mar 2021 14:23:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99409 Bug ID: 99409 Summary: s252 benchmark of TSVC is vectorized by clang and not by gcc Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hubicka at gcc dot gnu.org Target Milestone: --- typedef float real_t; #define iterations 100000 #define LEN_1D 32000 #define LEN_2D 256 real_t a[LEN_1D],b[LEN_1D],c[LEN_1D],d[LEN_1D],e[LEN_1D]; void main() { // scalar and array expansion // loop with ambiguous scalar temporary real_t t, s; for (int nl =3D 0; nl < iterations; nl++) { t =3D (real_t) 0.; for (int i =3D 0; i < LEN_1D; i++) { s =3D b[i] * c[i]; a[i] =3D s + t; t =3D s; } } } clang does: main: # @main .cfi_startproc # %bb.0: xorl %eax, %eax .p2align 4, 0x90 .LBB0_1: # =3D>This Loop Header: Depth=3D1 # Child Loop BB0_2 Depth 2 vxorps %xmm0, %xmm0, %xmm0 movq $-128000, %rcx # imm =3D 0xFFFE0C00 .p2align 4, 0x90 .LBB0_2: # Parent Loop BB0_1 Depth=3D1 # =3D> This Inner Loop Header: Dep= th=3D2 vmovups c+128000(%rcx), %ymm1 vmovups c+128032(%rcx), %ymm2 vmovups c+128064(%rcx), %ymm3 vmovups c+128096(%rcx), %ymm4 vmulps b+128000(%rcx), %ymm1, %ymm1 vmulps b+128032(%rcx), %ymm2, %ymm2 vmulps b+128064(%rcx), %ymm3, %ymm3 vmulps b+128096(%rcx), %ymm4, %ymm4 vperm2f128 $33, %ymm1, %ymm0, %ymm0 # ymm0 =3D ymm0[2,3],ymm1[= 0,1] vperm2f128 $33, %ymm2, %ymm1, %ymm5 # ymm5 =3D ymm1[2,3],ymm2[= 0,1] vperm2f128 $33, %ymm3, %ymm2, %ymm6 # ymm6 =3D ymm2[2,3],ymm3[= 0,1] vperm2f128 $33, %ymm4, %ymm3, %ymm7 # ymm7 =3D ymm3[2,3],ymm4[= 0,1] vshufps $3, %ymm1, %ymm0, %ymm0 # ymm0 =3D ymm0[3,0],ymm1[0,0],ymm0[7,4],ymm1[4,4] vshufps $3, %ymm2, %ymm5, %ymm5 # ymm5 =3D ymm5[3,0],ymm2[0,0],ymm5[7,4],ymm2[4,4] vshufps $3, %ymm3, %ymm6, %ymm6 # ymm6 =3D ymm6[3,0],ymm3[0,0],ymm6[7,4],ymm3[4,4] vshufps $3, %ymm4, %ymm7, %ymm7 # ymm7 =3D ymm7[3,0],ymm4[0,0],ymm7[7,4],ymm4[4,4] vshufps $152, %ymm1, %ymm0, %ymm0 # ymm0 =3D ymm0[0,2],ymm1[1,2],ymm0[4,6],ymm1[5,6] vshufps $152, %ymm2, %ymm5, %ymm5 # ymm5 =3D ymm5[0,2],ymm2[1,2],ymm5[4,6],ymm2[5,6] vshufps $152, %ymm3, %ymm6, %ymm6 # ymm6 =3D ymm6[0,2],ymm3[1,2],ymm6[4,6],ymm3[5,6] vshufps $152, %ymm4, %ymm7, %ymm7 # ymm7 =3D ymm7[0,2],ymm4[1,2],ymm7[4,6],ymm4[5,6] vaddps %ymm0, %ymm1, %ymm0 vaddps %ymm5, %ymm2, %ymm1 vaddps %ymm6, %ymm3, %ymm2 vaddps %ymm7, %ymm4, %ymm3 vmovups %ymm0, a+128000(%rcx) vmovups %ymm1, a+128032(%rcx) vmovups %ymm2, a+128064(%rcx) vmovups %ymm3, a+128096(%rcx) subq $-128, %rcx vmovaps %ymm4, %ymm0 jne .LBB0_2 # %bb.3: # in Loop: Header=3DBB0_1 Depth= =3D1 incl %eax cmpl $100000, %eax # imm =3D 0x186A0 jne .LBB0_1 # %bb.4: vzeroupper retq s252.c:18:27: note: worklist: examine stmt: _3 =3D s_11 + t_21; s252.c:18:27: note: vect_is_simple_use: operand _1 * _2, type of def: internal s252.c:18:27: note: mark relevant 5, live 0: s_11 =3D _1 * _2; s252.c:18:27: note: vect_is_simple_use: operand t_21 =3D PHI , type of def: unknown s252.c:18:27: missed: Unsupported pattern. s252.c:20:22: missed: not vectorized: unsupported use in stmt. s252.c:18:27: missed: unexpected pattern. [local count: 1052266996]: [local count: 1063004409]: # t_21 =3D PHI # i_23 =3D PHI # ivtmp_20 =3D PHI _1 =3D b[i_23]; _2 =3D c[i_23]; s_11 =3D _1 * _2; _3 =3D s_11 + t_21; a[i_23] =3D _3; i_13 =3D i_23 + 1; ivtmp_19 =3D ivtmp_20 - 1; if (ivtmp_19 !=3D 0) goto ; [98.99%] else goto ; [1.01%]=