wok diff linld/stuff/src/pipehole.awk @ rev 21569

Up zstd (1.4.0), fix linld: base_himem/strtol
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 18 13:29:32 2019 +0200 (2019-05-18)
parents cbcb33ee9044
children 66530154b12f
line diff
     1.1 --- a/linld/stuff/src/pipehole.awk	Tue Feb 12 12:12:36 2019 +0100
     1.2 +++ b/linld/stuff/src/pipehole.awk	Sat May 18 13:29:32 2019 +0200
     1.3 @@ -35,6 +35,9 @@
     1.4  		if (/^	sub	[abcds][ix],2$/) {
     1.5  			split($2,regs,","); hold=13; next
     1.6  		}
     1.7 +		if (/^	push	dx$/) {
     1.8 +			hold=14; next;
     1.9 +		}
    1.10  	}
    1.11  	else if (hold == 1) {
    1.12  		if (/^   ;/) { line[kept++]=$0; next }
    1.13 @@ -185,6 +188,29 @@
    1.14  		}
    1.15  		else	print "	sub	" regs[1] ",2"
    1.16  	}
    1.17 +	else if (hold == 14) {
    1.18 +		if (/^	push	ax$/) { hold++; next; }
    1.19 +		print	"	push	dx";
    1.20 +		hold=0;
    1.21 +	}
    1.22 +	else if (hold == 15) {
    1.23 +		if (/^	pop	eax$/) { hold++; next; }
    1.24 +		print	"	push	dx";
    1.25 +		print	"	push	ax";
    1.26 +		hold=0;
    1.27 +	}
    1.28 +	else if (hold == 16) {
    1.29 +		hold=0;
    1.30 +		if (/^	shr	eax,16$/) { print "	xchg	ax,dx"; next; }
    1.31 +		print	"	push	dx";
    1.32 +		print	"	push	ax";
    1.33 +		print	"	pop	eax";
    1.34 +	}
    1.35 +	else if (hold == 17) {
    1.36 +		hold=0;
    1.37 +		if (/^	cmp	ax,-1$/) { print "	inc	ax"; next; }
    1.38 +	}
    1.39 +	if (/^	call	near ptr @fileexist\$/) { print; hold=17; next; }
    1.40  	s=$0
    1.41  	# These optimisation may break ZF or CF
    1.42  	if (/^	sub	sp,2$/) { print "	push	ax"; next }