X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86%2Farith.lisp;h=4731c2653c1db8ee441442369ee788633bf806ae;hb=a6b91f356da1b5ae2987f79db9bd137970512959;hp=7511b324ea13ab76a4a8cb93d46827ead4212859;hpb=9ad341320db0daccfdc1dc0d68385ed5dade8c66;p=sbcl.git diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp index 7511b32..4731c26 100644 --- a/src/compiler/x86/arith.lisp +++ b/src/compiler/x86/arith.lisp @@ -46,13 +46,13 @@ (define-vop (fast-lognot/fixnum fixnum-unop) (:translate lognot) - (:generator 2 + (:generator 1 (move res x) (inst xor res (fixnumize -1)))) (define-vop (fast-lognot/signed signed-unop) (:translate lognot) - (:generator 1 + (:generator 2 (move res x) (inst not res))) @@ -436,7 +436,7 @@ (:vop-var vop) (:save-p :compute-only) (:generator 31 - (let ((zero (generate-error-code vop division-by-zero-error x y))) + (let ((zero (generate-error-code vop 'division-by-zero-error x y))) (if (sc-is y any-reg) (inst test y y) ; smaller instruction (inst cmp y 0)) @@ -491,7 +491,7 @@ (:vop-var vop) (:save-p :compute-only) (:generator 33 - (let ((zero (generate-error-code vop division-by-zero-error x y))) + (let ((zero (generate-error-code vop 'division-by-zero-error x y))) (if (sc-is y unsigned-reg) (inst test y y) ; smaller instruction (inst cmp y 0)) @@ -542,7 +542,7 @@ (:vop-var vop) (:save-p :compute-only) (:generator 33 - (let ((zero (generate-error-code vop division-by-zero-error x y))) + (let ((zero (generate-error-code vop 'division-by-zero-error x y))) (if (sc-is y signed-reg) (inst test y y) ; smaller instruction (inst cmp y 0)) @@ -923,7 +923,9 @@ (:result-types unsigned-num) (:generator 28 (move res arg) - (inst cmp res 0) + (if (sc-is res unsigned-reg) + (inst test res res) + (inst cmp res 0)) (inst jmp :ge POS) (inst not res) POS @@ -1320,8 +1322,8 @@ (svop30f (intern (format nil "FAST-~S-SMOD30/FIXNUM=>FIXNUM" name))) (svop30cf (intern (format nil "FAST-~S-SMOD30-C/FIXNUM=>FIXNUM" name)))) `(progn - (define-modular-fun ,fun32 (x y) ,name :unsigned 32) - (define-modular-fun ,sfun30 (x y) ,name :signed 30) + (define-modular-fun ,fun32 (x y) ,name :untagged nil 32) + (define-modular-fun ,sfun30 (x y) ,name :tagged t 30) (define-mod-binop (,vop32u ,vopu) ,fun32) (define-vop (,vop32f ,vopf) (:translate ,fun32)) (define-vop (,svop30f ,vopf) (:translate ,sfun30)) @@ -1367,19 +1369,19 @@ (signed-byte 30) (foldable flushable movable)) -(define-modular-fun-optimizer %lea ((base index scale disp) :unsigned :width width) +(define-modular-fun-optimizer %lea ((base index scale disp) :untagged nil :width width) (when (and (<= width 32) (constant-lvar-p scale) (constant-lvar-p disp)) - (cut-to-width base :unsigned width) - (cut-to-width index :unsigned width) + (cut-to-width base :untagged width nil) + (cut-to-width index :untagged width nil) 'sb!vm::%lea-mod32)) -(define-modular-fun-optimizer %lea ((base index scale disp) :signed :width width) +(define-modular-fun-optimizer %lea ((base index scale disp) :tagged t :width width) (when (and (<= width 30) (constant-lvar-p scale) (constant-lvar-p disp)) - (cut-to-width base :signed width) - (cut-to-width index :signed width) + (cut-to-width base :tagged width t) + (cut-to-width index :tagged width t) 'sb!vm::%lea-smod30)) #+sb-xc-host @@ -1413,7 +1415,7 @@ (:translate %lea-smod30)) ;;; logical operations -(define-modular-fun lognot-mod32 (x) lognot :unsigned 32) +(define-modular-fun lognot-mod32 (x) lognot :untagged nil 32) (define-vop (lognot-mod32/word=>unsigned) (:translate lognot-mod32) (:args (x :scs (unsigned-reg signed-reg unsigned-stack signed-stack) :target r @@ -1436,20 +1438,6 @@ (move r x) (inst not r))) -(define-modular-fun logxor-mod32 (x y) logxor :unsigned 32) -(define-mod-binop (fast-logxor-mod32/word=>unsigned - fast-logxor/unsigned=>unsigned) - logxor-mod32) -(define-mod-binop-c (fast-logxor-mod32-c/word=>unsigned - fast-logxor-c/unsigned=>unsigned) - logxor-mod32) -(define-vop (fast-logxor-mod32/fixnum=>fixnum - fast-logxor/fixnum=>fixnum) - (:translate logxor-mod32)) -(define-vop (fast-logxor-mod32-c/fixnum=>fixnum - fast-logxor-c/fixnum=>fixnum) - (:translate logxor-mod32)) - (define-source-transform logeqv (&rest args) (if (oddp (length args)) `(logxor ,@args)