All pastes #459934 Raw Edit

Stuff

public text v1 · immutable
#459934 ·published 2007-04-26 19:36 UTC
rendered paste body
#ifdef CPU_ARM

#warning USING ARM OPTS

static inline int32_t scalarproduct4_rev32(int32_t* x, int32_t* y)
{
    int32_t res;

    asm volatile (
        "ldmdb   %1, {r3-r6}     \n\t"
        "ldmia   %2, {r7-r10}    \n\t"
        "mul     %0, r6, r7      \n\t"
        "mla     %0, r5, r8, %0  \n\t"
        "mla     %0, r4, r9, %0  \n\t"
        "mla     %0, r3, r10, %0 \n\t"
        : "=r" (res)
        : "r" (x), "r" (y)
        : "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10"
    );

    return res;
}

#else

#define scalarproduct4_rev32(x,y) (x[0]  * y[0]) + (x[-1] * y[1]) + \
                                  (x[-2] * y[2]) + (x[-3] * y[3]);
#endif