This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC patch, i386]: Use STV pass to load/store any TImode constant using SSE insns


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]