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

--- Comment #2 from Monk Chiang <sh.chiang04 at gmail dot com> ---
Thanks Pan.
Another test. It includes vfmv.v.f, vfmv.s.f

compile option: 
-mabi=lp64d -march=rv64gcv_zfh_zvfhmin -O3 -ftree-vectorize
-fno-vect-cost-model   -S

#include <stdint.h>
void f__Float16_int8_t (_Float16 *restrict y,
                   _Float16 *restrict x,
                   int8_t *restrict index) {
    int i = 0;
    y[0] = x[index[0]] + 1;
    y[1] = x[index[1]] + 2;
}

Assembly:

f__Float16_int8_t:
        lb      a5,1(a2)
        lb      a4,0(a2)
        lui     a3,%hi(.LC1)
        slli    a5,a5,1
        add     a5,a1,a5
        slli    a4,a4,1
        flh     fa4,0(a5)
        flh     fa2,%lo(.LC1)(a3)
        add     a1,a1,a4
        lui     a5,%hi(.LC0)
        flh     fa5,0(a1)
        flh     fa3,%lo(.LC0)(a5)
        fadd.h  fa4,fa4,fa2
        vsetivli        zero,2,e16,mf4,tu,ma
        fadd.h  fa5,fa5,fa3
        vmv.v.i v1,0
        vfmv.v.f        v2,fa4
        vfmv.s.f        v1,fa5
        vslideup.vi     v1,v2,1
        vse16.v v1,0(a0)
        ret

Reply via email to