Comment 1 for bug 555201

Revision history for this message
Paul Khuong (pvk) wrote :

I think this addresses most of my complaints about single-float-bits on x86-64.

(define-vop (single-float-bits)
  (:args (float :scs (single-reg descriptor-reg)
                :load-if (not (sc-is float single-stack))))
  (:results (bits :scs (signed-reg any-reg)))
  (:arg-types single-float)
  (:result-types signed-num)
  (:translate single-float-bits)
  (:policy :fast-safe)
  (:vop-var vop)
  (:generator 4
    (sc-case float
      (single-reg
       (inst movd bits float)
       (inst movsxd bits (reg-in-size bits :dword))
       (when (sc-is bits any-reg)
         (inst shl bits n-fixnum-tag-bits)))
      (single-stack
       (inst movsxd bits (make-ea :dword ; c.f. ea-for-sf-stack
                                  :base rbp-tn
                                  :disp (frame-byte-offset (tn-offset float))))
       (when (sc-is bits any-reg)
         (inst shl bits n-fixnum-tag-bits)))
      (descriptor-reg
       (move bits float)
       (cond ((sc-is bits any-reg)
              (inst sar bits (- 32 n-fixnum-tag-bits))
              (inst and bits (lognot fixnum-tag-mask)))
             (t
              (inst sar bits 32)))))))