Skip to content

Commit a271431

Browse files
committed
optimized fpmul multiplication
1 parent 593e730 commit a271431

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

src/crt/fpmul.src

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ __fpmul: ; CHECK: same(bitcast(float, pair8_24_t, { out.BC, out.A }), bitcast(fl
7676
inc d
7777
jr z, .L.nonfinite.2
7878
ld a, d
79-
ld d, b; 0
79+
ld d, b ; ld d, 0
8080
rlc e
8181
ccf
8282
rr e
@@ -133,26 +133,28 @@ __fpmul: ; CHECK: same(bitcast(float, pair8_24_t, { out.BC, out.A }), bitcast(fl
133133
ld bc, (ix + 12)
134134
mlt bc
135135
add hl, bc
136+
136137
ld (ix + 2), hl
137-
ld hl, (ix + 3)
138-
inc hl
139-
dec.s hl
140-
ld c, (ix + 11)
141-
ld b, (ix + 15)
142-
mlt bc
138+
ld b, (ix + 4)
139+
ld c, h
140+
ld l, (ix + 11)
141+
ld h, (ix + 15)
142+
mlt hl ; clears UHL
143143
add hl, bc
144+
144145
ld c, (ix + 12)
145146
ld b, (ix + 14)
146147
mlt bc
147148
add hl, bc
149+
148150
ld (ix + 3), hl
149-
ld hl, (ix + 4)
150-
inc hl
151-
dec.s hl
152-
ld c, (ix + 12)
153-
ld b, (ix + 15)
154-
mlt bc
151+
ld b, (ix + 5)
152+
ld c, h
153+
ld l, (ix + 12)
154+
ld h, (ix + 15)
155+
mlt hl ; clears UHL
155156
add hl, bc
157+
156158
cp a, d
157159
jr nz, .L.normalized
158160
ld bc, (ix + 2)

0 commit comments

Comments
 (0)