From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AF6F385841A; Fri, 13 Oct 2023 23:13:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AF6F385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697238790; bh=oqVclFXKsdDcB1BIAYHeZtMPiOCy9ZRhXb3+QOtGbaM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H7SCP5vzFzx5+0k662If3DOeeVGwckkKx6hIY0VnG23kmzkcols/Jy/yaR+U5zcVj 7LVByNmjHQDHap2jPhf4FEyPThbfAmepyNHC5xUCRb0sWPiev5VNykEF1pnPja38OW NLxSC5xvyEVlPsen3LYpgmTIfASG0tkHeF1LYyhE= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111791] RISC-V: Strange loop vectorizaion on popcount function Date: Fri, 13 Oct 2023 23:13:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: NEW 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: cc 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=3D111791 JuzheZhong changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |juzhe.zhong at rivai dot ai --- Comment #3 from JuzheZhong --- This is because RISC-V didn't vectorize popcount: It just a scalar call popcount: call __popcountdi2 I have a patch support popcount optab: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/625870.html However, I don't think we should enable popcount optab if we don't have a single vector popcount instruction. An ideal way is to add fallback popcount in loop vectorizer if the target doesn't enable vector popcount optab, Robin is working on that: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626567.html So, that's why I drop my patch. More details need Robin comments.=