From 69130ae5463e398ea8d7b967bcce25a91b2751a1 Mon Sep 17 00:00:00 2001 From: Zimri Leisher Date: Wed, 9 Sep 2026 16:12:27 -0400 Subject: [PATCH] Remove the unregistered sleep(F64) macro, whose lowering was missing its multiply Co-Authored-By: Claude Opus 5 (1M context) --- src/fpy/macros.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/fpy/macros.py b/src/fpy/macros.py index a2acd6d..2edfc8b 100644 --- a/src/fpy/macros.py +++ b/src/fpy/macros.py @@ -43,13 +43,9 @@ ) from fpy.bytecode.directives import ( FloatDivideDirective, - FloatSubtractDirective, - FloatToUnsignedIntDirective, FloatAbsDirective, IntAbsDirective, - IntegerTruncate64To32Directive, IntegerZeroExtend32To64Directive, - PeekDirective, PushTimeDirective, PushValDirective, FloatLogDirective, @@ -153,46 +149,6 @@ def generate_sleep_until_llvm(builder, args): ) -def generate_sleep_float( - node: Ast, const_args: dict[int, FpyValue], arg_types: list[FpyType] -) -> list[Directive | Ir]: - # convert F64 to seconds and microseconds - dirs = [ - # first do seconds - # copy the f64 - PushValDirective(FpyValue(StackSizeType, 8).serialize()), - PushValDirective(FpyValue(StackSizeType, 0).serialize()), - PeekDirective(), - # convert to U64 - FloatToUnsignedIntDirective(), - # and then U32 - IntegerTruncate64To32Directive(), - # now we have f64, u32 (seconds) on stack - # now do microseconds - # copy the f64 and u32 - PushValDirective(FpyValue(StackSizeType, 12).serialize()), - PushValDirective(FpyValue(StackSizeType, 0).serialize()), - PeekDirective(), - # turn the u32 into a float - IntegerZeroExtend32To64Directive(), - UnsignedIntToFloatDirective(), - # subtract, this should give us the frac - FloatSubtractDirective(), - # okay now multiply by 1000000 - PushValDirective(FpyValue(F64, 1_000_000.0).serialize()), - # now convert to u32 - FloatToUnsignedIntDirective(), - IntegerTruncate64To32Directive(), - ] - - return dirs - - -MACRO_SLEEP_FLOAT = BuiltinFuncSymbol( - "sleep", NOTHING, [("seconds", F64, None)], generate_sleep_float -) - - def generate_log_signed_int( node: Ast, const_args: dict[int, FpyValue], arg_types: list[FpyType] ) -> list[Directive | Ir]: