mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
Unbox floor/ceiling and trigonometric functions where possible
* libguile/intrinsics.c (scm_atan1): New intrinsic, wrapping scm_atan. (scm_bootstrap_intrinsics): Add new intrinsics. * libguile/intrinsics.h (scm_t_f64_from_f64_f64_intrinsic): New intrinsic type. (SCM_FOR_ALL_VM_INTRINSICS): Add intrinsics for floor, ceiling, sin, cos, tan, asin, acos, atan, and their unboxed counterparts. * libguile/jit.c (sp_f64_operand): New helper. (compile_call_f64_from_f64, compile_call_f64_from_f64_f64): Call out to intrinsics. * libguile/vm-engine.c (call-f64<-f64-f64): New opcode. * module/language/cps/effects-analysis.scm: Add new intrinsics. * module/language/cps/reify-primitives.scm (compute-known-primitives): Add new intrinsics. * module/language/cps/slot-allocation.scm (compute-var-representations): Add 'f64 slot types for the new unboxed intrinsics. * module/language/cps/specialize-numbers.scm (specialize-operations): Support unboxing the new intrinsics. * module/language/cps/types.scm: Define type inferrers for the new intrinsics. * module/language/tree-il/cps-primitives.scm: Define CPS translations for the new intrinsics. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*, atan): Define primitive resolvers. * module/system/vm/assembler.scm: Export assemblers for the new intrinsics. (define-f64<-f64-f64-intrinsic): New helper.
This commit is contained in:
parent
9e3a5c9a10
commit
b1564df298
12 changed files with 278 additions and 10 deletions
|
@ -3261,7 +3261,25 @@ VM_NAME (scm_thread *thread)
|
|||
NEXT (2);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (156, unused_156, NULL, NOP)
|
||||
/* call-f64<-f64-f64 dst:8 a:8 b:8 IDX:32
|
||||
*
|
||||
* Call the double-returning instrinsic with index IDX, passing SCM
|
||||
* locals A and B as arguments. Place the double result in DST.
|
||||
*/
|
||||
VM_DEFINE_OP (156, call_f64_from_f64_f64, "call-f64<-f64-f64", DOP2 (X8_S8_S8_S8, C32))
|
||||
{
|
||||
uint8_t dst, a, b;
|
||||
scm_t_f64_from_f64_f64_intrinsic intrinsic;
|
||||
|
||||
UNPACK_8_8_8 (op, dst, a, b);
|
||||
intrinsic = intrinsics[ip[1]];
|
||||
|
||||
/* We assume these instructions can't throw an exception. */
|
||||
SP_SET_F64 (dst, intrinsic (SP_REF_F64 (a), SP_REF_F64 (b)));
|
||||
|
||||
NEXT (2);
|
||||
}
|
||||
|
||||
VM_DEFINE_OP (157, unused_157, NULL, NOP)
|
||||
VM_DEFINE_OP (158, unused_158, NULL, NOP)
|
||||
VM_DEFINE_OP (159, unused_159, NULL, NOP)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue