wok diff memtest/stuff/unlzma.S @ rev 20577
Up btrfs-progs (4.19.1)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Dec 13 18:01:50 2018 +0100 (2018-12-13) |
parents | 4458f0f34c92 |
children | 8d938c826a9b |
line diff
1.1 --- a/memtest/stuff/unlzma.S Thu Sep 01 16:30:12 2016 +0200 1.2 +++ b/memtest/stuff/unlzma.S Thu Dec 13 18:01:50 2018 +0100 1.3 @@ -106,13 +106,27 @@ 1.4 */ 1.5 1.6 mov $ws1, CX 1.7 +#ifdef ONLY8086 1.8 + movw $2048/2, %ax 1.9 +lzd1: 1.10 + pushw %ax 1.11 +#else 1.12 lzd1: 1.13 pushw $2048/2 1.14 +#endif 1.15 loop lzd1 1.16 mov SP, BP 1.17 movb $((LOCALS+3)/4)*2, %cl 1.18 +#ifdef ONLY8086 1.19 + movw $1, %ax 1.20 + cwd 1.21 +initlocals: 1.22 + pushw %dx 1.23 + pushw %ax 1.24 +#else 1.25 initlocals: 1.26 pushl $1 1.27 +#endif 1.28 loop initlocals 1.29 1.30 #if !defined(FLAT32) && !defined(FLAT16OUT) 1.31 @@ -175,12 +189,22 @@ 1.32 // ((((nowPos) & literalPosMask) << lc) + (previousByte >> (8 - lc)))); 1.33 1.34 #if PROP_LC != 0 1.35 +# ifdef ONLY8086 1.36 + movb $8-PROP_LC, %cl 1.37 + shrb %cl, %bl 1.38 +# else 1.39 shrb $8-PROP_LC, %bl 1.40 +# endif 1.41 #endif 1.42 1.43 #if PROP_LP != 0 1.44 movb posState2(BP), %dl 1.45 +# ifdef ONLY8086 1.46 + movb $PROP_LC, %cl 1.47 + shl %cl, DX 1.48 +# else 1.49 shl $PROP_LC, DX 1.50 +# endif 1.51 movb $0, %bh 1.52 add BX, DX 1.53 #endif 1.54 @@ -338,6 +362,23 @@ 1.55 // rep1 = rep0; rep0 = distance; 1.56 1.57 lzd11z: 1.58 +# ifdef ONLY8086 1.59 + shl $1, CX 1.60 + shl $1, CX // 8->32 bits 1.61 + sub CX, DI // &rep[cx] 1.62 + movw (BP, DI), %ax 1.63 + pushw 2(BP, DI) 1.64 +rotreplp: 1.65 + movb 4(BP, DI), %bl 1.66 + movb %bl, (BP, DI) 1.67 + inc DI 1.68 + loop rotreplp 1.69 + popw %bx 1.70 + testb %dh, %dh 1.71 + jnz lzd10 1.72 + movw %ax, (BP, DI) 1.73 + movw %bx, 2(BP, DI) 1.74 +# else 1.75 shl $2, CX // 8->32 bits 1.76 sub CX, DI // &rep[cx] 1.77 movl (BP, DI), %eax 1.78 @@ -349,6 +390,7 @@ 1.79 testb %dh, %dh 1.80 jnz lzd10 1.81 movl %eax, (BP, DI) 1.82 +# endif 1.83 1.84 // } 1.85 lzd12: 1.86 @@ -497,7 +539,17 @@ 1.87 // rep0 <<= numDirectBits; 1.88 1.89 neg AX 1.90 +# ifdef ONLY8086 1.91 + pushw %cx 1.92 + movb $0, %ch 1.93 +shllrep0: 1.94 + shlw $1, (BP, DI) 1.95 + rclw $1, 2(BP, DI) 1.96 + loop shllrep0 1.97 + popw %cx 1.98 +# else 1.99 shll %cl, (BP, DI) 1.100 +# endif 1.101 add (BP, DI), AX 1.102 1.103 // prob = p + SpecPos /*688*/ + rep0 - posSlot - 1; 1.104 @@ -515,6 +567,26 @@ 1.105 1.106 lzd23z: 1.107 call RC_NORMALIZE 1.108 +# ifdef ONLY8086 1.109 + pushw %dx 1.110 + shrw $1, Range+2(BP) 1.111 + rcrw $1, Range(BP) 1.112 + movw Range(BP), %ax 1.113 + movw Range+2(BP), %dx 1.114 + cmpw Code+2(BP), %dx 1.115 + ja lzd25 1.116 + jb lzd25x 1.117 + cmpw Code(BP), %ax 1.118 + ja lzd25 1.119 +lzd25x: 1.120 + subw %ax, Code(BP) 1.121 + sbbw %dx, Code+2(BP) 1.122 + stc 1.123 +lzd25: 1.124 + popw %dx 1.125 + rclw $1, (BP, DI) 1.126 + rclw $1, 2(BP, DI) 1.127 +# else 1.128 shrl $1, Range(BP) 1.129 movl Range(BP), %eax 1.130 cmpl Code(BP), %eax 1.131 @@ -523,6 +595,7 @@ 1.132 stc 1.133 lzd25: 1.134 rcll $1, (BP, DI) 1.135 +# endif 1.136 1.137 // } while (--numDirectBits != 0); 1.138 1.139 @@ -532,7 +605,17 @@ 1.140 // prob = p + Align /* 802 */; numDirectBits = kNumAlignBits /*4*/; 1.141 // rep0 <<= numDirectBits; 1.142 1.143 +# ifdef ONLY8086 1.144 + pushw %cx 1.145 + movb $0, %ch 1.146 +shlrep0: 1.147 + shlw $1, (BP, DI) 1.148 + rclw $1, 2(BP, DI) 1.149 + loop shlrep0 1.150 + popw %cx 1.151 +# else 1.152 shll %cl, (BP, DI) 1.153 +# endif 1.154 mov $802, AX 1.155 // } 1.156 1.157 @@ -554,7 +637,13 @@ 1.158 lzd22: 1.159 // if (++rep0 == (UInt32)(0)) break; /* EOF */ 1.160 1.161 +# ifdef ONLY8086 1.162 + incw (BP, DI) 1.163 + jnz lzd19 1.164 + incw 2(BP, DI) 1.165 +# else 1.166 incl (BP, DI) 1.167 +# endif 1.168 1.169 lzd19: 1.170 pop CX 1.171 @@ -610,6 +699,24 @@ 1.172 1.173 Dico2ESDI: 1.174 #if !defined(FLAT32) && !defined(FLAT16OUT) 1.175 +# ifdef ONLY8086 1.176 + pushw %ax 1.177 + movw nowPos(%bp), %bx 1.178 + movw nowPos+2(%bp), %ax 1.179 + jnc Dico2ESDIz 1.180 + subw rep0(%bp), %bx 1.181 + sbbw rep0+2(%bp), %ax 1.182 +Dico2ESDIz: 1.183 + movw $0xF, %di 1.184 + andw %bx, %di 1.185 + pushw %cx 1.186 + movb $4, %cl 1.187 + shrw %cl, %bx 1.188 + shlw %cl, %ax 1.189 + popw %cx 1.190 + addb %al, %bh 1.191 + popw %ax 1.192 +# else 1.193 movl nowPos(%bp), %ebx 1.194 jnc Dico2ESDIz 1.195 subl rep0(%bp), %ebx 1.196 @@ -617,6 +724,7 @@ 1.197 movw %bx, %di 1.198 xorw %bx, %bx 1.199 shrl $4, %ebx 1.200 +# endif 1.201 movw %bx, %es 1.202 #else 1.203 mov nowPos(BP), DI 1.204 @@ -673,7 +781,14 @@ 1.205 andb $((1 << PROP_LP) -1), posState2(BP) 1.206 # endif 1.207 #endif 1.208 +#ifdef ONLY8086 1.209 + incw nowPos(BP) 1.210 + jnz incnowPosDone 1.211 + incw nowPos+2(BP) 1.212 +incnowPosDone: 1.213 +#else 1.214 incl nowPos(BP) 1.215 +#endif 1.216 ret 1.217 1.218 // 1.219 @@ -690,8 +805,20 @@ 1.220 jne RC_NORMALIZE_1 1.221 RC_LOAD_BYTE: 1.222 push AX 1.223 +#ifdef ONLY8086 1.224 + movw Range+1(BP), %ax 1.225 + movw %ax, Range+2(BP) 1.226 + movw Code+1(BP), %ax 1.227 + movw %ax, Code+2(BP) 1.228 + xorw %ax, %ax 1.229 + movb Range(BP), %ah 1.230 + movw %ax, Range(BP) 1.231 + movb Code(BP), %ah 1.232 + movw %ax, Code(BP) 1.233 +#else 1.234 shll $8, Range(BP) 1.235 shll $8, Code(BP) 1.236 +#endif 1.237 #if !defined(FLAT16) && !defined(FLAT32) 1.238 testw %si, %si 1.239 jns RC_READ_BYTE 1.240 @@ -741,7 +868,14 @@ 1.241 1.242 call RC_NORMALIZE // kill %ax, update %si 1.243 1.244 +#ifdef ONLY8086 1.245 + pushw %ax 1.246 + pushw %cx 1.247 + pushw %dx 1.248 + pushw %di 1.249 +#else 1.250 pushal 1.251 +#endif 1.252 1.253 xchg AX, DI 1.254 add DI, DI // short * 1.255 @@ -749,19 +883,48 @@ 1.256 1.257 // bound = (Range>>kNumBitModelTotalBits /*11*/) * *(p); 1.258 1.259 +#ifdef ONLY8086 1.260 + movw Range(BP), %dx 1.261 + movw Range+2(BP), %ax 1.262 + movw $11, %cx 1.263 +shr11lp: 1.264 + shrw $1, %ax 1.265 + rcrw $1, %dx 1.266 + loop shr11lp 1.267 + movw %dx, %cx 1.268 + mulw (BP, DI) 1.269 + xchgw %ax, %cx 1.270 + mulw (BP, DI) 1.271 + addw %cx, %dx 1.272 +#else 1.273 movl Range(BP), %eax 1.274 shrl $11, %eax 1.275 movzwl (BP, DI), %edx 1.276 mull %edx 1.277 +#endif 1.278 1.279 // if (Code < bound) { 1.280 1.281 +#ifdef ONLY8086 1.282 + cmpw Code+2(BP), %dx 1.283 + jb Bit1_1 1.284 + ja Bit1_1x 1.285 + cmpw Code(BP), %ax 1.286 + jbe Bit1_1 1.287 +Bit1_1x: 1.288 + 1.289 +// Range = bound; 1.290 + 1.291 + movw %ax, Range(BP) 1.292 + movw %dx, Range+2(BP) 1.293 +#else 1.294 cmpl Code(BP), %eax 1.295 jbe Bit1_1 1.296 1.297 // Range = bound; 1.298 1.299 movl %eax, Range(BP) 1.300 +#endif 1.301 1.302 // *(p) += (kBitModelTotal /*2048*/ - *(p)) >> kNumMoveBits /*5*/; 1.303 1.304 @@ -778,8 +941,15 @@ 1.305 1.306 // Range -= bound; Code -= bound; 1.307 1.308 +#ifdef ONLY8086 1.309 + subw %ax, Range(BP) 1.310 + sbbw %dx, Range+2(BP) 1.311 + subw %ax, Code(BP) 1.312 + sbbw %dx, Code+2(BP) 1.313 +#else 1.314 subl %eax, Range(BP) 1.315 subl %eax, Code(BP) 1.316 +#endif 1.317 1.318 // *(p) -= (*(p)) >> kNumMoveBits /*5*/; 1.319 1.320 @@ -791,10 +961,22 @@ 1.321 Bit1_2: 1.322 pushf 1.323 subw (BP, DI), %ax 1.324 +#ifdef ONLY8086 1.325 + movb $5, %cl 1.326 + sarw %cl, %ax 1.327 +#else 1.328 sarw $5, %ax 1.329 +#endif 1.330 addw %ax, (BP, DI) 1.331 popf 1.332 +#ifdef ONLY8086 1.333 + popw %di 1.334 + popw %dx 1.335 + popw %cx 1.336 + popw %ax 1.337 +#else 1.338 popal 1.339 +#endif 1.340 sbb AX, AX 1.341 1.342 // }