On Tue, Dec 29, 2015 at 12:32 PM, Janne Grunau <[email protected]> wrote:
> Intel's Instruction Set Reference (as of September 2015) clearly states
> that cvtpi2ps switches to MMX state. Actual CPUs do not switch if the
> source is a memory location. The Instruction Set Reference from 1999
> (Order Number 243191) describes this behaviour but all later versions
> I've seen have make no distinction whether MMX registers or memory is
> used as source.
> The documentation for the matching SSE2 instruction to convert to double
> (cvtpi2pd) was fixed (see the valgrind bug
> https://bugs.kde.org/show_bug.cgi?id=210264).
>
> It will take time to get a clarification and fixes in place. In the
> meantime it makes sense to change ff_int32_to_float_fmul_scalar_sse to
> be correct according to the documentation. The vast majority of users
> will have SSE2 so a change to the SSE version has little effect.
>
> Fixes fate-checkasm on x86 valgrind targets.
>
> Valgrind 'bug' reported as https://bugs.kde.org/show_bug.cgi?id=357059
> ---
>  libavcodec/x86/fmtconvert.asm | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
> index 0383322..c2ff707 100644
> --- a/libavcodec/x86/fmtconvert.asm
> +++ b/libavcodec/x86/fmtconvert.asm
> @@ -61,6 +61,13 @@ cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, 
> mul, len
>      mova  [dstq+lenq+16], m2
>      add     lenq, 32
>      jl .loop
> +%if cpuflag(sse)
> +    ;; cvtpi2ps switches to MMX even if the source is a memory location
> +    ;; possible an error in documentation since every tested CPU disagrees 
> with
> +    ;; that. Use emms anyway since the vast majority of machines will use the
> +    ;; SSE2 variant
> +    emms
> +%endif
>      REP_RET
>  %endmacro

Should be notcpuflag(sse2). Also the REP_RET could be replaced with
RET, but that's a pretty minor thing.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to