picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit c3294e9366a6ccf6707e677952c00ffe540343be
parent b82100d9a5beb3a8f98f771b60b9cbd9c739b8ab
Author: Alexander Burger <abu@software-lab.de>
Date:   Fri,  4 Mar 2011 07:25:55 +0100

Removed 'zero' instruction
Diffstat:
Mdoc64/asm | 3+--
Msrc64/arch/x86-64.l | 5+----
Msrc64/big.l | 50+++++++++++++++++++++++++-------------------------
Msrc64/db.l | 8++++----
Msrc64/io.l | 10+++++-----
Msrc64/lib/asm.l | 3+--
Msrc64/main.l | 12++++++------
Msrc64/subr.l | 6+++---
Msrc64/sym.l | 16++++++++--------
9 files changed, 54 insertions(+), 59 deletions(-)

diff --git a/doc64/asm b/doc64/asm @@ -1,4 +1,4 @@ -# 11sep10abu +# 04mar11abu # (c) Software Lab. Alexander Burger @@ -138,7 +138,6 @@ slen dst src # Set 'dst' to the string length of 'src' memb src cnt # Find B in 'cnt' bytes of memory null src # Compare 'src' with 0 [zs_] - zero src # Test if ZERO [z..] nul4 # Compare four bytes in 'A' with 0 [zs_] Byte addressing: diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l @@ -1,4 +1,4 @@ -# 25feb11abu +# 03mar11abu # (c) Software Lab. Alexander Burger # Byte order @@ -470,9 +470,6 @@ (asm null (Src S) (prinst "cmp" "%r12" (src Src S)) ) -(asm zero (Src S) - (prinst "cmpq" "$2" (src Src S)) ) - (asm nul4 () (prinst "cmp" "%r12d" "%eax") ) diff --git a/src64/big.l b/src64/big.l @@ -1,4 +1,4 @@ -# 26feb11abu +# 03mar11abu # (c) Software Lab. Alexander Burger ### Destructive primitives ### @@ -17,7 +17,7 @@ lea C (A BIG) # New short-tail ld A (C) # Next cell loop - zero (A BIG) # Trailing short zero? + cmp (A BIG) ZERO # Trailing short zero? if eq # Yes ld A (A DIG) null A # Null digit? @@ -693,7 +693,7 @@ end xchg A E # Exchange args call 10 # Subtract short from big - zero A # Zero? + cmp A ZERO # Zero? if ne # No or A SIGN # Set negative end @@ -707,7 +707,7 @@ sub C E # Subtract from first digit ld E (A BIG) # Tail in E if nc # No borrow - zero E # Leading zero? + cmp E ZERO # Leading zero? jne consNumCE_A # No: Cons new cell test C (hex "F000000000000000") # Fit in short number? jnz consNumCE_A # No: Cons new cell @@ -859,7 +859,7 @@ (code 'muluAE_A 0) cnt A # A short? if nz # Yes - zero A # Multiply with zero? + cmp A ZERO # Multiply with zero? jeq ret # Yes: Return zero shr A 4 # Normalize cnt E # E also short? @@ -930,7 +930,7 @@ # A is big cnt E # E short? if nz # Yes - zero E # Multiply with zero? + cmp E ZERO # Multiply with zero? jeq ret # Yes: Return zero xchg A E # Exchange args shr A 4 # Normalize @@ -1080,7 +1080,7 @@ ld E C inc X # Increment 'm' loop - zero A # Trailing short zero? + cmp A ZERO # Trailing short zero? if ne # No shr A 4 # Normalize call boxNum_C # Append in new cell @@ -1117,7 +1117,7 @@ ld X E dec (L -I) # Decrement 'm' loop - zero A # Trailing short zero? + cmp A ZERO # Trailing short zero? if ne # No shr A 4 # Normalize call boxNumA_A # Append in new cell @@ -1301,7 +1301,7 @@ ld E C inc X # Increment 'm' loop - zero A # Trailing short zero? + cmp A ZERO # Trailing short zero? if ne # No shr A 4 # Normalize call boxNum_C # Append in new cell @@ -1338,7 +1338,7 @@ ld X E dec (L -I) # Decrement 'm' loop - zero A # Trailing short zero? + cmp A ZERO # Trailing short zero? if ne # No shr A 4 # Normalize call boxNumA_A # Append in new cell @@ -1494,7 +1494,7 @@ jz adduAE_A # Increment off E SIGN # Make positive call subuAE_A # Subtract - zero A # Zero? + cmp A ZERO # Zero? if ne # No or A SIGN # Negate again end @@ -1532,7 +1532,7 @@ off E SIGN call adduAE_A # Add end - zero A # Zero? + cmp A ZERO # Zero? if ne # No xor A SIGN # Negate end @@ -1557,7 +1557,7 @@ off E SIGN call subuAE_A # Sub end - zero A # Zero? + cmp A ZERO # Zero? if ne # No xor A SIGN # Negate end @@ -1781,7 +1781,7 @@ ld E (L I) # Get result test (L -II) 1 # Sign? if nz # Yes - zero E # Zero? + cmp E ZERO # Zero? if ne # No xor E SIGN # Negate end @@ -2220,7 +2220,7 @@ ld Y (Y CDR) # More than one arg? atom Y if nz # No: Unary minus - zero E # Zero? + cmp E ZERO # Zero? if ne # No xor E SIGN # Negate end @@ -2431,7 +2431,7 @@ ld E (L I) # Result test (L -I) 1 # Sign? if nz # Yes - zero E # Zero? + cmp E ZERO # Zero? if ne # No or E SIGN # Set negative end @@ -2485,7 +2485,7 @@ call muluAE_A # Multiply ld (L I) A # Result loop - zero E # Zero? + cmp E ZERO # Zero? jeq divErrX # Yes ld A E # Last argument call shruA_A # / 2 @@ -2496,7 +2496,7 @@ ld E A # Result test (L -I) 1 # Sign? if nz # Yes - zero E # Zero? + cmp E ZERO # Zero? if ne # No or E SIGN # Set negative end @@ -2540,7 +2540,7 @@ jz 10 # Abort if NIL num E # Number? jz numErrEX # No - zero E # Zero? + cmp E ZERO # Zero? jeq divErrX # Yes test E SIGN # Arg negative? if nz # Yes @@ -2555,7 +2555,7 @@ ld E (L I) # Result test (L -I) 1 # Sign? if nz # Yes - zero E # Zero? + cmp E ZERO # Zero? if ne # No or E SIGN # Set negative end @@ -2599,7 +2599,7 @@ jz 10 # Abort if NIL num E # Number? jz numErrEX # No - zero E # Zero? + cmp E ZERO # Zero? jeq divErrX # Yes off E SIGN # Make argument positive ld (L II) E # Save arg @@ -2610,7 +2610,7 @@ ld E (L I) # Result test (L -I) 1 # Sign? if nz # Yes - zero E # Zero? + cmp E ZERO # Zero? if ne # No or E SIGN # Set negative end @@ -2665,7 +2665,7 @@ loop end end - zero A # Result zero? + cmp A ZERO # Result zero? if ne # No or A (L -II) # Sign bit end @@ -2694,7 +2694,7 @@ eval # Eval it num E # Number? jz retNil - zero E # Zero? + cmp E ZERO # Zero? if ne # No test E SIGN # Negative? jz retNil @@ -2719,7 +2719,7 @@ eval # Eval it num E # Number? jz retNil - zero E # Zero? + cmp E ZERO # Zero? jeq retNil test E SIGN # Positive? jnz retNil diff --git a/src64/db.l b/src64/db.l @@ -1,4 +1,4 @@ -# 27sep10abu +# 03mar11abu # (c) Software Lab. Alexander Burger # 6 bytes in little endian format @@ -1248,7 +1248,7 @@ if nz # Yes ld X (X TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if ne # Yes cnt X # Short name? if nz # Yes @@ -1969,7 +1969,7 @@ ld Y (E CDR) # Y on args ld E (Y) # Eval first eval - zero E # Zero? + cmp E ZERO # Zero? if eq # Yes ld X (DbFiles) # Iterate DB files ld Y (DBs) # Count @@ -2031,7 +2031,7 @@ end ld E Nil # Return NIL else # Bit was set - zero (S) # Second arg '0'? + cmp (S) ZERO # Second arg '0'? if eq # Yes not B and (E) B # Clear mark diff --git a/src64/io.l b/src64/io.l @@ -1,4 +1,4 @@ -# 26feb11abu +# 03mar11abu # (c) Software Lab. Alexander Burger # Close file descriptor @@ -838,7 +838,7 @@ push Y ld X (E TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if eq # No ld B NIX # Output NIX call (PutBinBZ) @@ -1082,7 +1082,7 @@ (code 'symByteCX_FACX 0) null C # New round? if z # Yes - zero X # Done? + cmp X ZERO # Done? jeq ret # Yes: Return 'z' cnt X # Short? if nz # Yes @@ -4671,7 +4671,7 @@ if nz # Yes ld X (E TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if eq # No ld B (char "$") # $xxxxxx call (PutB) @@ -4890,7 +4890,7 @@ if nz # Yes ld X (E TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if ne # Yes sym (E TAIL) # External symbol? if z # No diff --git a/src64/lib/asm.l b/src64/lib/asm.l @@ -1,4 +1,4 @@ -# 25feb11abu +# 03mar11abu # (c) Software Lab. Alexander Burger # *LittleEndian *Registers optimize @@ -484,7 +484,6 @@ (word (operand (read))) (xchg (destination) "*Mode" (destination) "*Mode") (xor (destination) "*Mode" (source) "*Mode") - (zero (source) "*Mode") (zxt) ) ) diff --git a/src64/main.l b/src64/main.l @@ -1,4 +1,4 @@ -# 01mar11abu +# 03mar11abu # (c) Software Lab. Alexander Burger ### Global return labels ### @@ -819,11 +819,11 @@ jz Retnz # No: 'ne' ld A (A TAIL) call nameA_A # Get name of A - zero A # Any? + cmp A ZERO # Any? jeq retnz # No: 'ne' ld E (E TAIL) call nameE_E # Get name of E - zero E # Any? + cmp E ZERO # Any? jeq retnz # No: 'ne' jmp equalAE_F end @@ -952,11 +952,11 @@ push X # [<sym> <sym>] ld X (A TAIL) call nameX_X # Get A's name in X - zero X # Any? + cmp X ZERO # Any? if eq # No ld E (E TAIL) call nameE_E # Second name in E - zero E # Any? + cmp E ZERO # Any? if eq # No rol B 4 # Random bit from A (...x1000) into carry (non-zero) else @@ -967,7 +967,7 @@ end ld E (E TAIL) call nameE_E # Get E's name in E - zero E # Any? + cmp E ZERO # Any? if eq # No 50 or B B # nz 60 clrc # gt diff --git a/src64/subr.l b/src64/subr.l @@ -1,4 +1,4 @@ -# 25jan11abu +# 03mar11abu # (c) Software Lab. Alexander Burger # (car 'var) -> any @@ -1018,7 +1018,7 @@ if ne # No num E # Number? jz numErrEX # No - zero E # Zero? + cmp E ZERO # Zero? jeq argErrEX # Yes test E SIGN # Negative? jnz argErrEX # Yes @@ -2881,7 +2881,7 @@ else ld E (E TAIL) call nameE_E # Get name - zero E # Any? + cmp E ZERO # Any? if eq # No ld C ZERO # Return zero else diff --git a/src64/sym.l b/src64/sym.l @@ -1,4 +1,4 @@ -# 26feb11abu +# 03mar11abu # (c) Software Lab. Alexander Burger ### Compare long names ### @@ -883,7 +883,7 @@ jz symErrEX ld X (E TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if ne # Yes push Y ld Y Intern # Insert internal @@ -909,7 +909,7 @@ jz symErrEX ld X (E TAIL) call nameX_X # Get name - zero X # Any? + cmp X ZERO # Any? if ne # Yes ld C 0 # Character index call symCharCX_FACX # First char @@ -1361,11 +1361,11 @@ jeq ret # Yes ld A (A TAIL) # First symbol call nameA_A # Get name - zero A # None? + cmp A ZERO # None? jeq ret # Yes ld E (E TAIL) # Second symbol call nameE_E # Get name - zero E # Any? + cmp E ZERO # Any? jeq retnz # No push X push Y @@ -1383,7 +1383,7 @@ ld A (S) shr A 8 # New round in second index? if z # Yes - zero Z # Second done? + cmp Z ZERO # Second done? if eq # Yes clrz # 'nz' break T @@ -2368,7 +2368,7 @@ ret (code 'putACE 0) - zero C # Key is zero? + cmp C ZERO # Key is zero? jeq setAE # Yes push X ld X (A TAIL) # Properties @@ -2554,7 +2554,7 @@ call dbFetchEX # Fetch it end (code 'getEC_E 0) - zero C # Key is zero? + cmp C ZERO # Key is zero? jeq retE_E # Get value ld A (E TAIL) # Get tail num A # No properties?