since sizeof(void*) is 3, multiplication by 3 is a very common operation. However, current codegen outputs ld bc, 3 \ call __imulu instead of shifts and adds push hl \ pop bc \ add hl, hl \ add hl, bc or push hl \ pop bc \ add hl, bc \ add hl, bc.
This may also allow a value in IY or IX to also be multiplied by 3
push hl
pop (bc|de)
add hl, hl
add hl, (bc|de)
lea (bc|de), iy
add iy, iy
add iy, (bc|de)
Other small constants like multiplying by 5 or 9 could also be turned into a series of shifts and adds.
See discussion here: https://discordapp.com/channels/432891584451706892/1478898419094519931
since
sizeof(void*)is 3, multiplication by 3 is a very common operation. However, current codegen outputsld bc, 3 \ call __imuluinstead of shifts and addspush hl \ pop bc \ add hl, hl \ add hl, bcorpush hl \ pop bc \ add hl, bc \ add hl, bc.This may also allow a value in
IYorIXto also be multiplied by 3Other small constants like multiplying by 5 or 9 could also be turned into a series of shifts and adds.
See discussion here: https://discordapp.com/channels/432891584451706892/1478898419094519931