math.libm: fix regression: fsqrt intrinsic was not working ever since change was made to inline FUNCTION: bodies
parent
0c5a0ee058
commit
42b858b3f0
|
@ -161,13 +161,6 @@ IN: compiler.cfg.builder.tests
|
||||||
{ pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-builder
|
{ pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-builder
|
||||||
] each
|
] each
|
||||||
|
|
||||||
: count-insns ( quot insn-check -- ? )
|
|
||||||
[ test-regs [ post-order [ instructions>> ] map concat ] map concat ] dip
|
|
||||||
count ; inline
|
|
||||||
|
|
||||||
: contains-insn? ( quot insn-check -- ? )
|
|
||||||
count-insns 0 > ; inline
|
|
||||||
|
|
||||||
[ t ] [ [ swap ] [ ##replace? ] contains-insn? ] unit-test
|
[ t ] [ [ swap ] [ ##replace? ] contains-insn? ] unit-test
|
||||||
|
|
||||||
[ f ] [ [ swap swap ] [ ##replace? ] contains-insn? ] unit-test
|
[ f ] [ [ swap swap ] [ ##replace? ] contains-insn? ] unit-test
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008, 2010 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel words sequences quotations namespaces io vectors
|
USING: kernel words sequences quotations namespaces io vectors
|
||||||
arrays hashtables classes.tuple accessors prettyprint
|
arrays hashtables classes.tuple math accessors prettyprint
|
||||||
prettyprint.config assocs prettyprint.backend prettyprint.custom
|
prettyprint.config assocs prettyprint.backend prettyprint.custom
|
||||||
prettyprint.sections parser compiler.tree.builder
|
prettyprint.sections parser compiler.tree.builder
|
||||||
compiler.tree.optimizer cpu.architecture compiler.cfg.builder
|
compiler.tree.optimizer cpu.architecture compiler.cfg.builder
|
||||||
|
@ -125,3 +125,10 @@ M: rs-loc pprint* \ R pprint-loc ;
|
||||||
bi append
|
bi append
|
||||||
] map concat
|
] map concat
|
||||||
] map concat >hashtable representations set ;
|
] map concat >hashtable representations set ;
|
||||||
|
|
||||||
|
: count-insns ( quot insn-check -- ? )
|
||||||
|
[ test-regs [ post-order [ instructions>> ] map concat ] map concat ] dip
|
||||||
|
count ; inline
|
||||||
|
|
||||||
|
: contains-insn? ( quot insn-check -- ? )
|
||||||
|
count-insns 0 > ; inline
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
IN: cpu.x86.tests
|
||||||
|
USING: cpu.x86.features tools.test math.libm kernel.private math
|
||||||
|
compiler.cfg.instructions compiler.cfg.debugger kernel ;
|
||||||
|
|
||||||
|
[ ] [
|
||||||
|
[ { float } declare fsqrt ]
|
||||||
|
[ ##sqrt? ] contains-insn?
|
||||||
|
sse2?
|
||||||
|
assert=
|
||||||
|
] unit-test
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2006 Slava Pestov.
|
! Copyright (C) 2006, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types alien.syntax ;
|
USING: alien alien.c-types alien.syntax kernel words accessors ;
|
||||||
IN: math.libm
|
IN: math.libm
|
||||||
|
|
||||||
LIBRARY: libm
|
LIBRARY: libm
|
||||||
|
@ -50,6 +50,18 @@ FUNCTION-ALIAS: fpow
|
||||||
FUNCTION-ALIAS: fsqrt
|
FUNCTION-ALIAS: fsqrt
|
||||||
double sqrt ( double x ) ;
|
double sqrt ( double x ) ;
|
||||||
|
|
||||||
|
! fsqrt has an intrinsic so we don't actually want to inline it
|
||||||
|
! unconditionally
|
||||||
|
<<
|
||||||
|
\ fsqrt f "inline" set-word-prop
|
||||||
|
|
||||||
|
\ fsqrt [
|
||||||
|
drop
|
||||||
|
\ fsqrt "intrinsic" word-prop
|
||||||
|
f \ fsqrt def>> ?
|
||||||
|
] "custom-inlining" set-word-prop
|
||||||
|
>>
|
||||||
|
|
||||||
! Windows doesn't have these...
|
! Windows doesn't have these...
|
||||||
FUNCTION-ALIAS: flog1+
|
FUNCTION-ALIAS: flog1+
|
||||||
double log1p ( double x ) ;
|
double log1p ( double x ) ;
|
||||||
|
|
Loading…
Reference in New Issue