summaryrefslogtreecommitdiff
path: root/libavutil/x86/lls.asm
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2013-06-18 21:30:43 +0000
committerLuca Barbato <lu_zero@gentoo.org>2013-06-29 13:23:57 +0200
commitb545179fdff1ccfbbb9d422e4e9720cb6c6d9191 (patch)
tree0476bc87fd03fd512c49103a36ff05681a000e00 /libavutil/x86/lls.asm
parent502ab21af0ca68f76d6112722c46d2f35c004053 (diff)
x86: lpc: simd av_evaluate_lls
1.5x-1.8x faster on sandybridge Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavutil/x86/lls.asm')
-rw-r--r--libavutil/x86/lls.asm38
1 files changed, 38 insertions, 0 deletions
diff --git a/libavutil/x86/lls.asm b/libavutil/x86/lls.asm
index 92c00fcda1..92b7f955c2 100644
--- a/libavutil/x86/lls.asm
+++ b/libavutil/x86/lls.asm
@@ -194,3 +194,41 @@ cglobal update_lls, 3,6,8, ctx, var, count, i, j, count2
jle .loop2x1
.ret:
REP_RET
+
+
+INIT_XMM sse2
+cglobal evaluate_lls, 2,4,2, ctx, var, order, i
+ ; This function is often called on the same buffer as update_lls, but with
+ ; an offset. They can't both be aligned.
+ ; Load halves rather than movu to avoid store-forwarding stalls, since the
+ ; input was initialized immediately prior to this function using scalar math.
+ %define coefsq ctxq
+ mov id, orderd
+ imul orderd, MAX_VARS
+ lea coefsq, [ctxq + LLSModel.coeff + orderq*8]
+ movsd m0, [varq]
+ movhpd m0, [varq + 8]
+ mulpd m0, [coefsq]
+ lea coefsq, [coefsq + iq*8]
+ lea varq, [varq + iq*8]
+ neg iq
+ add iq, 2
+.loop:
+ movsd m1, [varq + iq*8]
+ movhpd m1, [varq + iq*8 + 8]
+ mulpd m1, [coefsq + iq*8]
+ addpd m0, m1
+ add iq, 2
+ jl .loop
+ jg .skip1
+ movsd m1, [varq + iq*8]
+ mulsd m1, [coefsq + iq*8]
+ addpd m0, m1
+.skip1:
+ movhlps m1, m0
+ addsd m0, m1
+%if ARCH_X86_32
+ movsd r0m, m0
+ fld qword r0m
+%endif
+ RET