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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
cmucl
cmucl
Commits
4367609e
Commit
4367609e
authored
1 year ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Remove commented out code that used lea
parent
a24bfb0c
No related branches found
No related tags found
1 merge request
!163
Fix #249: Replace lea instruction for arithmetic
Pipeline
#8981
passed
1 year ago
Stage: install
Stage: build
Stage: test
Stage: ansi-test
Stage: benchmark
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/compiler/x86/arith.lisp
+53
-124
53 additions, 124 deletions
src/compiler/x86/arith.lisp
with
53 additions
and
124 deletions
src/compiler/x86/arith.lisp
+
53
−
124
View file @
4367609e
...
...
@@ -222,13 +222,8 @@
(
:result-types
tagged-num
)
(
:note
_N
"inline fixnum arithmetic"
)
(
:generator
2
(
cond
#+
nil
((
and
(
sc-is
x
any-reg
)
(
sc-is
y
any-reg
)
(
sc-is
r
any-reg
)
(
not
(
location=
x
r
)))
(
inst
lea
r
(
make-ea
:dword
:base
x
:index
y
:scale
1
)))
(
t
(
move
r
x
)
(
inst
add
r
y
)))))
(
move
r
x
)
(
inst
add
r
y
)))
(
define-vop
(
fast-+-c/fixnum=>fixnum
fast-safe-arith-op
)
(
:translate
+
)
...
...
@@ -240,12 +235,8 @@
(
:result-types
tagged-num
)
(
:note
_N
"inline fixnum arithmetic"
)
(
:generator
1
(
cond
#+
nil
((
and
(
sc-is
x
any-reg
)
(
sc-is
r
any-reg
)
(
not
(
location=
x
r
)))
(
inst
lea
r
(
make-ea
:dword
:base
x
:disp
(
fixnumize
y
))))
(
t
(
move
r
x
)
(
inst
add
r
(
fixnumize
y
))))))
(
move
r
x
)
(
inst
add
r
(
fixnumize
y
))))
(
define-vop
(
fast-+/signed=>signed
fast-safe-arith-op
)
(
:translate
+
)
...
...
@@ -263,13 +254,8 @@
(
:result-types
signed-num
)
(
:note
_N
"inline (signed-byte 32) arithmetic"
)
(
:generator
5
(
cond
#+
nil
((
and
(
sc-is
x
signed-reg
)
(
sc-is
y
signed-reg
)
(
sc-is
r
signed-reg
)
(
not
(
location=
x
r
)))
(
inst
lea
r
(
make-ea
:dword
:base
x
:index
y
:scale
1
)))
(
t
(
move
r
x
)
(
inst
add
r
y
)))))
(
move
r
x
)
(
inst
add
r
y
)))
(
define-vop
(
fast-+-c/signed=>signed
fast-safe-arith-op
)
(
:translate
+
)
...
...
@@ -281,15 +267,10 @@
(
:result-types
signed-num
)
(
:note
_N
"inline (signed-byte 32) arithmetic"
)
(
:generator
4
(
cond
#+
nil
((
and
(
sc-is
x
signed-reg
)
(
sc-is
r
signed-reg
)
(
not
(
location=
x
r
)))
(
inst
lea
r
(
make-ea
:dword
:base
x
:disp
y
)))
(
t
(
move
r
x
)
(
if
(
=
y
1
)
(
inst
inc
r
)
(
inst
add
r
y
))))))
(
move
r
x
)
(
if
(
=
y
1
)
(
inst
inc
r
)
(
inst
add
r
y
))))
(
define-vop
(
fast-+/unsigned=>unsigned
fast-safe-arith-op
)
(
:translate
+
)
...
...
@@ -308,13 +289,8 @@
(
:result-types
unsigned-num
)
(
:note
_N
"inline (unsigned-byte 32) arithmetic"
)
(
:generator
5
(
cond
#+
nil
((
and
(
sc-is
x
unsigned-reg
)
(
sc-is
y
unsigned-reg
)
(
sc-is
r
unsigned-reg
)
(
not
(
location=
x
r
)))
(
inst
lea
r
(
make-ea
:dword
:base
x
:index
y
:scale
1
)))
(
t
(
move
r
x
)
(
inst
add
r
y
)))))
(
move
r
x
)
(
inst
add
r
y
)))
(
define-vop
(
fast-+-c/unsigned=>unsigned
fast-safe-arith-op
)
(
:translate
+
)
...
...
@@ -326,17 +302,10 @@
(
:result-types
unsigned-num
)
(
:note
_N
"inline (unsigned-byte 32) arithmetic"
)
(
:generator
4
(
cond
#+
nil
((
and
(
sc-is
x
unsigned-reg
)
(
sc-is
r
unsigned-reg
)
(
not
(
location=
x
r
))
(
valid-displacement-p
y
))
(
inst
lea
r
(
make-ea
:dword
:base
x
:disp
y
)))
(
t
(
move
r
x
)
(
if
(
=
y
1
)
(
inst
inc
r
)
(
inst
add
r
y
))))))
(
move
r
x
)
(
if
(
=
y
1
)
(
inst
inc
r
)
(
inst
add
r
y
))))
;;;; Special logand cases: (logand signed unsigned) => unsigned
...
...
@@ -647,28 +616,18 @@
(
:result-types
tagged-num
)
(
:note
_N
"inline ASH"
)
(
:generator
2
(
cond
#+
nil
((
and
(
=
amount
1
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
2
)))
#+
nil
((
and
(
=
amount
2
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
4
)))
#+
nil
((
and
(
=
amount
3
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
8
)))
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
(
t
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
(
t
;; If the amount is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
amount
)))
;; Fixnum correction.
(
inst
and
result
#xfffffffc
)))))))
;; If the amount is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
amount
)))
;; Fixnum correction.
(
inst
and
result
#xfffffffc
)))))
(
define-vop
(
fast-ash-left/fixnum=>fixnum
)
(
:translate
ash
)
...
...
@@ -708,25 +667,15 @@
(
:result-types
unsigned-num
)
(
:note
_N
"inline ASH"
)
(
:generator
3
(
cond
#+
nil
((
and
(
=
amount
1
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
2
)))
#+
nil
((
and
(
=
amount
2
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
4
)))
#+
nil
((
and
(
=
amount
3
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
8
)))
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
((
<
amount
-31
)
(
inst
mov
result
0
))
(
t
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
((
<
amount
-31
)
(
inst
mov
result
0
))
(
t
(
inst
shr
result
(
-
amount
))))))))
(
inst
shr
result
(
-
amount
))))))
(
define-vop
(
fast-ash-c/signed=>signed
)
(
:translate
ash
)
...
...
@@ -744,26 +693,16 @@
(
:result-types
signed-num
)
(
:note
_N
"inline ASH"
)
(
:generator
3
(
cond
#+
nil
((
and
(
=
amount
1
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
2
)))
#+
nil
((
and
(
=
amount
2
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
4
)))
#+
nil
((
and
(
=
amount
3
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
8
)))
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
(
t
(
move
result
number
)
(
cond
((
plusp
amount
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
amount
))
(
t
;; If the amount is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
amount
)))))))))
;; If the amount is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
amount
)))))))
(
define-vop
(
fast-ash-c/fixnum=>signed
)
(
:translate
ash
)
...
...
@@ -782,26 +721,16 @@
(
:note
"inline ASH"
)
(
:generator
1
(
let
((
shift
(
-
amount
vm:fixnum-tag-bits
)))
(
cond
#+
nil
((
and
(
=
shift
1
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
2
)))
#+
nil
((
and
(
=
shift
2
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
4
)))
#+
nil
((
and
(
=
shift
3
)
(
not
(
location=
number
result
)))
(
inst
lea
result
(
make-ea
:dword
:index
number
:scale
8
)))
(
move
result
number
)
(
cond
((
plusp
shift
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
shift
))
(
t
(
move
result
number
)
(
cond
((
plusp
shift
)
;; We don't have to worry about overflow because of the
;; result type restriction.
(
inst
shl
result
shift
))
(
t
;; If the shift is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
shift
))))))))))
;; If the shift is greater than 31, only shift by 31. We
;; have to do this because the shift instructions only look
;; at the low five bits of the result.
(
inst
sar
result
(
min
31
(
-
shift
))))))))
(
define-vop
(
fast-ash-left/unsigned=>unsigned
)
(
:translate
ash
)
...
...
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