From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 29AAD390A341; Thu, 6 Jun 2024 06:36:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29AAD390A341 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717655760; bh=AtdvbID7XVDWrepF62umJD3wS0saPF4E3Rln5wLJ/Dw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yn7nM2uksVwKbFILU+JrHLiDG3E6kTrGc6mrAR6CvwWh99Pp5jnN6qxVE0Ws3K9+o VrFFX4BthzelGyTVpH9V4rSvMQ9Wer2SxYbdfy/2UqDv+x+c1V1mW0j0hM0m7GqDOq jRC7o9ta9UuS9v/AI6IsJ4pFRvAd3+OwejkURys0= From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115355] [12/13/14/15 Regression] vectorization exposes wrong code on P9 LE starting from r12-4496 Date: Thu, 06 Jun 2024 06:35:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: linkw at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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=3D115355 --- Comment #9 from Kewen Lin --- (In reply to Peter Bergner from comment #7) > The test fails when setToIdentityBAD's index var is unsigned int. It pas= ses > when using unsigned long long, unsigned long, unsigned short and unsigned > char. When using unsigned long long/unsigned long, we do no vectorize the unsigned {long ,}long fails to vectorize due to cost modeling: missed: cost model: the vector iteration cost =3D 2 divided by the scalar iteration cost =3D 1 is greater or equal to the vectorization factor =3D 2. missed: not vectorized: vectorization not profitable. it can be forced with -fno-vect-cost-model. > loop. We vectorize the loop when using unsigned int/short/char. The > vectorized code is a little strange, in that the smaller the integer type= we > use for the index var, the more code we generate.=20=20 >=20 > The vectorized code for unsigned char is truly huge! ...although it does > seem to work correctly. I'm attaching the "unsigned char i" code gen for > setToIdentityBAD for people to examine. Even though it gives "correct" > results, it can't really be the code we want to generate, correct??? It's due to aggressive unrolling, as it has one early check on the loop bou= nd between 16 and 255, then cunroll completely unrolls it for each 16 multiples (totally 15 loops). A compact version of code can be generated with -fdisable-tree-cunroll.=