picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 23f009376af2c5f9d7f614767ca853338e0578e5
parent 3e6269b93c65fd1bfa22a5caf5276e03a63bb747
Author: Alexander Burger <abu@software-lab.de>
Date:   Wed, 27 Apr 2011 08:57:21 +0200

Simplified 'fix' conversion
Diffstat:
Msrc64/arch/ppc64.l | 6+++---
Msrc64/arch/x86-64.l | 20++++++++------------
2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/src64/arch/ppc64.l b/src64/arch/ppc64.l @@ -1,4 +1,4 @@ -# 26apr11abu +# 27apr11abu # (c) Software Lab. Alexander Burger # Byte order @@ -1046,7 +1046,7 @@ (prinst "lfs" 1 "0(14)") ) (asm fix () - (prinst "srdi" 0 15 4) # Normalize cale (ignore sign for now) + (prinst "srdi" 0 15 4) # Normalize scale (ignore sign) (prinst "std" 0 "-8(1)") (prinst "lfd" 0 "-8(1)") # Get scale in f13 (prinst "fcfid" 13 0) @@ -1460,7 +1460,7 @@ (label (pack "flt" F)) (unless (= 8 F) (prinst "addi" 11 11 (pack "flt" (inc F) "-flt" F)) ) - (prinst "srdi" 0 0 4) # Scale (ignore sign for now) + (prinst "srdi" 0 0 4) # Scale (ignore sign) (prinst "std" 0 "0(1)") (prinst "ld" R "8(1)") # Value (prinst "andi." 0 R "0x02") # Short? diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l @@ -1,4 +1,4 @@ -# 25apr11abu +# 27apr11abu # (c) Software Lab. Alexander Burger # Byte order @@ -586,22 +586,18 @@ (prinst "movss" "(%rdx)" "%xmm0") ) (asm fix () - (prinst "sub" "$8" "%rsp") # Space for buffer (prinst "shr" "$4" "%rbx") # Normalize scale (prinst "jc" "1f") # Jump if negative (prinst "cvtsi2sd" "%rbx" "%xmm7") # Mulitply double with scale (prinst "mulsd" "%xmm7" "%xmm0") - (prinst "movsd" "%xmm0" "(%rsp)") # Keep result - (prinst "call" "lround") + (prinst "cvtsd2si" "%xmm0" "%rbx") # Convert to integer (prinst "jmp" "2f") (prinl "1:") (prinst "cvtsi2ss" "%rbx" "%xmm7") # Mulitply float with scale (prinst "mulss" "%xmm7" "%xmm0") - (prinst "movss" "%xmm0" "4(%rsp)") # Keep result - (prinst "call" "lroundf") + (prinst "cvtss2si" "%xmm0" "%rbx") # Convert to integer (prinl "2:") - (prinst "mov" "%rax" "%rbx") # Get into E - (prinst "or" "%rax" "%rax") # Negative? + (prinst "or" "%rbx" "%rbx") # Negative? (prinst "js" "3f") # Yes: Skip (prinst "shl" "$4" "%rbx") # Make positive short (prinst "orb" "$2" "%bl") @@ -614,11 +610,11 @@ (prinst "jmp" "5f") (prinl "4:") # Infinite/NaN (prinst "mov" "$Nil" "%rbx") # Preload NIL - (prinst "testb" "$0x80" "7(%rsp)") # Float value negative? - (prinst "jnz" "5f") # Yes: Skip + (prinst "xorpd" "%xmm7" "%xmm7") # Float value negative? + (prinst "ucomisd" "%xmm7" "%xmm0") + (prinst "jc" "5f") # Yes: Skip (prinst "mov" "$TSym" "%rbx") # Load T - (prinl "5:") - (prinst "add" "$8" "%rsp") ) # Drop buffer + (prinl "5:") ) (asm cc (Adr A Arg M) (unless (== 'cc (caar (seek '((L) (== (cadr L) *Statement)) *Program)))