public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fxue at os dot amperecomputing.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113326] New: Optimize vector shift with constant delta on shifting-count operand Date: Thu, 11 Jan 2024 07:13:19 +0000 [thread overview] Message-ID: <bug-113326-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113326 Bug ID: 113326 Summary: Optimize vector shift with constant delta on shifting-count operand Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: fxue at os dot amperecomputing.com Target Milestone: --- For shift by induction variable, loop vectorization could generate a series of vector shifts, whose shifting-count operands are advanced by constant delta. We could use result of the first vector shift as base, and transform others to be vector shift on the result by scalar delta, which would eliminate non-uniform shift vector count constant, and thereby save a load on most architectures. int test(int array[16]); int foo(int value) { int array[16]; for (int i = 0; i < 16; i++) array[i] = value >> i; return test(array); } // Current vect_value = { value, value, value, value }; vect_shift_0 = vect_value >> { 0, 1, 2, 3 }; vect_shift_1 = vect_value >> { 4, 5, 6, 7 }; vect_shift_2 = vect_value >> { 8, 9, 10, 11 }; vect_shift_3 = vect_value >> { 12, 13, 14, 15 }; // To be optimized to vect_value = { value, value, value, value }; vect_shift_0 = vect_value >> { 0, 1, 2, 3 }; vect_shift_1 = vect_shift_0 >> { 4, 4, 4, 4 }; vect_shift_2 = vect_shift_0 >> { 8, 8, 8, 8 }; vect_shift_3 = vect_shift_0 >> { 12, 12, 12, 12 };
next reply other threads:[~2024-01-11 7:13 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-11 7:13 fxue at os dot amperecomputing.com [this message] 2024-01-11 7:30 ` [Bug target/113326] " pinskia at gcc dot gnu.org 2024-01-11 7:44 ` pinskia at gcc dot gnu.org 2024-01-11 7:52 ` fxue at os dot amperecomputing.com 2024-01-11 7:56 ` pinskia at gcc dot gnu.org 2024-01-11 8:10 ` pinskia at gcc dot gnu.org 2024-01-11 9:13 ` rguenth at gcc dot gnu.org 2024-01-11 9:58 ` fxue at os dot amperecomputing.com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113326-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).