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) 2011 Markus Franz Xaver Johannes Oberhumer
6 Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
7 Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
8 Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
9 Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
10 Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
15 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
16 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
17 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
18 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
19 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
20 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
23 The LZO library is free software; you can redistribute it and/or
24 modify it under the terms of the GNU General Public License as
25 published by the Free Software Foundation; either version 2 of
26 the License, or (at your option) any later version.
28 The LZO library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU General Public License for more details.
33 You should have received a copy of the GNU General Public License
34 along with the LZO library; see the file COPYING.
35 If not, write to the Free Software Foundation, Inc.,
36 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
38 Markus F.X.J. Oberhumer
39 <markus@oberhumer.com>
40 http://www.oberhumer.com/opensource/lzo/
44 #if !defined(LZO1X) && !defined(LZO1Y)
55 /***********************************************************************
57 ************************************************************************/
60 xorl %ebx,%ebx /* high bits 9-32 stay 0 */
71 TEST_OP((%edi,%eax),%edx)
72 TEST_IP((%esi,%eax),%edx)
81 /***********************************************************************
83 ************************************************************************/
86 TEST_IP(18(%esi,%eax),%edx) /* minimum */
91 leal 18+NN(%eax,%ebx),%eax
98 andl $0xffffff00,%eax ; jnz .L_assert_fail
99 andl $0xffffff00,%ebx ; jnz .L_assert_fail
100 xorl %eax,%eax ; xorl %ebx,%ebx
101 xorl %ecx,%ecx ; xorl %edx,%edx
115 TEST_OP(-NN(%edi,%eax),%edx)
116 TEST_IP(-NN(%esi,%eax),%edx)
117 #if defined(LZO_FAST)
122 COPYL(%esi,%edi,%edx)
129 COPYL_C(%esi,%edi,%edx,%eax)
136 andl $0xffffff00,%eax ; jnz .L_assert_fail
137 andl $0xffffff00,%ebx ; jnz .L_assert_fail
138 xorl %eax,%eax ; xorl %ebx,%ebx
139 xorl %ecx,%ecx ; xorl %edx,%edx
146 /***********************************************************************
148 ************************************************************************/
150 TEST_OP(3(%edi),%edx)
154 leal -0x801(%edi),%edx
156 leal -0x401(%edi),%edx
158 leal (%eax,%ebx,4),%eax
161 TEST_LOOKBEHIND(%edx)
162 #if defined(LZO_FAST)
177 /***********************************************************************
179 ************************************************************************/
194 leal (%eax,%ebx,8),%eax
199 leal (%eax,%ebx,4),%eax
204 #if defined(LZO_FAST)
223 /***********************************************************************
225 ************************************************************************/
228 TEST_IP(3(%esi),%edx) /* minimum */
233 leal 33+NN(%eax,%ebx),%ecx
249 andl $0xffff0000,%eax ; jnz .L_assert_fail
261 /***********************************************************************
263 ************************************************************************/
266 .LCOPYLONG: /* copy match using longwords */
267 TEST_LOOKBEHIND(%edx)
268 #if defined(LZO_FAST)
269 leal -3(%edi,%ecx),%eax
272 COPYL(%edx,%edi,%ebx)
276 TEST_OP((%edi,%ecx),%eax)
280 COPYL_C(%edx,%edi,%eax,%ebx)
283 2: COPYB_C(%edx,%edi,%al,%ecx)
292 TEST_OP((%edi,%eax),%edx)
293 TEST_IP((%esi,%eax),%edx)
294 #if defined(LZO_FAST)
300 COPYB_C(%esi,%edi,%cl,%eax)
304 andl $0xffffff00,%eax ; jnz .L_assert_fail
305 andl $0xffffff00,%ebx ; jnz .L_assert_fail
306 xorl %eax,%eax ; xorl %ebx,%ebx
307 xorl %ecx,%ecx ; xorl %edx,%edx
314 .LCOPYBYTE: /* copy match using bytes */
315 TEST_LOOKBEHIND(%edx)
316 TEST_OP(-NN(%edi,%ecx),%eax)
318 #if defined(LZO_FAST)
327 /***********************************************************************
329 ************************************************************************/
332 TEST_IP(3(%esi),%edx) /* minimum */
337 leal 9+NN(%ebx,%ecx),%ecx
349 shll $13,%eax /* save in bit 16 */
355 movl %eax,%edx ; andl $0xfffe0000,%edx ; jnz .L_assert_fail
359 leal -0x4000(%edi),%edx
366 /***********************************************************************
368 ************************************************************************/
373 TEST_OP(2(%edi),%edx)
377 leal (%eax,%ebx,4),%eax
380 TEST_LOOKBEHIND(%edx)
382 movb (%edx),%al /* we must use this because edx can be edi-1 */
390 /***********************************************************************
392 ************************************************************************/
395 /**** xorl %eax,%eax eax=0 from above */
397 cmpl $3+NN,%ecx /* ecx must be 3/6 */