1 /* lzo1x_d.ash -- assembler implementation of the LZO1X decompression algorithm
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6 Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7 Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
20 The LZO library is free software; you can redistribute it and/or
21 modify it under the terms of the GNU General Public License as
22 published by the Free Software Foundation; either version 2 of
23 the License, or (at your option) any later version.
25 The LZO library is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 GNU General Public License for more details.
30 You should have received a copy of the GNU General Public License
31 along with the LZO library; see the file COPYING.
32 If not, write to the Free Software Foundation, Inc.,
33 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 Markus F.X.J. Oberhumer
36 <markus@oberhumer.com>
37 http://www.oberhumer.com/opensource/lzo/
41 #if !defined(LZO1X) && !defined(LZO1Y)
52 /***********************************************************************
54 ************************************************************************/
57 xorl %ebx,%ebx /* high bits 9-32 stay 0 */
68 TEST_OP((%edi,%eax),%edx)
69 TEST_IP((%esi,%eax),%edx)
78 /***********************************************************************
80 ************************************************************************/
83 TEST_IP(18(%esi,%eax),%edx) /* minimum */
88 leal 18+NN(%eax,%ebx),%eax
95 andl $0xffffff00,%eax ; jnz .L_assert_fail
96 andl $0xffffff00,%ebx ; jnz .L_assert_fail
97 xorl %eax,%eax ; xorl %ebx,%ebx
98 xorl %ecx,%ecx ; xorl %edx,%edx
112 TEST_OP(-NN(%edi,%eax),%edx)
113 TEST_IP(-NN(%esi,%eax),%edx)
114 #if defined(LZO_FAST)
119 COPYL(%esi,%edi,%edx)
126 COPYL_C(%esi,%edi,%edx,%eax)
133 andl $0xffffff00,%eax ; jnz .L_assert_fail
134 andl $0xffffff00,%ebx ; jnz .L_assert_fail
135 xorl %eax,%eax ; xorl %ebx,%ebx
136 xorl %ecx,%ecx ; xorl %edx,%edx
143 /***********************************************************************
145 ************************************************************************/
147 TEST_OP(3(%edi),%edx)
151 leal -0x801(%edi),%edx
153 leal -0x401(%edi),%edx
155 leal (%eax,%ebx,4),%eax
158 TEST_LOOKBEHIND(%edx)
159 #if defined(LZO_FAST)
174 /***********************************************************************
176 ************************************************************************/
191 leal (%eax,%ebx,8),%eax
196 leal (%eax,%ebx,4),%eax
201 #if defined(LZO_FAST)
220 /***********************************************************************
222 ************************************************************************/
225 TEST_IP(3(%esi),%edx) /* minimum */
230 leal 33+NN(%eax,%ebx),%ecx
246 andl $0xffff0000,%eax ; jnz .L_assert_fail
258 /***********************************************************************
260 ************************************************************************/
263 .LCOPYLONG: /* copy match using longwords */
264 TEST_LOOKBEHIND(%edx)
265 #if defined(LZO_FAST)
266 leal -3(%edi,%ecx),%eax
269 COPYL(%edx,%edi,%ebx)
273 TEST_OP((%edi,%ecx),%eax)
277 COPYL_C(%edx,%edi,%eax,%ebx)
280 2: COPYB_C(%edx,%edi,%al,%ecx)
289 TEST_OP((%edi,%eax),%edx)
290 TEST_IP((%esi,%eax),%edx)
291 #if defined(LZO_FAST)
297 COPYB_C(%esi,%edi,%cl,%eax)
301 andl $0xffffff00,%eax ; jnz .L_assert_fail
302 andl $0xffffff00,%ebx ; jnz .L_assert_fail
303 xorl %eax,%eax ; xorl %ebx,%ebx
304 xorl %ecx,%ecx ; xorl %edx,%edx
311 .LCOPYBYTE: /* copy match using bytes */
312 TEST_LOOKBEHIND(%edx)
313 TEST_OP(-NN(%edi,%ecx),%eax)
315 #if defined(LZO_FAST)
324 /***********************************************************************
326 ************************************************************************/
329 TEST_IP(3(%esi),%edx) /* minimum */
334 leal 9+NN(%ebx,%ecx),%ecx
346 shll $13,%eax /* save in bit 16 */
352 movl %eax,%edx ; andl $0xfffe0000,%edx ; jnz .L_assert_fail
356 leal -0x4000(%edi),%edx
363 /***********************************************************************
365 ************************************************************************/
370 TEST_OP(2(%edi),%edx)
374 leal (%eax,%ebx,4),%eax
377 TEST_LOOKBEHIND(%edx)
379 movb (%edx),%al /* we must use this because edx can be edi-1 */
387 /***********************************************************************
389 ************************************************************************/
392 /**** xorl %eax,%eax eax=0 from above */
394 cmpl $3+NN,%ecx /* ecx must be 3/6 */