Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
b4a2ee95
Commit
b4a2ee95
authored
25 years ago
by
dtc
Browse files
Options
Downloads
Patches
Plain Diff
Enhancements to the logcount VOP for the V9, and to emit-multiply for
the V8 and V9; from Raymond Toy.
parent
579bf92d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/sparc/arith.lisp
+58
-19
58 additions, 19 deletions
compiler/sparc/arith.lisp
with
58 additions
and
19 deletions
compiler/sparc/arith.lisp
+
58
−
19
View file @
b4a2ee95
...
@@ -5,13 +5,11 @@
...
@@ -5,13 +5,11 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
;;;
(
ext:file-comment
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/arith.lisp,v 1.1
1
199
8
/0
3/21 08:05:20
dtc Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/arith.lisp,v 1.1
2
199
9
/0
6/19 16:01:02
dtc Exp $"
)
;;;
;;;
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/arith.lisp,v 1.11 1998/03/21 08:05:20 dtc Exp $
;;; This file contains the VM definition arithmetic VOPs for the SPARC.
;;;
;;; This file contains the VM definition arithmetic VOPs for the MIPS.
;;;
;;;
;;; Written by Rob MacLachlan
;;; Written by Rob MacLachlan
;;;
;;;
...
@@ -288,6 +286,7 @@
...
@@ -288,6 +286,7 @@
(
:results
(
res
:scs
(
any-reg
)))
(
:results
(
res
:scs
(
any-reg
)))
(
:result-types
positive-fixnum
)
(
:result-types
positive-fixnum
)
(
:temporary
(
:scs
(
non-descriptor-reg
)
:from
(
:argument
0
))
shift
temp
)
(
:temporary
(
:scs
(
non-descriptor-reg
)
:from
(
:argument
0
))
shift
temp
)
(
:guard
(
not
(
backend-featurep
:sparc-v9
)))
(
:generator
30
(
:generator
30
(
let
((
loop
(
gen-label
))
(
let
((
loop
(
gen-label
))
(
done
(
gen-label
)))
(
done
(
gen-label
)))
...
@@ -303,6 +302,21 @@
...
@@ -303,6 +302,21 @@
(
emit-label
done
))))
(
emit-label
done
))))
(
define-vop
(
unsigned-byte-32-count
)
(
:translate
logcount
)
(
:note
"inline (unsigned-byte 32) logcount"
)
(
:policy
:fast-safe
)
(
:args
(
arg
:scs
(
unsigned-reg
)))
(
:arg-types
unsigned-num
)
(
:results
(
res
:scs
(
unsigned-reg
)))
(
:result-types
unsigned-num
)
(
:guard
(
backend-featurep
:sparc-v9
))
(
:generator
2
;; Clear the upper 32-bits, just in case. Is this really needed?
(
inst
srl
res
res
0
)
(
inst
popc
res
arg
)))
;;; Multiply and Divide.
;;; Multiply and Divide.
(
define-vop
(
fast-*/fixnum=>fixnum
fast-fixnum-binop
)
(
define-vop
(
fast-*/fixnum=>fixnum
fast-fixnum-binop
)
...
@@ -632,21 +646,46 @@
...
@@ -632,21 +646,46 @@
Note: the lifetimes of MULTIPLICAND and RESULT-HIGH overlap."
Note: the lifetimes of MULTIPLICAND and RESULT-HIGH overlap."
(
declare
(
type
tn
multiplier
result-high
result-low
)
(
declare
(
type
tn
multiplier
result-high
result-low
)
(
type
(
or
tn
(
signed-byte
13
))
multiplicand
))
(
type
(
or
tn
(
signed-byte
13
))
multiplicand
))
(
let
((
label
(
gen-label
)))
(
cond
#+
nil
(
inst
wry
multiplier
)
((
backend-featurep
:sparc-v9
)
(
inst
andcc
result-high
zero-tn
)
;; Take advantage of V9's 64-bit multiplier. It seems that
;; Note: we can't use the Y register until three insts after it's written.
;; emit-multiply is only used to do an unsigned multiply, so
(
inst
nop
)
;; the code only does an unsigned multiply.
(
inst
nop
)
;;
(
dotimes
(
i
32
)
;; Clear out the high bits of the multiplier and
(
inst
mulscc
result-high
multiplicand
))
;; multiplicand. Multiply the two numbers and put the result
(
inst
mulscc
result-high
zero-tn
)
;; in result-high. Copy the low 32-bits to result-low. Then
(
inst
cmp
multiplicand
)
;; shift result-high so the high 32-bits end up in the low
(
inst
b
:ge
label
)
;; 32-bits.
(
inst
nop
)
(
inst
srl
multiplier
multiplier
0
)
(
inst
add
result-high
multiplier
)
(
unless
(
numberp
multiplicand
)
(
emit-label
label
)
(
inst
srl
multiplicand
multiplicand
0
))
(
inst
rdy
result-low
)))
(
inst
mulx
result-high
multiplier
multiplicand
)
(
inst
move
result-low
result-high
)
(
inst
srax
result-high
32
))
((
backend-featurep
:sparc-v8
)
;; V8 has a multiply instruction. Same restrictions as
;; :sparc-v9. This should also work for the V9, but umul and
;; the Y register is deprecated on the V9.
(
inst
umul
result-low
multiplier
multiplicand
)
(
inst
rdy
result-high
))
(
t
(
let
((
label
(
gen-label
)))
(
inst
wry
multiplier
)
(
inst
andcc
result-high
zero-tn
)
;; Note: we can't use the Y register until three insts
;; after it's written.
(
inst
nop
)
(
inst
nop
)
(
dotimes
(
i
32
)
(
inst
mulscc
result-high
multiplicand
))
(
inst
mulscc
result-high
zero-tn
)
(
inst
cmp
multiplicand
)
(
inst
b
:ge
label
)
(
inst
nop
)
(
inst
add
result-high
multiplier
)
(
emit-label
label
)
(
inst
rdy
result-low
)))))
(
define-vop
(
bignum-mult-and-add-3-arg
)
(
define-vop
(
bignum-mult-and-add-3-arg
)
(
:translate
bignum::%multiply-and-add
)
(
:translate
bignum::%multiply-and-add
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment