shithub: dav1d

Download patch

ref: 81a264586522e44a145152ce27bc4cbe4152dad4
parent: bb178db019da21d62fae8c255675efbd84327195
author: Henrik Gramner <[email protected]>
date: Mon Feb 3 18:55:40 EST 2020

x86: Use unsigned pointer comparisons

Using signed comparisons could theoretically cause the wrong result in
some obscure corner cases on x86-32 with PAE. x86-64 should be fine
with either, but unsigned is technically more correct.

--- a/src/x86/itx.asm
+++ b/src/x86/itx.asm
@@ -4626,7 +4626,7 @@
     pxor                 m0, m0
     mov                 r0d, 8
     cmp                  cq, rax
-    jg .zero_loop
+    ja .zero_loop
 .zero_loop_half:
     mova         [rax+64*0], m0
     mova         [rax+64*1], m0
@@ -4702,7 +4702,7 @@
     mov                 r0d, 4
     mov                 r1d, 8
     cmp                  cq, rax
-    cmovg               r0d, r1d
+    cmova               r0d, r1d
 .zero_loop:
     mova         [rax+32*0], m0
     mova         [rax+32*1], m0
@@ -4848,7 +4848,7 @@
     call m(inv_txfm_add_dct_dct_16x32).pass2_end
     lea               tmp3q, [tmp1q-32*32]
     cmp               tmp2q, tmp3q
-    jl .ret
+    jb .ret
     sub               tmp2q, 32*32
     sub                dstq, r3
     lea                  r2, [r2+r3+16]
--- a/src/x86/msac.asm
+++ b/src/x86/msac.asm
@@ -167,7 +167,7 @@
 %endif
     lea            t5, [t2+gprsize]
     cmp            t5, rcx
-    jg .refill_eob
+    ja .refill_eob
     mov            t2, [t2]
     lea           ecx, [t1+23]
     add           t1d, 16
@@ -195,7 +195,7 @@
     sub           ecx, t1d ; c
 .refill_eob_loop:
     cmp            t2, t5
-    jge .refill_eob_end    ; eob reached
+    jae .refill_eob_end    ; eob reached
     movzx         t1d, byte [t2]
     inc            t2
     shl            t1, cl