From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 813BE3858C41; Mon, 26 Feb 2024 03:28:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 813BE3858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708918126; bh=9pCzQf8673UPyX6SxO10RslL8KwpOQW9FY6t2HXJxiE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BMvoRuCaTCp5zo6vfxljz6hGtSI+eN+7Hp737LnqQDARziQeI9rq473o6ZhDOYZ/2 vSeFrkXhN5Q2JsvfIHFj0deAaSjJhSs3CnsTPwLb3YcOqWWvaObuC+fW5jBTvqJlev e99wzfvFyJa6SVPHQmr6vrNzMW/Cyq8npNT+OF/A= From: "liuhongt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114107] poor vectorization at -O3 when dealing with arrays of different multiplicity, good with -O2 Date: Mon, 26 Feb 2024 03:28:45 +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: 13.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: liuhongt 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: 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=3D114107 --- Comment #8 from Hongtao Liu --- (In reply to Hongtao Liu from comment #7) > perm_cost is very low in x86 backend, and it maybe ok for 128-bit vectors, > pshufb/shufps are avaible for most cases. > But for 256/512-bit vectors, when the permuation is cross-lane, the cost > could be higher. One solution is increase perm_cost when vector size is m= ore > than 128 since vperm is most likely used instead of > vblend/vpblend/vpshuf/vshuf. Furthermore, if we can get indices in the backend when calculating vec_perm cost, we can check if the permutation is cross-lane or not, and set cost mo= re accurately for 256/512-bit vector permutation.=