media/libvpx/vp8/common/x86/iwalsh_mmx.asm

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 ;
michael@0 2 ; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 ;
michael@0 4 ; Use of this source code is governed by a BSD-style license
michael@0 5 ; that can be found in the LICENSE file in the root of the source
michael@0 6 ; tree. An additional intellectual property rights grant can be found
michael@0 7 ; in the file PATENTS. All contributing project authors may
michael@0 8 ; be found in the AUTHORS file in the root of the source tree.
michael@0 9 ;
michael@0 10
michael@0 11
michael@0 12 %include "vpx_ports/x86_abi_support.asm"
michael@0 13
michael@0 14 ;void vp8_short_inv_walsh4x4_mmx(short *input, short *output)
michael@0 15 global sym(vp8_short_inv_walsh4x4_mmx) PRIVATE
michael@0 16 sym(vp8_short_inv_walsh4x4_mmx):
michael@0 17 push rbp
michael@0 18 mov rbp, rsp
michael@0 19 SHADOW_ARGS_TO_STACK 2
michael@0 20 ; end prolog
michael@0 21
michael@0 22 mov rdx, arg(0)
michael@0 23 mov rax, 30003h
michael@0 24
michael@0 25 movq mm0, [rdx + 0] ;ip[0]
michael@0 26 movq mm1, [rdx + 8] ;ip[4]
michael@0 27 movq mm7, rax
michael@0 28
michael@0 29 movq mm2, [rdx + 16] ;ip[8]
michael@0 30 movq mm3, [rdx + 24] ;ip[12]
michael@0 31 punpcklwd mm7, mm7 ;0003000300030003h
michael@0 32 mov rdx, arg(1)
michael@0 33
michael@0 34 movq mm4, mm0
michael@0 35 movq mm5, mm1
michael@0 36
michael@0 37 paddw mm4, mm3 ;ip[0] + ip[12] aka al
michael@0 38 paddw mm5, mm2 ;ip[4] + ip[8] aka bl
michael@0 39
michael@0 40 movq mm6, mm4 ;temp al
michael@0 41 paddw mm4, mm5 ;al + bl
michael@0 42 psubw mm6, mm5 ;al - bl
michael@0 43
michael@0 44 psubw mm0, mm3 ;ip[0] - ip[12] aka d1
michael@0 45 psubw mm1, mm2 ;ip[4] - ip[8] aka c1
michael@0 46
michael@0 47 movq mm5, mm0 ;temp dl
michael@0 48 paddw mm0, mm1 ;dl + cl
michael@0 49 psubw mm5, mm1 ;dl - cl
michael@0 50
michael@0 51 ; 03 02 01 00
michael@0 52 ; 13 12 11 10
michael@0 53 ; 23 22 21 20
michael@0 54 ; 33 32 31 30
michael@0 55
michael@0 56 movq mm3, mm4 ; 03 02 01 00
michael@0 57 punpcklwd mm4, mm0 ; 11 01 10 00
michael@0 58 punpckhwd mm3, mm0 ; 13 03 12 02
michael@0 59
michael@0 60 movq mm1, mm6 ; 23 22 21 20
michael@0 61 punpcklwd mm6, mm5 ; 31 21 30 20
michael@0 62 punpckhwd mm1, mm5 ; 33 23 32 22
michael@0 63
michael@0 64 movq mm0, mm4 ; 11 01 10 00
michael@0 65 movq mm2, mm3 ; 13 03 12 02
michael@0 66
michael@0 67 punpckldq mm0, mm6 ; 30 20 10 00 aka ip[0]
michael@0 68 punpckhdq mm4, mm6 ; 31 21 11 01 aka ip[4]
michael@0 69
michael@0 70 punpckldq mm2, mm1 ; 32 22 12 02 aka ip[8]
michael@0 71 punpckhdq mm3, mm1 ; 33 23 13 03 aka ip[12]
michael@0 72 ;~~~~~~~~~~~~~~~~~~~~~
michael@0 73 movq mm1, mm0
michael@0 74 movq mm5, mm4
michael@0 75 paddw mm1, mm3 ;ip[0] + ip[12] aka al
michael@0 76 paddw mm5, mm2 ;ip[4] + ip[8] aka bl
michael@0 77
michael@0 78 movq mm6, mm1 ;temp al
michael@0 79 paddw mm1, mm5 ;al + bl
michael@0 80 psubw mm6, mm5 ;al - bl
michael@0 81 paddw mm1, mm7
michael@0 82 paddw mm6, mm7
michael@0 83 psraw mm1, 3
michael@0 84 psraw mm6, 3
michael@0 85
michael@0 86 psubw mm0, mm3 ;ip[0] - ip[12] aka d1
michael@0 87 psubw mm4, mm2 ;ip[4] - ip[8] aka c1
michael@0 88
michael@0 89 movq mm5, mm0 ;temp dl
michael@0 90 paddw mm0, mm4 ;dl + cl
michael@0 91 psubw mm5, mm4 ;dl - cl
michael@0 92 paddw mm0, mm7
michael@0 93 paddw mm5, mm7
michael@0 94 psraw mm0, 3
michael@0 95 psraw mm5, 3
michael@0 96 ;~~~~~~~~~~~~~~~~~~~~~
michael@0 97
michael@0 98 movd eax, mm1
michael@0 99 movd ecx, mm0
michael@0 100 psrlq mm0, 32
michael@0 101 psrlq mm1, 32
michael@0 102 mov word ptr[rdx+32*0], ax
michael@0 103 mov word ptr[rdx+32*1], cx
michael@0 104 shr eax, 16
michael@0 105 shr ecx, 16
michael@0 106 mov word ptr[rdx+32*4], ax
michael@0 107 mov word ptr[rdx+32*5], cx
michael@0 108 movd eax, mm1
michael@0 109 movd ecx, mm0
michael@0 110 mov word ptr[rdx+32*8], ax
michael@0 111 mov word ptr[rdx+32*9], cx
michael@0 112 shr eax, 16
michael@0 113 shr ecx, 16
michael@0 114 mov word ptr[rdx+32*12], ax
michael@0 115 mov word ptr[rdx+32*13], cx
michael@0 116
michael@0 117 movd eax, mm6
michael@0 118 movd ecx, mm5
michael@0 119 psrlq mm5, 32
michael@0 120 psrlq mm6, 32
michael@0 121 mov word ptr[rdx+32*2], ax
michael@0 122 mov word ptr[rdx+32*3], cx
michael@0 123 shr eax, 16
michael@0 124 shr ecx, 16
michael@0 125 mov word ptr[rdx+32*6], ax
michael@0 126 mov word ptr[rdx+32*7], cx
michael@0 127 movd eax, mm6
michael@0 128 movd ecx, mm5
michael@0 129 mov word ptr[rdx+32*10], ax
michael@0 130 mov word ptr[rdx+32*11], cx
michael@0 131 shr eax, 16
michael@0 132 shr ecx, 16
michael@0 133 mov word ptr[rdx+32*14], ax
michael@0 134 mov word ptr[rdx+32*15], cx
michael@0 135
michael@0 136 ; begin epilog
michael@0 137 UNSHADOW_ARGS
michael@0 138 pop rbp
michael@0 139 ret
michael@0 140

mercurial