From 35773daad49eda05b904abdadb0b98e0cc5e1c60 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 18 Dec 2009 17:38:32 +0000 Subject: [PATCH] FSQRT machine instruction is optional on PPC svn: r17351 --- src/mzscheme/src/numarith.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mzscheme/src/numarith.c b/src/mzscheme/src/numarith.c index 572db76c42..085a4d3b19 100644 --- a/src/mzscheme/src/numarith.c +++ b/src/mzscheme/src/numarith.c @@ -58,6 +58,12 @@ static Scheme_Object *unsafe_fl_sqrt (int argc, Scheme_Object *argv[]); #define zeroi scheme_exact_zero +#if defined(__POWERPC__) || defined(powerpc) +# define SQRT_MACHINE_CODE_AVAILABLE 0 +#else +# define SQRT_MACHINE_CODE_AVAILABLE 1 +#endif + void scheme_init_numarith(Scheme_Env *env) { Scheme_Object *p; @@ -146,7 +152,7 @@ void scheme_init_flonum_numarith(Scheme_Env *env) scheme_add_global_constant("flabs", p, env); p = scheme_make_folding_prim(fl_sqrt, "flsqrt", 1, 1, 1); - if (scheme_can_inline_fp_op()) + if (scheme_can_inline_fp_op() && SQRT_MACHINE_CODE_AVAILABLE) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; scheme_add_global_constant("flsqrt", p, env); } @@ -218,7 +224,7 @@ void scheme_init_unsafe_numarith(Scheme_Env *env) scheme_add_global_constant("unsafe-flabs", p, env); p = scheme_make_folding_prim(unsafe_fl_sqrt, "unsafe-flsqrt", 1, 1, 1); - if (scheme_can_inline_fp_op()) + if (scheme_can_inline_fp_op() && SQRT_MACHINE_CODE_AVAILABLE) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL; scheme_add_global_constant("unsafe-flsqrt", p, env);