[Libre-soc-bugs] [Bug 558] gcc SV intrinsics concept

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Jan 11 05:37:11 GMT 2021


--- Comment #37 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #36)
> my feeling is that rather than add several tens of thousands of intrinsics
> autogenerated (the software equivalent of propagating "SIMD considered
> harmful"), __attribute__ could well provide the means to bring in SVP64
> Context, with very little needed to be added with the exception of setvl.

I think we should have intrinsics for saturated/not add, sub, mul, etc., since
gcc intrinsics can be generic over the type such that one intrinsic works on
all the different combinations of scalar/vector types. That way, we'd only need
something like 20-30 intrinsics to cover all the weird and wonderful
alu/load/store ops, not hundreds or thousands.


typedef int16_t MyVec[45] __attribute__((sv_vector));

void mix_audio(int16_t a[], int16_t b[], int16_t dc_balance, size_t len) {
    while(len > 0) {
        size_t vl = __sv_setvl<MyVec>(len);
        MyVec v_a = __sv_load<MyVec>(a, vl);
        MyVec v_b = __sv_load<MyVec>(b, vl);
        MyVec temp = __sv_sat_sub(v_a, dc_balance, vl)
        temp = __sv_sat_add(temp, v_b, vl);
        __sv_store(a, temp, vl);
        a += vl;
        b += vl;
        len -= vl;

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list