mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 15:40:19 +02:00
Add support for optimized unboxed abs and sqrt
Some components of this have been wired up for a while; this commit finishes the compiler, runtime, and JIT support. * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): * libguile/intrinsics.c (scm_bootstrap_intrinsics): Declare the new intrinsics. * libguile/jit.c (compile_call_f64_from_f64): Define code generators for the new intrinsics. * libguile/vm-engine.c (call-f64<-f64): New instruction. * module/language/cps/effects-analysis.scm: * module/language/cps/reify-primitives.scm (compute-known-primitives): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/specialize-numbers.scm (specialize-operations): * module/language/tree-il/cps-primitives.scm (abs): * module/system/vm/assembler.scm (system, define-f64<-f64-intrinsic): (sqrt, abs, fsqrt, fabs): * module/language/cps/types.scm (fsqrt, fabs): Add new f64<-f64 primitives.
This commit is contained in:
parent
ef1869b723
commit
382cc5c246
11 changed files with 101 additions and 5 deletions
|
@ -3242,7 +3242,25 @@ VM_NAME (scm_thread *thread)
|
|||
NEXT (1);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (155, unused_155, NULL, NOP)
|
||||
/* call-f64<-f64 dst:12 src:12 IDX:32
|
||||
*
|
||||
* Call the double-returning instrinsic with index IDX, passing SCM
|
||||
* local SRC as argument. Place the double result in DST.
|
||||
*/
|
||||
VM_DEFINE_OP (155, call_f64_from_f64, "call-f64<-f64", DOP2 (X8_S12_S12, C32))
|
||||
{
|
||||
uint16_t dst, src;
|
||||
scm_t_f64_from_f64_intrinsic intrinsic;
|
||||
|
||||
UNPACK_12_12 (op, dst, src);
|
||||
intrinsic = intrinsics[ip[1]];
|
||||
|
||||
/* We assume these instructions can't throw an exception. */
|
||||
SP_SET_F64 (dst, intrinsic (SP_REF_F64 (src)));
|
||||
|
||||
NEXT (2);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (156, unused_156, NULL, NOP)
|
||||
VM_DEFINE_OP (157, unused_157, NULL, NOP)
|
||||
VM_DEFINE_OP (158, unused_158, NULL, NOP)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue