Implemented multiplication with a number on arm64

This commit is contained in:
2025-03-14 12:08:14 +01:00
parent 1d0e49f0e3
commit 72272ed9af

View File

@ -144,16 +144,19 @@ func (c *compiler) compileARM(x asm.Instruction) {
operand := c.assembler.Param.RegisterRegister[x.Index]
c.append(arm.MulRegisterRegister(operand.Destination, operand.Destination, operand.Source))
case asm.TypeRegisterNumber:
panic("not implemented")
operand := c.assembler.Param.RegisterNumber[x.Index]
tmp := arm.X28
c.append(arm.MoveRegisterNumber(tmp, operand.Number))
c.append(arm.MulRegisterRegister(operand.Register, operand.Register, tmp))
}
case asm.MODULO:
switch x.Type {
case asm.TypeRegisterRegister:
operand := c.assembler.Param.RegisterRegister[x.Index]
quotient := arm.X28
c.append(arm.DivSigned(quotient, operand.Destination, operand.Source))
c.append(arm.MultiplySubtract(operand.Destination, quotient, operand.Source, operand.Destination))
tmp := arm.X28
c.append(arm.DivSigned(tmp, operand.Destination, operand.Source))
c.append(arm.MultiplySubtract(operand.Destination, tmp, operand.Source, operand.Destination))
case asm.TypeRegisterNumber:
panic("not implemented")
}