[Git][cmucl/cmucl][sparc64-dev] 3 commits: Add not-implemented for xep-allocate-frame

Raymond Toy rtoy at common-lisp.net
Wed Jan 3 20:12:45 UTC 2018


Raymond Toy pushed to branch sparc64-dev at cmucl / cmucl


Commits:
54802798 by Raymond Toy at 2018-01-03T11:33:18-08:00
Add not-implemented for xep-allocate-frame

It's done after compute-code-from-fn, but I think if we do it before,
it messes up the computation of the code-tn.

Anyway, this seems to work because I can see xep-allocate-frame
running, and no apparent differences from before.

- - - - -
4200eabe by Raymond Toy at 2018-01-03T12:10:33-08:00
Update fast-truncate for v9

Remove the "v8" from the vop names and update to use v9 instructions
to allow operations with 64-bit values.

- - - - -
49cfead9 by Raymond Toy at 2018-01-03T12:12:52-08:00
Remove stuff that was commented out.

Also remove fast-v9-truncate/unsigned=>unsigned that is wrong for
sparc64.

- - - - -


2 changed files:

- src/compiler/sparc64/arith.lisp
- src/compiler/sparc64/call.lisp


Changes:

=====================================
src/compiler/sparc64/arith.lisp
=====================================
--- a/src/compiler/sparc64/arith.lisp
+++ b/src/compiler/sparc64/arith.lisp
@@ -238,88 +238,9 @@
     (inst xor r y x)
     (inst sub r y)))
 
-;;; Special case fixnum + and - that trap on overflow.  Useful when we
-;;; don't know that the output type is a fixnum.
-
-;;; I (toy at rtp.ericsson.se) took these out.  They don't seem to be
-;;; used anywhere at all.
-#+nil
-(progn
-(define-vop (+/fixnum fast-+/fixnum=>fixnum)
-  (:policy :safe)
-  (:results (r :scs (any-reg descriptor-reg)))
-  (:result-types tagged-num)
-  (:note _N"safe inline fixnum arithmetic")
-  (:generator 4
-    (inst taddcctv r x y)))
-
-(define-vop (+-c/fixnum fast-+-c/fixnum=>fixnum)
-  (:policy :safe)
-  (:results (r :scs (any-reg descriptor-reg)))
-  (:result-types tagged-num)
-  (:note _N"safe inline fixnum arithmetic")
-  (:generator 3
-    (inst taddcctv r x (fixnumize y))))
-
-(define-vop (-/fixnum fast--/fixnum=>fixnum)
-  (:policy :safe)
-  (:results (r :scs (any-reg descriptor-reg)))
-  (:result-types tagged-num)
-  (:note _N"safe inline fixnum arithmetic")
-  (:generator 4
-    (inst tsubcctv r x y)))
-
-(define-vop (--c/fixnum fast---c/fixnum=>fixnum)
-  (:policy :safe)
-  (:results (r :scs (any-reg descriptor-reg)))
-  (:result-types tagged-num)
-  (:note _N"safe inline fixnum arithmetic")
-  (:generator 3
-    (inst tsubcctv r x (fixnumize y))))
-
-)
-
 ;;; Truncate
 
-;; This doesn't work for some reason.
-#+nil
-(define-vop (fast-v8-truncate/fixnum=>fixnum fast-safe-arith-op)
-  (:translate truncate)
-  (:args (x :scs (any-reg))
-	 (y :scs (any-reg)))
-  (:arg-types tagged-num tagged-num)
-  (:results (quo :scs (any-reg))
-	    (rem :scs (any-reg)))
-  (:result-types tagged-num tagged-num)
-  (:note _N"inline fixnum arithmetic")
-  (:temporary (:scs (any-reg) :target quo) q)
-  (:temporary (:scs (any-reg)) r)
-  (:temporary (:scs (signed-reg)) y-int)
-  (:vop-var vop)
-  (:save-p :compute-only)
-  (:guard (or (backend-featurep :sparc-v8)
-	      (and (backend-featurep :sparc-v9)
-		   (not (backend-featurep :sparc-64)))))
-  (:generator 12
-    (let ((zero (generate-error-code vop division-by-zero-error x y)))
-      (inst cmp y zero-tn)
-      (inst b :eq zero)
-      ;; Extend the sign of X into the Y register
-        (inst sra r x 31)
-      (inst wry r)
-      ;; Remove tag bits so Q and R will be tagged correctly.
-      (inst sra y-int y fixnum-tag-bits)
-      (inst nop)
-      (inst nop)
-
-      (inst sdiv q x y-int)		; Q is tagged.
-      ;; We have the quotient so we need to compute the remainder
-      (inst smul r q y-int)		; R is tagged
-      (inst sub rem x r)
-      (unless (location= quo q)
-	(move quo q)))))
-
-(define-vop (fast-v8-truncate/signed=>signed fast-safe-arith-op)
+(define-vop (fast-truncate/signed=>signed fast-safe-arith-op)
   (:translate truncate)
   (:args (x :scs (signed-reg))
 	 (y :scs (signed-reg)))
@@ -332,29 +253,21 @@
   (:temporary (:scs (signed-reg)) r)
   (:vop-var vop)
   (:save-p :compute-only)
-  (:guard (or (backend-featurep :sparc-v8)
-	      (and (backend-featurep :sparc-v9)
-		   (not (backend-featurep :sparc-64)))))
   (:generator 12
     (emit-not-implemented)
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
-      (inst b :eq zero #+sparc-v9 :pn)
-      ;; Extend the sign of X into the Y register
-        (inst sra r x 31)
-      (inst wry r)
-      (inst nop)
-      (inst nop)
+      (inst b :eq zero :pn)
       (inst nop)
 
-      (inst sdiv q x y)
+      (inst sdivx q x y)
       ;; We have the quotient so we need to compue the remainder
-      (inst smul r q y)		; rem
+      (inst mulx r q y)		; rem
       (inst sub rem x r)
       (unless (location= quo q)
 	(move quo q)))))
 
-(define-vop (fast-v8-truncate/unsigned=>unsigned fast-safe-arith-op)
+(define-vop (fast-truncate/unsigned=>unsigned fast-safe-arith-op)
   (:translate truncate)
   (:args (x :scs (unsigned-reg))
 	 (y :scs (unsigned-reg)))
@@ -367,105 +280,13 @@
   (:temporary (:scs (unsigned-reg)) r)
   (:vop-var vop)
   (:save-p :compute-only)
-  (:guard (or (backend-featurep :sparc-v8)
-	      (and (backend-featurep :sparc-v9)
-		   (not (backend-featurep :sparc-64)))))
-  (:generator 8
-    (emit-not-implemented)
-    (let ((zero (generate-error-code vop division-by-zero-error x y)))
-      (inst cmp y zero-tn)
-      (inst b :eq zero #+sparc-v9 :pn)
-        (inst wry zero-tn)		; Clear out high part
-      (inst nop)
-      (inst nop)
-      (inst nop)
-      
-      (inst udiv q x y)
-      ;; Compute remainder
-      (inst umul r q y)
-      (inst sub rem x r)
-      (unless (location= quo q)
-	(inst move quo q)))))
-
-(define-vop (fast-v9-truncate/signed=>signed fast-safe-arith-op)
-  (:translate truncate)
-  (:args (x :scs (signed-reg))
-	 (y :scs (signed-reg)))
-  (:arg-types signed-num signed-num)
-  (:results (quo :scs (signed-reg))
-	    (rem :scs (signed-reg)))
-  (:result-types signed-num signed-num)
-  (:note _N"inline (signed-byte 32) arithmetic")
-  (:temporary (:scs (signed-reg) :target quo) q)
-  (:temporary (:scs (signed-reg)) r)
-  (:vop-var vop)
-  (:save-p :compute-only)
-  (:guard (backend-featurep :sparc-64))
   (:generator 8
     (emit-not-implemented)
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
       (inst b :eq zero :pn)
-      ;; Sign extend the numbers, just in case.
-        (inst signx x)
-      (inst signx y)
-      (inst sdivx q x y)
-      ;; Compute remainder
-      (inst mulx r q y)
-      (inst sub rem x r)
-      (unless (location= quo q)
-	(inst move quo q)))))
-
-#+nil
-(define-vop (fast-v9-truncate/signed64=>signed64 fast-safe-arith-op)
-  (:translate truncate)
-  (:args (x :scs (signed64-reg))
-	 (y :scs (signed64-reg)))
-  (:arg-types signed64-num signed64-num)
-  (:results (quo :scs (signed64-reg))
-	    (rem :scs (signed64-reg)))
-  (:result-types signed64-num signed64-num)
-  (:note _N"inline (signed-byte 32) arithmetic")
-  (:temporary (:scs (signed64-reg) :target quo) q)
-  (:temporary (:scs (signed64-reg)) r)
-  (:vop-var vop)
-  (:save-p :compute-only)
-  (:guard (backend-featurep :sparc-v9))
-  (:generator 8
-    (let ((zero (generate-error-code vop division-by-zero-error x y)))
-      (inst cmp y zero-tn)
-      (inst b :eq zero :pn :xcc)
       (inst nop)
-
-      (inst sdivx q x y)
-      ;; Compute remainder
-      (inst mulx r q y)
-      (inst sub rem x r)
-      (unless (location= quo q)
-	(inst move quo q)))))
-
-(define-vop (fast-v9-truncate/unsigned=>unsigned fast-safe-arith-op)
-  (:translate truncate)
-  (:args (x :scs (unsigned-reg))
-	 (y :scs (unsigned-reg)))
-  (:arg-types unsigned-num unsigned-num)
-  (:results (quo :scs (unsigned-reg))
-	    (rem :scs (unsigned-reg)))
-  (:result-types unsigned-num unsigned-num)
-  (:note _N"inline (unsigned-byte 32) arithmetic")
-  (:temporary (:scs (unsigned-reg) :target quo) q)
-  (:temporary (:scs (unsigned-reg)) r)
-  (:vop-var vop)
-  (:save-p :compute-only)
-  (:guard (backend-featurep :sparc-64))
-  (:generator 8
-    (emit-not-implemented)
-    (let ((zero (generate-error-code vop division-by-zero-error x y)))
-      (inst cmp y zero-tn)
-      (inst b :eq zero :pn)
-      ;; Zap the higher 32 bits, just in case
-        (inst clruw x)
-      (inst clruw y)
+      
       (inst udivx q x y)
       ;; Compute remainder
       (inst mulx r q y)
@@ -473,6 +294,7 @@
       (unless (location= quo q)
 	(inst move quo q)))))
 
+
 ;;; Shifting
 
 (define-vop (fast-ash/signed=>signed)


=====================================
src/compiler/sparc64/call.lisp
=====================================
--- a/src/compiler/sparc64/call.lisp
+++ b/src/compiler/sparc64/call.lisp
@@ -180,8 +180,6 @@
       (inst word 0)
       (inst word 0))
 
-    ;;(emit-not-implemented)
-
     ;; The start of the actual code.
     ;; Fix CODE, cause the function object was passed in.
     (inst compute-code-from-fn code-tn code-tn start-lab temp)
@@ -209,6 +207,7 @@
 	(inst b :lt zero-out-mem)
 	(inst add csp-tn vm:word-bytes))
       )
+    (emit-not-implemented)
     ;; Build our stack frames.
     (let ((size (* vm:word-bytes (sb-allocated-size 'control-stack))))
       (cond ((typep size '(signed-byte 13))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/47d140f4b307a9b3f60822df6ec551dbf6619802...49cfead9e217bb90e2f6c2795c4901f15dbd99d0

---
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/47d140f4b307a9b3f60822df6ec551dbf6619802...49cfead9e217bb90e2f6c2795c4901f15dbd99d0
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20180103/5d567baa/attachment-0001.html>


More information about the cmucl-cvs mailing list