From d7dabe5659e96c967d5c4fe3d2e3bb631ae70a8b Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Sat, 15 Oct 2005 19:40:32 +0000 Subject: [PATCH] 0.9.5.70: Fix AVER on x86-64 when both the first argument and result of a MAKE-COMPLEX-FOO-FLOAT VOP occupy the same stack slot. Patch by Lutz Euler (sbcl-devel "Bug with complex float temporaries on x86-64 and fix" on 2005-10-15). --- src/compiler/x86-64/float.lisp | 6 ++++-- tests/float.pure.lisp | 23 +++++++++++++++++++++++ version.lisp-expr | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/compiler/x86-64/float.lisp b/src/compiler/x86-64/float.lisp index 728079d..9f97d65 100644 --- a/src/compiler/x86-64/float.lisp +++ b/src/compiler/x86-64/float.lisp @@ -786,7 +786,8 @@ (unless (location= imag r-imag) (inst movss r-imag imag)))) (complex-single-stack - (inst movss (ea-for-csf-real-stack r) real) + (unless (location= real r) + (inst movss (ea-for-csf-real-stack r) real)) (inst movss (ea-for-csf-imag-stack r) imag))))) (define-vop (make-complex-double-float) @@ -810,7 +811,8 @@ (unless (location= imag r-imag) (inst movsd r-imag imag)))) (complex-double-stack - (inst movsd (ea-for-cdf-real-stack r) real) + (unless (location= real r) + (inst movsd (ea-for-cdf-real-stack r) real)) (inst movsd (ea-for-cdf-imag-stack r) imag))))) (define-vop (complex-float-value) diff --git a/tests/float.pure.lisp b/tests/float.pure.lisp index 25c9926..e6c574b 100644 --- a/tests/float.pure.lisp +++ b/tests/float.pure.lisp @@ -127,3 +127,26 @@ (loop repeat 2 summing most-positive-double-float) (sleep 2)))) 'floating-point-overflow))) + +;;; On x86-64 generating complex floats on the stack failed an aver in +;;; the compiler if the stack slot was the same as the one containing +;;; the real part of the complex. The following expression was able to +;;; trigger this in 0.9.5.62. +(with-test (:name :complex-float-stack) + (dolist (type '((complex double-float) + (complex single-float))) + (compile nil + `(lambda (x0 x1 x2 x3 x4 x5 x6 x7) + (declare (type ,type x0 x1 x2 x3 x4 x5 x6 x7)) + (let ((x0 (+ x0 x0)) + (x1 (+ x1 x1)) + (x2 (+ x2 x2)) + (x3 (+ x3 x3)) + (x4 (+ x4 x4)) + (x5 (+ x5 x5)) + (x6 (+ x6 x6)) + (x7 (+ x7 x7))) + (* (+ x0 x1 x2 x3) (+ x4 x5 x6 x7) + (+ x0 x2 x4 x6) (+ x1 x3 x5 x7) + (+ x0 x3 x4 x7) (+ x1 x2 x5 x6) + (+ x0 x1 x6 x7) (+ x2 x3 x4 x5))))))) diff --git a/version.lisp-expr b/version.lisp-expr index 0fbbf51..6330f73 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.5.69" +"0.9.5.70" -- 1.7.10.4