From 57f4d59b8ce082318545f42233f957aae87fd0fe Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 17 Nov 2006 02:04:37 +0000 Subject: [PATCH] PowerPC float>fixnum intrinsic --- TODO.FACTOR.txt | 1 - library/compiler/ppc/architecture.factor | 5 ----- library/compiler/ppc/assembler.factor | 2 +- library/compiler/ppc/intrinsics.factor | 11 +++++++++++ vm/os-macosx-ppc.h | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index b5feb22cf9..b2fec9b7f8 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,7 +1,6 @@ + 0.87: - claim: if module fails to load, reloading it doesn't work? -- intrinsic fixnum>float float>fixnum - fix search unit test - these things are "Too Slow": diff --git a/library/compiler/ppc/architecture.factor b/library/compiler/ppc/architecture.factor index 6035c21c23..279a857839 100644 --- a/library/compiler/ppc/architecture.factor +++ b/library/compiler/ppc/architecture.factor @@ -19,10 +19,6 @@ memory namespaces sequences words ; : stack@ macosx? 24 8 ? + ; : lr@ macosx? 8 4 ? + ; -! Frames are 16-byte aligned, minimum size is 32 bytes -! Grows down -! - lr@: return address - M: int-regs return-reg drop 3 ; M: int-regs fastcall-regs drop { 3 4 5 6 7 8 9 10 } ; M: int-regs vregs drop { 3 4 5 6 7 8 9 10 } ; @@ -31,7 +27,6 @@ M: float-regs return-reg drop 1 ; M: float-regs fastcall-regs drop { 1 2 3 4 5 6 7 8 } ; M: float-regs vregs drop { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; - GENERIC: loc>operand ( loc -- reg n ) M: ds-loc loc>operand ds-loc-n cells neg 14 swap ; diff --git a/library/compiler/ppc/assembler.factor b/library/compiler/ppc/assembler.factor index d7c0163a95..6dc9ca4e80 100644 --- a/library/compiler/ppc/assembler.factor +++ b/library/compiler/ppc/assembler.factor @@ -206,7 +206,7 @@ M: label BC >r 0 BC r> rel-relative-2 rel-label ; : (FMR) >r 0 -rot 72 r> x-form 63 insn ; : FMR 0 (FMR) ; : FMR. 1 (FMR) ; -: (FCTIWZ) >r 0 -rot 15 r> x-form 63 insn ; +: (FCTIWZ) >r 0 -rot r> 15 x-form 63 insn ; : FCTIWZ 0 (FCTIWZ) ; : FCTIWZ. 1 (FCTIWZ) ; : (FADD) >r 0 21 r> a-form 63 insn ; diff --git a/library/compiler/ppc/intrinsics.factor b/library/compiler/ppc/intrinsics.factor index a6384b3c69..cbea020fbf 100644 --- a/library/compiler/ppc/intrinsics.factor +++ b/library/compiler/ppc/intrinsics.factor @@ -292,6 +292,17 @@ math-internals namespaces sequences words ; first2 define-float-jump ] each +\ float>fixnum [ + "scratch" operand "in" operand FCTIWZ + "scratch" operand 1 0 stack@ STFD + "out" operand 1 cell stack@ LWZ + "out" operand dup %tag-fixnum +] H{ + { +input+ { { float "in" } } } + { +scratch+ { { float "scratch" } { f "out" } } } + { +output+ { "out" } } +} define-intrinsic + \ tag [ "in" operand "out" operand tag-mask ANDI "out" operand dup %tag-fixnum diff --git a/vm/os-macosx-ppc.h b/vm/os-macosx-ppc.h index fc6b2dc7c4..36706ba8ce 100644 --- a/vm/os-macosx-ppc.h +++ b/vm/os-macosx-ppc.h @@ -1,7 +1,8 @@ typedef struct _F_STACK_FRAME { struct _F_STACK_FRAME *previous; - CELL padding; + CELL padding1; CELL *return_address; + CELL padding2; } F_STACK_FRAME; #define SIGSEGV_EXC_STATE_TYPE ppc_exception_state_t