diff --git a/libavcodec/x86/vp56dsp.asm b/libavcodec/x86/vp56dsp.asm
index 217e63a0780247375873b3e8ed99de37ec0e4c7d..1b3165e54ae45282a8be5f6861cad97702579d52 100644
--- a/libavcodec/x86/vp56dsp.asm
+++ b/libavcodec/x86/vp56dsp.asm
@@ -127,6 +127,9 @@ cglobal vp6_filter_diag4_%1, 5, 7, %2
     sub         rsp, 8*15
     movq         m6, [pw_64]
 %endif
+%ifdef ARCH_X86_64
+    movsxd       r2, r2d
+%endif
 
     sub          r1, r2