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

--- Comment #27 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Hongtao.liu from comment #17)
> (In reply to Hongtao.liu from comment #16)
> > There're already testcases for vec_extract/vec_set/vec_duplicate, but those
> > testcases are written under TARGET_AVX512FP16, i'll make a copy of them and
> > test them w/o avx512fp16.
> 
> Also we can relax condition of extendv*hfv*sf and truncv*sfv*hf to
> avx512vl/f16c so that vect-float16-1.c could be vectorized.
> 
> vect-float16-1.c
> 
> void
> foo (_Float16 *__restrict__ a, _Float16 *__restrict__ b,
>      _Float16 *__restrict__ c)
> {
>   for (int i = 0; i < 256; i++)
>     a[i] = b[i] + c[i];
> }

This was recently fixed, for -O2 -ftree-vectorize -mfp16c I get:

        vpxor   %xmm2, %xmm2, %xmm2
        vpinsrw $0, (%rsi,%rax), %xmm2, %xmm0
        vpinsrw $0, (%rdx,%rax), %xmm2, %xmm1
        vcvtph2ps       %xmm0, %xmm0
        vcvtph2ps       %xmm1, %xmm1
        vaddss  %xmm1, %xmm0, %xmm0
        vinsertps       $0xe, %xmm0, %xmm0, %xmm0
        vcvtps2ph       $4, %xmm0, %xmm0
        vpextrw $0, %xmm0, (%rdi,%rax)
        addq    $2, %rax
        cmpq    $512, %rax
        jne     .L2
        ret

While it would be nice to partially vectorize with vcvtph2ps/vcvtps2ph, the
compiler doesn't reach that far.

Reply via email to