commit c59999c2fbb4623beb3eab994c06c8f3434ef78f
parent af8fc0a67851580edab96ae0668ec41762290105
Author: Alexander Burger <abu@software-lab.de>
Date: Sat, 5 Jan 2013 11:34:18 +0100
pil64 'nulp' instruction
Diffstat:
6 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/doc64/asm b/doc64/asm
@@ -1,4 +1,4 @@
-# 02nov12abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
@@ -137,6 +137,7 @@
cmpn dst src cnt # Compare 'cnt' bytes 'dst' with 'src' [z..]
slen dst src # Set 'dst' to the string length of 'src' [...]
memb src cnt # Find B in 'cnt' bytes of 'src' memory [z..]
+ nulp src # Check 'src' for null-pointer [z..]
null src # Compare 'src' with 0 [zs_]
nul4 # Compare four bytes in 'A' with 0 [zs_]
diff --git a/src64/arch/emu.l b/src64/arch/emu.l
@@ -1,4 +1,4 @@
-# 25nov12abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
# Byte order
@@ -515,6 +515,10 @@
(genCode (Src S) (list 'null Src) ((op.n Src S))
"Carry = 0, Result = @1;" ) )
+(asm nulp (Src S)
+ (genCode (Src S) (list 'nulp Src) ((op.i Src S))
+ "Result = @1;" ) )
+
(asm nul4 ()
(genCode NIL '(nul4) NIL
"Carry = 0, Result = (int32_t)A.l;" ) )
diff --git a/src64/arch/ppc64.l b/src64/arch/ppc64.l
@@ -1,4 +1,4 @@
-# 02nov12abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
# Byte order
@@ -821,6 +821,9 @@
##? (prinst "li" 31 -2) # Clear carry
(prinst "cmpdi" (srcReg Src S) 0) )
+(asm nulp (Src S)
+ (prinst "cmpdi" (srcReg Src S) 0) )
+
(asm nul4 ()
##? (prinst "li" 31 -2) # Clear carry
(prinst "sldi" 3 3 32)
diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l
@@ -1,4 +1,4 @@
-# 02nov12abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
# Byte order
@@ -469,6 +469,9 @@
(asm null (Src S)
(prinst "cmp" "%r12" (src Src S)) )
+(asm nulp (Src S)
+ (prinst "cmp" "%r12" (src Src S)) )
+
(asm nul4 ()
(prinst "cmp" "%r12d" "%eax") )
diff --git a/src64/lib/asm.l b/src64/lib/asm.l
@@ -1,4 +1,4 @@
-# 17nov12abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
# *LittleEndian *AlignedCode *Registers optimize
@@ -488,6 +488,7 @@
(nul (source) "*Mode")
(nul4)
(null (source) "*Mode")
+ (nulp (source) "*Mode")
(num (source) "*Mode")
(off (destination) "*Mode" (source T) "*Mode")
(or (destination) "*Mode" (source) "*Mode")
diff --git a/src64/net.l b/src64/net.l
@@ -1,4 +1,4 @@
-# 20oct11abu
+# 05jan13abu
# (c) Software Lab. Alexander Burger
# (port ['T] 'cnt|(cnt . cnt) ['var]) -> cnt
@@ -202,7 +202,7 @@
sub S (%% NI_MAXHOST) # <S> Hostname buffer
ld C Z # Get 'lst'
do
- null C # Any?
+ nulp C # Any?
while nz # Yes
ld4 (C AI_ADDRLEN)
cc getnameinfo((C AI_ADDR) A S NI_MAXHOST 0 0 NI_NAMEREQD)
@@ -234,7 +234,7 @@
if z # Yes
ld Z E # Keep list in Z
do
- null E # Any?
+ nulp E # Any?
while nz # Yes
ld4 (E AI_SOCKTYPE) # Create socket
ld C A
@@ -339,7 +339,7 @@
call binPrintEZ # Print item
ld E X # Get list
do
- null E # Any?
+ nulp E # Any?
while nz # Yes
ld4 (E AI_SOCKTYPE) # Create socket
ld C A