65816-llvm-mos/runtime/src/softDouble.s
Scott Duensing 6d7eae0356 Checkpoint.
2026-04-30 01:29:16 -05:00

91 lines
1.6 KiB
ArmAsm

; Stub double-precision soft-float — every routine returns 0.
;
; The C-based softDouble.c hit two compiler issues simultaneously:
; (1) Register Coalescer crash on the multi-tied-def-with-i64 pattern;
; (2) PEI "frame offset out of stack-relative range" because the
; spilled u64s push the local frame past the 8-bit ,S addressing
; limit. Both are real compiler bugs that require non-trivial
; backend work to fix. Until then, these stubs let programs that
; reference but don't actually evaluate `double` link cleanly;
; programs that DO use double get zero values back.
;
; Symbol set matches what clang's i64-routed double libcalls expect.
; ABI: i64 result returned via A:X:Y:DP[$F0] (matches LowerReturn).
.text
; Helper macro idiom: stub returning 64-bit zero.
.macro RET_ZERO64
lda #0
tax
tay
sta 0xf0
rtl
.endm
.globl __adddf3
__adddf3: RET_ZERO64
.globl __subdf3
__subdf3: RET_ZERO64
.globl __muldf3
__muldf3: RET_ZERO64
.globl __divdf3
__divdf3: RET_ZERO64
.globl __negdf2
__negdf2: RET_ZERO64
.globl __cmpdf2
__cmpdf2: lda #0
rtl
.globl __eqdf2
__eqdf2: lda #0
rtl
.globl __nedf2
__nedf2: lda #0
rtl
.globl __ltdf2
__ltdf2: lda #0
rtl
.globl __gtdf2
__gtdf2: lda #0
rtl
.globl __ledf2
__ledf2: lda #0
rtl
.globl __gedf2
__gedf2: lda #0
rtl
.globl __floatsidf
__floatsidf: RET_ZERO64
.globl __floatunsidf
__floatunsidf: RET_ZERO64
.globl __fixdfsi
__fixdfsi: lda #0
tax
rtl
.globl __fixunsdfsi
__fixunsdfsi: lda #0
tax
rtl
.globl __extendsfdf2
__extendsfdf2: RET_ZERO64
.globl __truncdfsf2
__truncdfsf2: lda #0
tax
rtl