X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86%2Ffloat.lisp;h=183f97945ad98d8e00554a0dd6d39ded6a0e699d;hb=d25e3478acccec70402ff32554669a982be8e281;hp=fd69f80bf361db7d5bce6e5e413c4fa3403816d9;hpb=2e28fe9a277201b4b96f052794b8eeaaccf9aa95;p=sbcl.git diff --git a/src/compiler/x86/float.lisp b/src/compiler/x86/float.lisp index fd69f80..183f979 100644 --- a/src/compiler/x86/float.lisp +++ b/src/compiler/x86/float.lisp @@ -189,18 +189,23 @@ ((fp-constant) (single-reg double-reg #!+long-float long-reg)) (let ((value (sb!c::constant-value (sb!c::tn-leaf x)))) (with-empty-tn@fp-top(y) - (cond ((zerop value) + (cond ((or (eql value 0f0) (eql value 0d0) #!+long-float (eql value 0l0)) (inst fldz)) ((= value 1e0) (inst fld1)) + #!+long-float ((= value (coerce pi *read-default-float-format*)) (inst fldpi)) + #!+long-float ((= value (log 10e0 2e0)) (inst fldl2t)) + #!+long-float ((= value (log 2.718281828459045235360287471352662e0 2e0)) (inst fldl2e)) + #!+long-float ((= value (log 2e0 10e0)) (inst fldlg2)) + #!+long-float ((= value (log 2e0 2.718281828459045235360287471352662e0)) (inst fldln2)) (t (warn "ignoring bogus i387 constant ~A" value)))))) @@ -1182,8 +1187,7 @@ (define-vop (=/float) (:args (x) (y)) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p) + (:conditional :e) (:policy :fast-safe) (:vop-var vop) (:save-p :compute-only) @@ -1210,8 +1214,7 @@ (inst fxch x))) (inst fnstsw) ; status word to ax (inst and ah-tn #x45) ; C3 C2 C0 - (inst cmp ah-tn #x40) - (inst jmp (if not-p :ne :e) target))) + (inst cmp ah-tn #x40))) (define-vop (=/single-float =/float) (:translate =) @@ -1239,8 +1242,7 @@ (:arg-types single-float single-float) (:temporary (:sc single-reg :offset fr0-offset :from :eval) fr0) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p) + (:conditional :e) (:policy :fast-safe) (:note "inline float comparison") (:ignore temp) @@ -1280,8 +1282,7 @@ (inst fcom (ea-for-sf-desc y))))) (inst fnstsw) ; status word to ax (inst and ah-tn #x45) ; C3 C2 C0 - (inst cmp ah-tn #x01))) - (inst jmp (if not-p :ne :e) target))) + (inst cmp ah-tn #x01))))) (define-vop (single-float) (:translate >) @@ -1376,8 +1374,7 @@ (:arg-types single-float single-float) (:temporary (:sc single-reg :offset fr0-offset :from :eval) fr0) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p) + (:conditional :e) (:policy :fast-safe) (:note "inline float comparison") (:ignore temp) @@ -1417,8 +1414,7 @@ (inst fcom (ea-for-sf-stack y)) (inst fcom (ea-for-sf-desc y))))) (inst fnstsw) ; status word to ax - (inst and ah-tn #x45))) - (inst jmp (if not-p :ne :e) target))) + (inst and ah-tn #x45))))) (define-vop (>double-float) (:translate >) @@ -1427,8 +1423,7 @@ (:arg-types double-float double-float) (:temporary (:sc double-reg :offset fr0-offset :from :eval) fr0) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p) + (:conditional :e) (:policy :fast-safe) (:note "inline float comparison") (:ignore temp) @@ -1468,8 +1463,7 @@ (inst fcomd (ea-for-df-stack y)) (inst fcomd (ea-for-df-desc y))))) (inst fnstsw) ; status word to ax - (inst and ah-tn #x45))) - (inst jmp (if not-p :ne :e) target))) + (inst and ah-tn #x45))))) #!+long-float (define-vop (>long-float) @@ -1478,8 +1472,7 @@ (y :scs (long-reg))) (:arg-types long-float long-float) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p) + (:conditional :e) (:policy :fast-safe) (:note "inline float comparison") (:ignore temp) @@ -1503,16 +1496,15 @@ (inst fcomd y) (inst fxch x) (inst fnstsw) ; status word to ax - (inst and ah-tn #x45))) - (inst jmp (if not-p :ne :e) target))) + (inst and ah-tn #x45))))) ;;; Comparisons with 0 can use the FTST instruction. (define-vop (float-test) (:args (x)) (:temporary (:sc word-reg :offset eax-offset :from :eval) temp) - (:conditional) - (:info target not-p y) + (:conditional :e) + (:info y) (:variant-vars code) (:policy :fast-safe) (:vop-var vop) @@ -1533,8 +1525,7 @@ (inst fnstsw) ; status word to ax (inst and ah-tn #x45) ; C3 C2 C0 (unless (zerop code) - (inst cmp ah-tn code)) - (inst jmp (if not-p :ne :e) target))) + (inst cmp ah-tn code)))) (define-vop (=0/single-float float-test) (:translate =)