From: Uros Bizjak <ubizjak@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [x86 PATCH] PR target/113231: Improved costs in Scalar-To-Vector (STV) pass.
Date: Sun, 7 Jan 2024 17:14:37 +0100 [thread overview]
Message-ID: <CAFULd4ZeLtou6BrBNqXaZiUSnT6FQ7pBnD2ie0wenByb-Vsc0g@mail.gmail.com> (raw)
In-Reply-To: <03c401da40a4$8819fe30$984dfa90$@nextmovesoftware.com>
On Sat, Jan 6, 2024 at 2:30 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This patch improves the cost/gain calculation used during the i386 backend's
> SImode/DImode scalar-to-vector (STV) conversion pass. The current code
> handles loads and stores, but doesn't consider that converting other
> scalar operations with a memory destination, requires an explicit load
> before and an explicit store after the vector equivalent.
>
> To ease the review, the significant change looks like:
>
> /* For operations on memory operands, include the overhead
> of explicit load and store instructions. */
> if (MEM_P (dst))
> igain += !optimize_insn_for_size_p ()
> ? (m * (ix86_cost->int_load[2]
> + ix86_cost->int_store[2])
> - (ix86_cost->sse_load[sse_cost_idx] +
> ix86_cost->sse_store[sse_cost_idx]))
> : -COSTS_N_BYTES (8);
Please just swap true and false statements to avoid negative test.
> however the patch itself is complicated by a change in indentation
> which leads to a number of lines with only whitespace changes.
'git diff -w' to the rescue ;)
> For architectures where integer load/store costs are the same as
> vector load/store costs, there should be no change without -Os/-Oz.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32}
> with no new failures. Ok for mainline?
>
>
> 2024-01-06 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> PR target/113231
> * config/i386/i386-features.cc (compute_convert_gain): Include
> the overhead of explicit load and store (movd) instructions when
> converting non-store scalar operations with memory destinations.
>
> gcc/testsuite/ChangeLog
> PR target/113231
> * gcc.target/i386/pr113231.c: New test case.
OK with the above proposed change.
Thanks,
Uros.
prev parent reply other threads:[~2024-01-07 16:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-06 13:30 Roger Sayle
2024-01-07 16:14 ` Uros Bizjak [this message]
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=CAFULd4ZeLtou6BrBNqXaZiUSnT6FQ7pBnD2ie0wenByb-Vsc0g@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.com \
/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: link
Be 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).