This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC patch, i386]: Use STV pass to load/store any TImode constant using SSE insns
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, ÐÐÑÑ ÐÐÐÐÐÐÑ <enkovich dot gnu at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 27 Apr 2016 13:35:17 -0700
- Subject: Re: [RFC patch, i386]: Use STV pass to load/store any TImode constant using SSE insns
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4afCkFamkaWA3F_30AaW9ZerBWKj90F2AR_z4wTjNGcNA at mail dot gmail dot com>
On Wed, Apr 27, 2016 at 12:58 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> This RFC patch illustrates the idea of using STV pass to load/store
> any TImode constant using SSE insns. The testcase:
>
> --cut here--
> __int128 x;
>
> __int128 test_1 (void)
> {
> x = (__int128) 0x00112233;
> }
>
> __int128 test_2 (void)
> {
> x = ((__int128) 0x0011223344556677 << 64);
> }
>
> __int128 test_3 (void)
> {
> x = ((__int128) 0x0011223344556677 << 64) + (__int128) 0x0011223344556677;
> }
> --cut here--
>
> currently compiles (-O2) on x86_64 to:
>
> test_1:
> movq $1122867, x(%rip)
> movq $0, x+8(%rip)
> ret
>
> test_2:
> xorl %eax, %eax
> movabsq $4822678189205111, %rdx
> movq %rax, x(%rip)
> movq %rdx, x+8(%rip)
> ret
>
> test_3:
> movabsq $4822678189205111, %rax
> movabsq $4822678189205111, %rdx
> movq %rax, x(%rip)
> movq %rdx, x+8(%rip)
> ret
>
> However, using the attached patch, we compile all tests to:
>
> test:
> movdqa .LC0(%rip), %xmm0
> movaps %xmm0, x(%rip)
> ret
>
> Ilya, HJ - do you think new sequences are better, or - as suggested by
> Jakub - they are beneficial with STV pass, as we are now able to load
I like it. It is on my todo list :-).
> any immediate value? A variant of this patch can also be used to load
> DImode values to 32bit STV pass.
>
Yes:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70763
--
H.J.