2009-08-08 01:24:46 -04:00
|
|
|
! Copyright (C) 2008, 2009 Slava Pestov.
|
2008-10-20 21:40:15 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-10-22 00:17:32 -04:00
|
|
|
USING: kernel compiler.cfg.stacks compiler.cfg.hats
|
2008-10-22 19:38:30 -04:00
|
|
|
compiler.cfg.instructions compiler.cfg.utilities ;
|
2008-10-20 21:40:15 -04:00
|
|
|
IN: compiler.cfg.intrinsics.float
|
|
|
|
|
|
|
|
: emit-float-op ( insn -- )
|
2009-08-08 01:24:46 -04:00
|
|
|
[ 2inputs ] dip call ds-push ; inline
|
2008-10-20 21:40:15 -04:00
|
|
|
|
2009-09-12 23:20:13 -04:00
|
|
|
: emit-float-ordered-comparison ( cc -- )
|
|
|
|
[ 2inputs ] dip ^^compare-float-ordered ds-push ; inline
|
|
|
|
|
|
|
|
: emit-float-unordered-comparison ( cc -- )
|
2009-09-08 18:04:26 -04:00
|
|
|
[ 2inputs ] dip ^^compare-float-unordered ds-push ; inline
|
2008-10-20 21:40:15 -04:00
|
|
|
|
|
|
|
: emit-float>fixnum ( -- )
|
2009-08-08 01:24:46 -04:00
|
|
|
ds-pop ^^float>integer ^^tag-fixnum ds-push ;
|
2008-10-20 21:40:15 -04:00
|
|
|
|
|
|
|
: emit-fixnum>float ( -- )
|
2009-08-08 01:24:46 -04:00
|
|
|
ds-pop ^^untag-fixnum ^^integer>float ds-push ;
|
2009-08-26 00:22:15 -04:00
|
|
|
|
|
|
|
: emit-fsqrt ( -- )
|
|
|
|
ds-pop ^^sqrt ds-push ;
|
2009-08-30 05:52:01 -04:00
|
|
|
|
|
|
|
: emit-unary-float-function ( func -- )
|
|
|
|
[ ds-pop ] dip ^^unary-float-function ds-push ;
|
|
|
|
|
|
|
|
: emit-binary-float-function ( func -- )
|
|
|
|
[ 2inputs ] dip ^^binary-float-function ds-push ;
|