From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7710338515D0; Wed, 15 Mar 2023 09:48:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7710338515D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678873684; bh=Z/yyuf2j3vaksmEHwApNQTfQvKTpk8ISqTIdmy9CsIA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wLMITCTMXZoXoU+HSJr/Yo/uuCBVyyQy/pt2YtTu758hy4itC/BK8F53DHGqXqf9k ly7LUpqDzG3hulCnXGzovqwZmOd7wky2JcvSTO4AkaqmtCjZUINKVInN+fbl/6Ae2e z5GR+EAkCNMGCAR9K/FFOaTC3oZLVci4mDVuxFNE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108724] [11/12 Regression] Poor codegen when summing two arrays without AVX or SSE Date: Wed, 15 Mar 2023 09:48:03 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 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=3D108724 --- Comment #7 from CVS Commits --- The releases/gcc-12 branch has been updated by Richard Biener : https://gcc.gnu.org/g:21e7145aaf582c263e69a3ee05dfa9d42bdbd1aa commit r12-9258-g21e7145aaf582c263e69a3ee05dfa9d42bdbd1aa Author: Richard Biener Date: Fri Feb 10 11:07:30 2023 +0100 tree-optimization/108724 - vectorized code getting piecewise expanded This fixes an oversight to when removing the hard limits on using generic vectors for the vectorizer to enable both SLP and BB vectorization to use those. The vectorizer relies on vector lowering to expand plus, minus and negate to bit operations but vector lowering has a hard limit on the minimum number of elements per work item. Vectorizer costs for the testcase at hand work out to vectorize a loop with just two work items per vector and that causes element wise expansion and spilling. The fix for now is to re-instantiate the hard limit, matching what vector lowering does. For the future the way to go is to emit the lowered sequence directly from the vectorizer instead. PR tree-optimization/108724 * tree-vect-stmts.cc (vectorizable_operation): Avoid using word_mode vectors when vector lowering will decompose them to elementwise operations. * gcc.target/i386/pr108724.c: New testcase. (cherry picked from commit dc87e1391c55c666c7ff39d4f0dea87666f25468)=