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
26419b3c
Commit
26419b3c
authored
13 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Add comments, clean up code a little.
parent
bd6f5eac
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/contrib/packed-sse2/packed-sse2.lisp
+30
-17
30 additions, 17 deletions
src/contrib/packed-sse2/packed-sse2.lisp
with
30 additions
and
17 deletions
src/contrib/packed-sse2/packed-sse2.lisp
+
30
−
17
View file @
26419b3c
...
@@ -9,7 +9,11 @@
...
@@ -9,7 +9,11 @@
;; SSE2 Packed operations.
;; SSE2 Packed operations.
;;
;;
;; We use (complex double-float) variables to hold the packed values.
;; We use (complex double-float) variables to hold the packed values,
;; including packed doubles and packed singles. For convenience, use
;; sse2-setpd or sse2-setps to initialize the packed variables with
;; the given scalar values. To extract the individual components of
;; the packed values, use sse2-getpd or sse2-getps.
(
in-package
#:vm
)
(
in-package
#:vm
)
...
@@ -128,47 +132,51 @@
...
@@ -128,47 +132,51 @@
(
declaim
(
inline
sse2-shufpd
sse2-shufps
))
(
declaim
(
inline
sse2-shufpd
sse2-shufps
))
(
defun
sse2-shufpd
(
x
y
i
)
;; This needs better documentation. I (rtoy) can never remember what
;; the magic I values actually do.
(
defun
sse2-shufpd
(
dst
src
i
)
"Shuffle packed doubles in X and Y according to I."
"Shuffle packed doubles in X and Y according to I."
(
declare
(
type
(
complex
double-float
)
x
y
)
(
declare
(
type
(
complex
double-float
)
dst
src
)
(
type
(
unsigned-byte
2
)
i
))
(
type
(
unsigned-byte
2
)
i
))
(
ecase
i
(
ecase
i
(
0
(
0
(
%sse2-shufpd
x
y
0
))
(
%sse2-shufpd
dst
src
0
))
(
1
(
1
(
%sse2-shufpd
x
y
1
))
(
%sse2-shufpd
dst
src
1
))
(
2
(
2
(
%sse2-shufpd
x
y
2
))
(
%sse2-shufpd
dst
src
2
))
(
3
(
3
(
%sse2-shufpd
x
y
3
))))
(
%sse2-shufpd
dst
src
3
))))
(
defun
sse2-shufps
(
x
y
i
)
(
defun
sse2-shufps
(
dst
src
i
)
"Shuffle packed singles in X and Y according to I."
"Shuffle packed singles in X and Y according to I."
(
declare
(
type
(
complex
double-float
)
x
y
)
(
declare
(
type
(
complex
double-float
)
dst
src
)
(
type
(
unsigned-byte
4
)
i
))
(
type
(
unsigned-byte
4
)
i
))
(
ecase
i
(
ecase
i
(
0
(
0
(
%sse2-shufps
x
y
0
))
(
%sse2-shufps
dst
src
0
))
(
1
(
1
(
%sse2-shufps
x
y
1
))
(
%sse2-shufps
dst
src
1
))
(
2
(
2
(
%sse2-shufps
x
y
2
))
(
%sse2-shufps
dst
src
2
))
(
3
(
3
(
%sse2-shufps
x
y
3
))
(
%sse2-shufps
dst
src
3
))
(
4
(
4
(
%sse2-shufps
x
y
4
))
(
%sse2-shufps
dst
src
4
))
(
5
(
5
(
%sse2-shufps
x
y
5
))
(
%sse2-shufps
dst
src
5
))
(
6
(
6
(
%sse2-shufps
x
y
6
))
(
%sse2-shufps
dst
src
6
))
(
7
(
7
(
%sse2-shufps
x
y
7
))))
(
%sse2-shufps
dst
src
7
))))
;; x is the high part and y is the low part.
;; x is the high part and y is the low part.
(
declaim
(
inline
sse2-setpd
sse2-getpd
sse2-setps
sse2-getps
))
(
declaim
(
inline
sse2-setpd
sse2-getpd
sse2-setps
sse2-getps
))
(
defun
sse2-setpd
(
x
y
)
(
defun
sse2-setpd
(
x
y
)
"Create a packed double with X in the high part and Y in the low part"
"Create a packed double with X in the high part and Y in the low part"
(
declare
(
type
double-float
x
y
))
(
declare
(
type
double-float
x
y
))
;; Complex double-floats store the real part in the low half of the
;; sse2 register.
(
complex
y
x
))
(
complex
y
x
))
(
defun
sse2-getpd
(
pd
)
(
defun
sse2-getpd
(
pd
)
...
@@ -185,7 +193,12 @@
...
@@ -185,7 +193,12 @@
(
flet
((
pack-singles-to-double
(
hi
lo
)
(
flet
((
pack-singles-to-double
(
hi
lo
)
(
let
((
hi-bits
(
single-float-bits
hi
))
(
let
((
hi-bits
(
single-float-bits
hi
))
(
lo-bits
(
single-float-bits
lo
)))
(
lo-bits
(
single-float-bits
lo
)))
;; Create a double-float where the most significant 32
;; bits contain the hi float and the low 32-bits contain
;; the low float.
(
make-double-float
hi-bits
(
logand
#xffffffff
lo-bits
)))))
(
make-double-float
hi-bits
(
logand
#xffffffff
lo-bits
)))))
;; Pack the singles into a double and the pack the two doubles
;; into a (complex double-float).
(
sse2-setpd
(
pack-singles-to-double
x3
x2
)
(
sse2-setpd
(
pack-singles-to-double
x3
x2
)
(
pack-singles-to-double
x1
x0
))))
(
pack-singles-to-double
x1
x0
))))
...
...
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