From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46E28386F037; Mon, 27 Jul 2020 16:22:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46E28386F037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595866971; bh=LvGMbNxp5Y3kkaPxS1Hjcw6T45k+qWjqL+IRexnQiek=; h=From:To:Subject:Date:From; b=ABlDZK9YbZBq7hOaCxnMy7eGAsjWqo1Xd3kB0KCoEWHVUXN5gZ1lbgdOyP6rz+OQO BZiSNbkNUSf2W7cwzbRhlpPQ/4/w84MrLczCLyKwRKXg+F8FZ/iKl5Xb5suwqzUwY6 nb0yx+9el2hhlAtph7F53DOjadMIjUhy3b+nnjgQ= From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96339] New: [SVE] Optimise svlast[ab] Date: Mon, 27 Jul 2020 16:22:51 +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: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rsandifo 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter 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, 27 Jul 2020 16:22:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96339 Bug ID: 96339 Summary: [SVE] Optimise svlast[ab] Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: rsandifo at gcc dot gnu.org Target Milestone: --- For: #include int8_t foo (svint8_t x) { return svlasta (svptrue_pat_b8 (SV_VL1), x); } we generate: ptrue p0.b, vl1 lasta w0, p0, z0.b ret But this is really a BIT_FIELD_REF with a constant index, so we can generate: umov w0, v0.b[0] ret (works even on big-endian targets). We should make svlast_impl fold calls to a BIT_FIELD_REF if: (1) the predicate input is a constant, (2) we know at compile time which element the constant selects, and (3) the selected element ends on or before byte 64 For other cases it is probably better to keep the original call. (2) excludes variable-length predicate constants if (a) we can't determine the index of the final 1 bit at compile time or (b) that index might be beyond the end of the vector (3) restricts the optimisation to cases that can be handled by *vec_extract_v128 and *vec_extract_dup.=