From: Uros Bizjak <ubizjak@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [x86_64 PATCH] Two minor tweaks to ix86_expand_move.
Date: Sat, 17 Jun 2023 15:15:56 +0200 [thread overview]
Message-ID: <CAFULd4ahVrP8R5r1gmBowQapV+Jeo==GRneuzG7-WEF1x=3hBQ@mail.gmail.com> (raw)
In-Reply-To: <033d01d9a06f$6bdf2360$439d6a20$@nextmovesoftware.com>
On Fri, Jun 16, 2023 at 6:27 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This patch splits out two (independent) minor changes to i386-expand.cc's
> ix86_expand_move from a larger patch, given that it's better to review
> and commit these independent pieces separately from a more complex patch.
>
> The first change is to test for CONST_WIDE_INT_P before calling
> ix86_convert_const_wide_int_to_broadcast. Whilst stepping through
> this function in gdb, I was surprised that the code was continually
> jumping into this function with operands that obviously weren't
> appropriate.
>
> The second change is to generalize the optimization for efficiently
> moving a TImode value to V1TImode (via V2DImode), to cover all 128-bit
> vector modes.
>
> Hence for the test case:
>
> typedef unsigned long uv2di __attribute__ ((__vector_size__ (16)));
> uv2di foo2(__int128 x) { return (uv2di)x; }
>
> we'd previously move via memory with:
>
> foo2: movq %rdi, -24(%rsp)
> movq %rsi, -16(%rsp)
> movdqa -24(%rsp), %xmm0
> ret
>
> with this patch we now generate with -O2 (the same as V1TImode):
>
> foo2: movq %rdi, %xmm0
> movq %rsi, %xmm1
> punpcklqdq %xmm1, %xmm0
> ret
>
> and with -O2 -msse4 the even better:
>
> foo2: movq %rdi, %xmm0
> pinsrq $1, %rsi, %xmm0
> ret
>
> The new test case is unimaginatively called sse2-v1ti-mov-2.c given
> the original test case just for V1TI mode was called sse2-v1ti-mov-1.c.
>
> 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?
>
>
> 2023-06-16 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> * config/i386/i386-expand.cc (ix86_expand_move): Check that OP1 is
> CONST_WIDE_INT_P before calling ix86_convert_wide_int_to_broadcast.
> Generalize special case for converting TImode to V1TImode to handle
> all 128-bit vector conversions.
>
> gcc/testsuite/ChangeLog
> * gcc.target/i386/sse2-v1ti-mov-2.c: New test case.
OK.
Thanks,
Uros.
>
> Thanks in advance,
> Roger
> --
>
prev parent reply other threads:[~2023-06-17 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 16:27 Roger Sayle
2023-06-17 13:15 ` 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='CAFULd4ahVrP8R5r1gmBowQapV+Jeo==GRneuzG7-WEF1x=3hBQ@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).