summaryrefslogtreecommitdiff
path: root/asm/i386/src/lzo1c_d.ash
blob: 9969c86aa24fcb3629b59fb96aacdc3ad8c39a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* lzo1c_d.ash -- assembler implementation of the LZO1C decompression algorithm

   This file is part of the LZO real-time data compression library.

   Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
   Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
   All Rights Reserved.

   The LZO library is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License, or (at your option) any later version.

   The LZO library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with the LZO library; see the file COPYING.
   If not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

   Markus F.X.J. Oberhumer
   <markus@oberhumer.com>
   http://www.oberhumer.com/opensource/lzo/
 */


/***********************************************************************
//
************************************************************************/

        ALIGN3
.L1:
        xorl    %eax,%eax
        movb    (%esi),%al
        incl    %esi
        cmpb    $32,%al
        jnb     .LMATCH

        orb     %al,%al
        jz      .L12
        movl    %eax,%ecx
.LIT:
        TEST_OP((%edi,%ecx),%ebx)
        TEST_IP((%esi,%ecx),%ebx)
        rep
        movsb
.LM1:
        movb    (%esi),%al
        incl    %esi

        cmpb    $32,%al
        jb      .LM2
.LMATCH:
        cmpb    $64,%al
        jb      .LN3

        movl    %eax,%ecx
        andb    $31,%al
        leal    -1(%edi),%edx
        shrl    $5,%ecx
        subl    %eax,%edx
        movb    (%esi),%al
        incl    %esi

        shll    $5,%eax
        subl    %eax,%edx
        incl    %ecx
        xchgl   %esi,%edx
        TEST_LOOKBEHIND(%esi)
        TEST_OP((%edi,%ecx),%ebx)
        rep
        movsb
        movl    %edx,%esi
        jmp     .L1

        ALIGN3
.L12:
        LODSB
        leal    32(%eax),%ecx
        cmpb    $248,%al
        jb      .LIT

        movl    $280,%ecx
        subb    $248,%al
        jz      .L11
        xchgl   %eax,%ecx
        xorb    %al,%al
        shll    %cl,%eax
        xchgl   %eax,%ecx
.L11:
        TEST_OP((%edi,%ecx),%ebx)
        TEST_IP((%esi,%ecx),%ebx)
        rep
        movsb
        jmp     .L1

        ALIGN3
.LM2:
        leal    -1(%edi),%edx
        subl    %eax,%edx
        LODSB
        shll    $5,%eax
        subl    %eax,%edx
        xchgl   %esi,%edx
        TEST_LOOKBEHIND(%esi)
        TEST_OP(4(%edi),%ebx)
        movsb
        movsb
        movsb
        movl    %edx,%esi
        movsb
        xorl    %eax,%eax
        jmp     .LM1
.LN3:
        andb    $31,%al
        movl    %eax,%ecx
        jnz     .LN6
        movb    $31,%cl
.LN4:
        LODSB
        orb     %al,%al
        jnz     .LN5
        addl    N_255,%ecx
        jmp     .LN4

        ALIGN3
.LN5:
        addl    %eax,%ecx
.LN6:
        movb    (%esi),%al
        incl    %esi

        movl    %eax,%ebx
        andb    $63,%al
        movl    %edi,%edx
        subl    %eax,%edx

        movb    (%esi),%al
        incl    %esi

        shll    $6,%eax
        subl    %eax,%edx
        cmpl    %edi,%edx
        jz      .LEOF

        xchgl   %edx,%esi
        leal    3(%ecx),%ecx
        TEST_LOOKBEHIND(%esi)
        TEST_OP((%edi,%ecx),%eax)
        rep
        movsb

        movl    %edx,%esi
        xorl    %eax,%eax
        shrl    $6,%ebx
        movl    %ebx,%ecx
        jnz     .LIT
        jmp     .L1

.LEOF:
/****   xorl    %eax,%eax          eax=0 from above */

        cmpl    $1,%ecx         /* ecx must be 1 */
        setnz   %al


/*
vi:ts=4
*/