Skip to content
Snippets Groups Projects
Commit 4367609e authored by Raymond Toy's avatar Raymond Toy
Browse files

Remove commented out code that used lea

parent a24bfb0c
No related branches found
No related tags found
1 merge request!163Fix #249: Replace lea instruction for arithmetic
Pipeline #8981 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment