Changeset 14847


Ignore:
Timestamp:
Jun 23, 2011, 6:55:42 AM (8 years ago)
Author:
gb
Message:

Coercing a DOUBLE-FLOAT to a SINGLE-FLOAT can overflow; provide
"safe" and "non-safe" versions, where the safe version checks for
that.

Location:
trunk/source/compiler/ARM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/ARM/arm-vinsns.lisp

    r14787 r14847  
    24622462                                    ((arg :double-float)))
    24632463  (fcvtsd result arg))
     2464
     2465(define-arm-vinsn (double-to-single-safe :call :subprim-call)
     2466    (((result :single-float))
     2467     ((arg :double-float))
     2468     ((imm :u32)))
     2469  (fmrx imm fpscr)
     2470  (bic imm imm (:$ #xff))
     2471  (fmxr fpscr imm)
     2472  (fcvtsd result arg)
     2473  (bla .SPcheck-fpu-exception))
    24642474
    24652475(define-arm-vinsn double-to-single (((result :double-float))
  • trunk/source/compiler/ARM/arm2.lisp

    r14834 r14847  
    34953495                         (case dest-mode
    34963496                           (#.hard-reg-class-fpr-mode-single
    3497                             (! double-to-single dest src))
     3497                            (if *arm2-float-safety*
     3498                              (! double-to-single-safe dest src)
     3499                              (! double-to-single dest src)))
    34983500                           (#.hard-reg-class-fpr-mode-double
    34993501                            (! double-to-double dest src))))))))))))))))
     
    84708472                                     :class hard-reg-class-fpr
    84718473                                     :mode hard-reg-class-fpr-mode-double))))
    8472         (! double-to-single vreg dreg)
     8474        (if *arm2-float-safety*
     8475          (! double-to-single-safe vreg dreg)
     8476          (! double-to-single vreg dreg))
    84738477        (^))
    84748478      (with-fp-target () (argreg :double-float)
    84758479        (arm2-one-targeted-reg-form seg arg argreg)
    84768480        (with-fp-target ()  (sreg :single-float)
    8477           (! double-to-single sreg argreg)
     8481          (if *arm2-float-safety*
     8482            (! double-to-single-safe sreg argreg)
     8483            (! double-to-single sreg argreg))
    84788484          (<- sreg)
    84798485          (^))))))
Note: See TracChangeset for help on using the changeset viewer.