diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp index 69d3426847a29d87c22bf52ed0c7d7059edd8da2..b4b43f75e22e382ad9b58a17c7f900626448fdfb 100644 --- a/src/compiler/x86/arith.lisp +++ b/src/compiler/x86/arith.lisp @@ -900,6 +900,18 @@ (inst and temp #x0000ffff) (inst add result temp))) +(define-vop (sse3-unsigned-byte-32-count) + (:translate logcount) + (:note _N"inline (unsigned-byte 32) logcount") + (:policy :fast-safe) + (:args (arg :scs (unsigned-reg))) + (:arg-types unsigned-num) + (:results (result :scs (unsigned-reg))) + (:result-types positive-fixnum) + (:temporary (:sc unsigned-reg :from (:argument 0)) temp) + (:guard (backend-featurep :sse3)) + (:generator 2 + (inst popcnt result arg))) ;;;; Binary conditional VOPs: diff --git a/src/compiler/x86/insts.lisp b/src/compiler/x86/insts.lisp index b7dad1536abbfdbb05db00d5aa56dd46489ebcf6..e22a0139bce97acee2a78cd1a5445dc031273bcf 100644 --- a/src/compiler/x86/insts.lisp +++ b/src/compiler/x86/insts.lisp @@ -3091,6 +3091,17 @@ :type 'sized-xmmreg/mem) (reg :field (byte 3 27) :type 'reg)) +;;; Like ext-reg-xmm/mem, but both are registers +(disassem:define-instruction-format (ext-reg-reg/mem 32 + :default-printer + '(:name :tab reg ", " reg/mem)) + (prefix :field (byte 8 0)) + (x0f :field (byte 8 8) :value #x0f) + (op :field (byte 8 16)) + (reg/mem :fields (list (byte 2 30) (byte 3 24)) + :type 'reg/mem) + (reg :field (byte 3 27) :type 'reg)) + (disassem:define-instruction-format (ext-xmm-xmm/mem-imm 32 :include 'ext-xmm-xmm/mem @@ -3182,9 +3193,12 @@ ;; dst[63:0] = dst[63:0] ;; dst[127:64] = src[63:0] (define-regular-sse-inst unpcklpd #x66 #x14 t) - (define-regular-sse-inst unpcklps nil #x14 t) + (define-regular-sse-inst unpcklps nil #x14 t)) - ) +(define-instruction popcnt (segment dst src) + (:printer ext-reg-reg/mem + ((prefix #xf3) (op #xb8))) + (:emitter (emit-sse-inst segment dst src #xf3 #xb8))) ;;; MOVSD, MOVSS (macrolet ((define-movsd/ss-sse-inst (name prefix op) diff --git a/src/general-info/release-20d.txt b/src/general-info/release-20d.txt index 5d4bce960337b4b76d7ed705d08ae99c0368d70b..0a5c2246e8c160d1b86a013ad85e1a3ed8635d0d 100644 --- a/src/general-info/release-20d.txt +++ b/src/general-info/release-20d.txt @@ -42,6 +42,7 @@ New in this release: * Updated to Unicode 6.1.0. * Many additional aliases for external formats added that match the glibc iconv aliases. + * Implement faster LOGCOUNT function, if :SSE3 feature is available. * ANSI compliance fixes: * CMUCL was not printing pathnames like (make-pathname :directory