Skip to content

Commit 26940ae

Browse files
committed
Follow the paradigm that _fast functions need not preserve all registers
1 parent 65db35d commit 26940ae

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

src/crt/ipopcnt_fast.src

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
public __ipopcnt_fast
55
__ipopcnt_fast:
66
; Inlined implementation of __ipopcnt
7-
push hl
7+
; Destroys: HL
88
ld a, l
99
cpl
1010
ld l, a
@@ -46,5 +46,4 @@ __ipopcnt_fast:
4646
add hl, hl
4747
cpl
4848
adc a, 9
49-
pop hl
5049
ret

src/crt/llpopcnt_fast.src

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
section .text
44
public __llpopcnt_fast
55
__llpopcnt_fast:
6+
; Destroys: HL, DE
67
call __lpopcnt_fast
7-
push de
8-
push hl
98
ex de, hl
109
ld l, b
1110
ld e, c
1211
ld d, a
1312
call __lpopcnt_fast
1413
add a, d
15-
pop hl
16-
pop de
1714
ret
1815

1916
extern __lpopcnt_fast

src/crt/lpopcnt_fast.src

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
public __lpopcnt_fast
55
__lpopcnt_fast:
66
; Inlined implementation of __lpopcnt
7-
push hl
7+
; Destroys: HL
88
ld a, l
99
cpl
1010
ld l, a
@@ -51,5 +51,4 @@ __lpopcnt_fast:
5151
add hl, hl
5252
cpl
5353
adc a, 17
54-
pop hl
5554
ret

src/crt/spopcnt_fast.src

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
public __spopcnt_fast
55
__spopcnt_fast:
66
; Inlined implementation of __spopcnt
7-
push hl
7+
; Destroys: HL
88
add hl, hl
99
add hl, hl
1010
add hl, hl
@@ -37,5 +37,4 @@ __spopcnt_fast:
3737
add hl, hl
3838
cpl
3939
adc a, 9
40-
pop hl
4140
ret

0 commit comments

Comments
 (0)