Implemented bit shifting on arm64

This commit is contained in:
Eduard Urbach 2025-03-15 19:45:14 +01:00
parent 1bb1b940fd
commit b3b233c6c9
Signed by: eduard
GPG key ID: 49226B848C78F6C8
10 changed files with 120 additions and 16 deletions

View file

@ -256,6 +256,24 @@ func (c *compiler) compileARM(x asm.Instruction) {
}
}
case asm.SHIFTL:
switch x.Type {
case asm.TypeRegisterNumber:
operands := c.assembler.Param.RegisterNumber[x.Index]
c.append(arm.ShiftLeftNumber(operands.Register, operands.Register, operands.Number&0b111111))
case asm.TypeRegisterRegister:
panic("not implemented")
}
case asm.SHIFTRS:
switch x.Type {
case asm.TypeRegisterNumber:
operands := c.assembler.Param.RegisterNumber[x.Index]
c.append(arm.ShiftRightSignedNumber(operands.Register, operands.Register, operands.Number&0b111111))
case asm.TypeRegisterRegister:
panic("not implemented")
}
case asm.RETURN:
c.append(arm.LoadPair(arm.FP, arm.LR, arm.SP, 16))
c.append(arm.Return())

View file

@ -155,6 +155,8 @@ func (c *compiler) compileX86(x asm.Instruction) {
case asm.TypeRegisterNumber:
operands := c.assembler.Param.RegisterNumber[x.Index]
c.code = x86.ShiftLeftNumber(c.code, operands.Register, byte(operands.Number)&0b111111)
case asm.TypeRegisterRegister:
panic("not implemented")
}
case asm.SHIFTRS:
@ -162,6 +164,8 @@ func (c *compiler) compileX86(x asm.Instruction) {
case asm.TypeRegisterNumber:
operands := c.assembler.Param.RegisterNumber[x.Index]
c.code = x86.ShiftRightSignedNumber(c.code, operands.Register, byte(operands.Number)&0b111111)
case asm.TypeRegisterRegister:
panic("not implemented")
}
case asm.STORE: