Implemented bit shifting on arm64
This commit is contained in:
parent
1bb1b940fd
commit
b3b233c6c9
10 changed files with 120 additions and 16 deletions
|
@ -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())
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue