Implemented multiplication with a number on arm64
This commit is contained in:
parent
1d0e49f0e3
commit
72272ed9af
1 changed files with 7 additions and 4 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue