[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: efficient summing of vector.
Peter Soendergaard <firstname.lastname@example.org> writes:
> Hi Camm, master in the ways of intel-assembly.
*please*, not true at all! I'm fishing around in the dark like
> You once wrote that you shaved an instruction of the way I sum a sse
> register. I use a sequence like this to sum the register in #reg using
This, if memory serves, was not in the vector sum at the end, of the
k-loop, but in the main block looping over the 4 columns of A doing
the add-multiply. There is also a way to make the "C write" step more
efficient, I think, but that's not what I was referring to above. The
best strategy for the latter that I've thought of so far seems to lie
in combining the fragments of the various C results (where possible)
into the same registers, doubling the effective workload of a given
movhlps, and winding up with the final 4 (single precision) C answers,
(when the problem specifies that they will be contiguous), in a single
register, and written out to memory in a single step.
This for example is my windup step for SREAL:
#define z f(t0,0,cx) pc(4,0) pul(5,4) pc(6,1) puh(5,0) pul(7,6) \
pa(0,4) puh(7,1) pc(4,2) pa(1,6) ps(68,6,4) ps(238,6,2) pa(4,2) pu(2,0,cx)
Sorry this is so rushed and unclear. Of course, this needs to be
changes somewhat for the other cases.
> xmm7 as scratch, and it seems like a clumsy way to do it. How can it be
> done in 4 instructions?
> __asm__ __volatile__ ("movhlps " #reg ", %%xmm7\n"\
> "addps " #reg ", %%xmm7\n"\
> "movaps %%xmm7, " #reg "\n"\
> "shufps $1, " #reg ", %%xmm7\n"\
> "addss %%xmm7, " #reg "\n"\
> Hope you can help me,
Camm Maguire email@example.com
"The earth is but one country, and mankind its citizens." -- Baha'u'llah