From 0405d7dfff7f7171c65413be14ab054c47b37743 Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Wed, 3 Jan 2001 08:45:52 +0000
Subject: [PATCH] From Raymond Toy: o Try to predict whether branches will be
 taken or not.

---
 compiler/sparc/arith.lisp  | 13 +++++++------
 compiler/sparc/call.lisp   |  5 +++--
 compiler/sparc/macros.lisp |  7 ++++---
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/compiler/sparc/arith.lisp b/compiler/sparc/arith.lisp
index dcb5a7fef..38f51235a 100644
--- a/compiler/sparc/arith.lisp
+++ b/compiler/sparc/arith.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/arith.lisp,v 1.21 2000/09/26 15:14:48 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/arith.lisp,v 1.22 2001/01/03 08:45:52 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -252,7 +252,7 @@
         (inst sra r x 31)
       (inst wry r)
       ;; Remove tag bits so Q and R will be tagged correctly.
-      (inst sra y-int y 2)
+      (inst sra y-int y fixnum-tag-bits)
       (inst nop)
       (inst nop)
 
@@ -282,7 +282,7 @@
   (:generator 12
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
-      (inst b :eq zero)
+      (inst b :eq zero #+sparc-v9 :pn)
       ;; Extend the sign of X into the Y register
         (inst sra r x 31)
       (inst wry r)
@@ -316,7 +316,7 @@
   (:generator 8
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
-      (inst b :eq zero)
+      (inst b :eq zero #+sparc-v9 :pn)
         (inst wry zero-tn)		; Clear out high part
       (inst nop)
       (inst nop)
@@ -346,7 +346,7 @@
   (:generator 8
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
-      (inst b :eq zero)
+      (inst b :eq zero :pn)
       ;; Sign extend the numbers, just in case.
         (inst sra x 0)
       (inst sra y 0)
@@ -374,7 +374,7 @@
   (:generator 8
     (let ((zero (generate-error-code vop division-by-zero-error x y)))
       (inst cmp y zero-tn)
-      (inst b :eq zero)
+      (inst b :eq zero :pn)
       ;; Zap the higher 32 bits, just in case
         (inst srl x 0)
       (inst srl y 0)
@@ -1270,6 +1270,7 @@
 ;; direction of the shift at run-time.
 (in-package "C")
 
+#+nil
 (deftransform ash ((num shift) (integer integer))
   (let ((num-type (continuation-type num))
 	(shift-type (continuation-type shift)))
diff --git a/compiler/sparc/call.lisp b/compiler/sparc/call.lisp
index 6b25f3a2e..addae2e11 100644
--- a/compiler/sparc/call.lisp
+++ b/compiler/sparc/call.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/call.lisp,v 1.27 1997/04/16 18:06:23 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/call.lisp,v 1.28 2001/01/03 08:45:52 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1220,7 +1220,8 @@ default-value-8
     (let ((err-lab
 	   (generate-error-code vop invalid-argument-count-error nargs)))
       (inst cmp nargs (fixnum count))
-      (inst b :ne err-lab)
+      ;; Assume we don't take the branch
+      (inst b :ne err-lab #+sparc-v9 :pn)
       (inst nop))))
 
 ;;; Signal various errors.
diff --git a/compiler/sparc/macros.lisp b/compiler/sparc/macros.lisp
index 9c504b06a..c9fade865 100644
--- a/compiler/sparc/macros.lisp
+++ b/compiler/sparc/macros.lisp
@@ -5,11 +5,11 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.11 2000/12/05 03:07:04 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.12 2001/01/03 08:45:52 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
-;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.11 2000/12/05 03:07:04 dtc Exp $
+;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.12 2001/01/03 08:45:52 dtc Exp $
 ;;;
 ;;; This file contains various useful macros for generating SPARC code.
 ;;;
@@ -276,7 +276,8 @@
        `((inst andcc zero-tn ,reg 3)
 	 ,(if (or lowtags hdrs)
 	      `(inst b :eq ,(if not-p not-target target))
-	      `(inst b ,(if not-p :ne :eq) ,target))))
+	      `(inst b ,(if not-p :ne :eq) ,target
+		       #+sparc-v9 ,(if not-p :pn :pt)))))
      (when (or lowtags hdrs)
        `((inst and ,temp ,reg lowtag-mask)))
      (when lowtags
-- 
GitLab