11 .assume adl=1
22
3+ ;-------------------------------------------------------------------------------
4+
35 .section .text
46
57 .global __ulltod
68 .type __ulltod, @function
7- .global __lltod
8- .type __lltod, @function
9- .global __ultod
10- .type __ultod, @function
11- .global __ltod
12- .type __ltod, @function
13-
149__ulltod:
1510 ; (long double)unsigned long long
1611 cp a, a ; set Z flag
1712 push af
18- jr .L.lltod_common
13+ jr __lltod_common
14+ ; REQUIRE jq __lltod_common
15+
16+ ;-------------------------------------------------------------------------------
17+
18+ ; REQUIRE .section .text
19+
20+ .global __lltod
21+ .type __lltod, @function
1922__lltod:
2023 ; (long double)long long
2124 bit 7, b
2225 push af
2326 call nz, __llneg ; abs(BC:UDE:UHL)
24- .L.lltod_common:
27+
28+ ; REQUIRE require __lltod_common
29+
30+ ;-------------------------------------------------------------------------------
31+
32+ ; REQUIRE .section .text
33+
34+ .local __lltod_common
35+ __lltod_common:
2536 call __llctlz
2637 sub a, 63 ; normalize clz_result
2738 ; filter out exponent of $000 (zero) and $3FF (one)
28- jr nc, .L.int_to_f64_zero_or_one
39+ jr nc, __int_to_f64_zero_or_one
2940 ; A is [-63, -1]
3041 add a, 52
3142 ; A is [-11, 51]
32- jr c, .L.int_to_f64_shl
43+ jr c, __int_to_f64_shl
3344; __int_to_f64_shr:
3445 ; exponent = (1023 or $3FF or f64_bias) + base2_logarithm
3546 ; Minimum exponent: $434 (2^53)
@@ -89,25 +100,30 @@ __lltod:
89100 or a, a ; NZ = round-up, Z = no-round
90101 ld b, $43
91102.if 0
92- jr z, .L.int_to_f64_shl .no_round
103+ jr z, __int_to_f64_shl .no_round
93104 ; inlined __lladd_1
94105 inc hl
95106 add hl, de
96107 or a, a
97108 sbc hl, de
98- jr nz, .L.int_to_f64_shl .finish
109+ jr nz, __int_to_f64_shl .finish
99110 inc de
100111 sbc hl, de
101112 add hl, de
102- jr nz, .L.int_to_f64_shl .finish
113+ jr nz, __int_to_f64_shl .finish
103114 inc bc
104- jr .L.int_to_f64_shl .finish
115+ jr __int_to_f64_shl .finish
105116.else
106117 call nz, __lladd_1 ; round up to even
107- jr .L.int_to_f64_shl .finish
118+ jr __int_to_f64_shl .finish
108119.endif
109120
110- .L.int_to_f64_zero_or_one:
121+ ;-------------------------------------------------------------------------------
122+
123+ ; REQUIRE .section .text
124+
125+ .local __int_to_f64_zero_or_one
126+ __int_to_f64_zero_or_one:
111127 ; carry is cleared here
112128 ; UHL is either one or zero
113129 ld b, h
@@ -118,29 +134,58 @@ __lltod:
118134.L.ret_zero:
119135 ex de, hl
120136 sbc hl, hl
121- jr .L.int_to_f64_shl.finish
137+ jr __int_to_f64_shl.finish
138+
139+ ;-------------------------------------------------------------------------------
122140
141+ ; REQUIRE .section .text
142+
143+ .global __ultod
144+ .type __ultod, @function
123145__ultod:
124146 ; (long double)unsigned long
125147 cp a, a ; set Z flag
126148 push af
127- jr .L.ltod_common
149+ jr __ltod_common
150+ ; REQUIRE jq __ltod_common
151+
152+ ;-------------------------------------------------------------------------------
153+
154+ ; REQUIRE .section .text
155+
156+ .global __ltod
157+ .type __ltod, @function
128158__ltod:
129159 ; (long double)long
130160 bit 7, e
131161 push af
132162 call nz, __lneg ; abs(E:UHL)
133- .L.ltod_common:
163+
164+ ; REQUIRE require __ltod_common
165+
166+ ;-------------------------------------------------------------------------------
167+
168+ ; REQUIRE .section .text
169+
170+ .local __ltod_common
171+ __ltod_common:
134172 call __lctlz
135173 sub a, 31 ; normalize clz_result
136174
137175 ; filter out exponent of $000 (zero) and $3FF (one)
138- jr nc, .L.int_to_f64_zero_or_one
176+ jr nc, __int_to_f64_zero_or_one
139177 ; A is [-31, -1]
140178 add a, 52
141179 ; A is [21, 51]
142180
143- .L.int_to_f64_shl:
181+ ; REQUIRE require __int_to_f64_shl
182+
183+ ;-------------------------------------------------------------------------------
184+
185+ ; REQUIRE .section .text
186+
187+ .local __int_to_f64_shl
188+ __int_to_f64_shl:
144189 ; exponent = (1023 or $3FF or f64_bias) + base2_logarithm
145190 ; Minimum exponent: $400 (2^1)
146191 ; Maximum exponent: $434 (2^52)
@@ -169,8 +214,10 @@ __ltod:
169214 ld c, a
170215 ld b, h
171216 pop hl ; restore shifted HL
172- .L.int_to_f64_shl.no_round:
173- .L.int_to_f64_shl.finish:
217+ .local __int_to_f64_shl.no_round
218+ __int_to_f64_shl.no_round:
219+ .local __int_to_f64_shl.finish
220+ __int_to_f64_shl.finish:
174221 pop af
175222 ret z
176223 set 7, b
0 commit comments