From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 06E8B3860C38; Mon, 31 Aug 2020 10:15:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06E8B3860C38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598868922; bh=eiC1qxffYzVVLue+3jXnTS3E90FEFKd4TztDaPInTCY=; h=From:To:Subject:Date:From; b=NL/llaQ1+B1ptEhdWsMcLW55GOyykxgOTxHQSdwPQkxC86pu9omP9argJUxfI35M7 HhPfatR1AngWEefqXBEqxK3nHRB1F9sh7tOMpH8Be+2hnZsROrdRQhj+c+ct99G32N BK0BHWI7lmkGHETW2ktul4PKZa6pRfOv4c0KJp6w= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96864] New: loop not vectorized due to cost model Date: Mon, 31 Aug 2020 10:15:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: 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 bug_severity priority component assigned_to reporter cc 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: Mon, 31 Aug 2020 10:15:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96864 Bug ID: 96864 Summary: loop not vectorized due to cost model Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: hjl.tools at gmail dot com Target Milestone: --- cat test.c --- double d1[1024], d2[1024]; char c1[1024]; int test4(int n) { int i; for (int i =3D 0; i < 1024; i++) c1[i] =3D d1[i] > d2[i] ? c1[i] : 1; } --- loop is not vectorized with under -mtune=3Dskylake-avx512 but success with -mtune=3Dgeneric Refer to https://godbolt.org/z/xPGhTh output of -fopt-info-all --- Unit growth for small function inlining: 16->16 (0%) Inlined 0 calls, eliminated 0 functions test.c:6:5: missed: couldn't vectorize loop test.c:7:17: missed: not vectorized: no vectype for stmt: _1 =3D d1[i_13]; scalar_type: double test.c:6:5: note: ***** Analysis failed with vector mode V4DF test.c:6:5: note: ***** Skipping vector mode V32QI, which would repeat the analysis for V4DF test.c:3:5: note: vectorized 0 loops in function. test.c:3:5: note: ***** Analysis failed with vector mode VOID test.c:7:13: note: ***** Analysis failed with vector mode V4DF test.c:7:13: note: ***** Skipping vector mode V32QI, which would repeat the analysis for V4DF test.c:7:13: note: ***** Analysis failed with vector mode V32QI test.c:7:13: note: ***** Skipping vector mode V32QI, which would repeat the analysis for V32QI test.c:6:5: note: ***** Analysis failed with vector mode V32QI test.c:6:5: note: ***** Skipping vector mode V32QI, which would repeat the analysis for V32QI test.c:6:5: note: ***** Analysis failed with vector mode VOID test.c:8:1: note: ***** Analysis failed with vector mode VOID --- Seems problem of cost model.=