https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122382

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 65984
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65984&action=edit
Patch in testing

Following test:

--cut here--
void
foo (_Float16 *__restrict h, const float *__restrict f)
{
  for (int n = 0; n < 128; ++n)
    h[n] = f[n];
}

void
bar (float *__restrict f, const _Float16 *__restrict h)
{
  for (int n = 0; n < 128; ++n)
    f[n] = h[n];
}
--cut here--

compiles with "-O2 -mf16c -mno-avx512f" to:

foo:
        xorl    %eax, %eax
        .p2align 6
        .p2align 4
        .p2align 3
.L2:
        vmovups (%rsi,%rax,2), %ymm0
        vmovups 32(%rsi,%rax,2), %ymm1
        vcvtps2ph       $4, %ymm0, %xmm0
        vcvtps2ph       $4, %ymm1, %xmm1
        vinsertf128     $0x1, %xmm1, %ymm0, %ymm0
        vmovdqu %ymm0, (%rdi,%rax)
        addq    $32, %rax
        cmpq    $256, %rax
        jne     .L2
        vzeroupper
        ret

bar:
        xorl    %eax, %eax
        .p2align 6
        .p2align 4
        .p2align 3
.L6:
        vmovdqu (%rsi,%rax), %ymm0
        vcvtph2ps       %xmm0, %ymm1
        vextractf128    $0x1, %ymm0, %xmm0
        vmovups %ymm1, (%rdi,%rax,2)
        vcvtph2ps       %xmm0, %ymm0
        vmovups %ymm0, 32(%rdi,%rax,2)
        addq    $32, %rax
        cmpq    $256, %rax
        jne     .L6
        vzeroupper
        ret

Reply via email to