From e220506c64e8eeaa73f0a17db559970aa197206d Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Tue, 16 Jun 2009 02:53:07 +0000 Subject: [PATCH] compiler/x86/float-sse2.lisp: o Add vop for conjugate of complex single and double floats. compiler/float-tran.lisp: o Disable deftransform for conjugate. All platforms with complex fp vops support conjugate. --- compiler/float-tran.lisp | 4 ++-- compiler/x86/float-sse2.lisp | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/compiler/float-tran.lisp b/compiler/float-tran.lisp index 6cb9ae3ab..20067878b 100644 --- a/compiler/float-tran.lisp +++ b/compiler/float-tran.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.131 2009/06/15 18:03:25 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.132 2009/06/16 02:53:07 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1523,7 +1523,7 @@ ;; These are functions for which we probably wouldn't want to ;; write vops for. `(progn - #-(and complex-fp-vops sparc) + #-complex-fp-vops (deftransform conjugate ((z) ((complex ,type)) *) ;; Conjugate of complex number '(complex (realpart z) (- (imagpart z)))) diff --git a/compiler/x86/float-sse2.lisp b/compiler/x86/float-sse2.lisp index 52a353a10..ce63e4f44 100644 --- a/compiler/x86/float-sse2.lisp +++ b/compiler/x86/float-sse2.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/float-sse2.lisp,v 1.7 2009/06/15 01:13:13 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/float-sse2.lisp,v 1.8 2009/06/16 02:53:07 rtoy Rel $") ;;; ;;; ********************************************************************** ;;; @@ -2157,3 +2157,37 @@ (inst xorps t1 t1) ; t1 = 0|0|0|0 (inst movaps r t2) (inst movlhps r t1))) + +;; Conjugate +(define-vop (conjugate/complex-double-float) + (:translate conjugate) + (:args (z :scs (complex-double-reg))) + (:arg-types complex-double-float) + (:results (r :scs (complex-double-reg))) + (:result-types complex-double-float) + (:policy :fast-safe) + (:temporary (:scs (complex-double-reg)) ztmp) + (:temporary (:scs (unsigned-reg)) tmp) + (:generator 2 + (inst mov tmp #x80000000) + (inst movd ztmp tmp) + (inst psllq ztmp 32) ; ztmp = 0|#x80000000,00000000 + (inst shufpd ztmp ztmp 1) ; ztmp = #x80000000,00000000|0 + (inst xorpd ztmp z) ; ztmp = -xi|xi + (inst movapd r ztmp))) + +(define-vop (conjugate/complex-single-float) + (:translate conjugate) + (:args (z :scs (complex-single-reg))) + (:arg-types complex-single-float) + (:results (r :scs (complex-single-reg))) + (:result-types complex-single-float) + (:policy :fast-safe) + (:temporary (:scs (complex-single-reg)) ztmp) + (:temporary (:scs (unsigned-reg)) tmp) + (:generator 2 + (inst mov tmp #x80000000) + (inst movd ztmp tmp) + (inst psllq ztmp 32) ; ztmp = #x80000000|0 + (inst xorps ztmp z) ; ztmp = -xi|xr + (inst movaps r ztmp))) -- GitLab