Raymond Toy pushed to branch issue-249-replace-lea-in-arith at cmucl / cmucl
Commits:
4367609e by Raymond Toy at 2023-08-12T18:56:55-07:00
Remove commented out code that used lea
- - - - -
1 changed file:
- src/compiler/x86/arith.lisp
Changes:
=====================================
src/compiler/x86/arith.lisp
=====================================
@@ -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)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4367609e79b7cb5d6fa6f9a…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4367609e79b7cb5d6fa6f9a…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
33f11724 by Raymond Toy at 2023-08-12T07:34:55-07:00
Replace latin-1 character Latin_Small_Letter_I_With_Diaeresis
In files/math.lisp, the word "naive" is spelled using the character
\Latin_Small_Letter_I_With_Diaeresis. However, when compiling locally
with a UTF-8 encoding (which is the default), this is invalid. The
letter needs to be encoded as 2 octets. I'm too lazy to figure out
how to get emacs to insert the correct encoded character so I'm
replacing it with a simple "i". This makes the file pure ASCII, so it
should work fine with a UTF-8 encoding.
- - - - -
1 changed file:
- benchmarks/cl-bench/files/math.lisp
Changes:
=====================================
benchmarks/cl-bench/files/math.lisp
=====================================
@@ -1,6 +1,6 @@
;;; math.lisp -- various numerical operations
;;
-;; Time-stamp: <2004-01-05 emarsden>
+;; Time-stamp: <2023-08-12 07:34:28 toy>
;;
;; some basic mathematical benchmarks
@@ -56,7 +56,7 @@
;; calculate the "level" of a point in the Mandebrot Set, which is the
;; number of iterations taken to escape to "infinity" (points that
;; don't escape are included in the Mandelbrot Set). This version is
-;; intended to test performance when programming in naïve math-style.
+;; intended to test performance when programming in naive math-style.
(defun mset-level/complex (c)
(declare (type complex c))
(loop :for z = #c(0 0) :then (+ (* z z) c)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/33f117246e2a9315b33bc09…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/33f117246e2a9315b33bc09…
You're receiving this email because of your account on gitlab.common-lisp.net.