Implemented bitwise operations on arm64
This commit is contained in:
14
src/arm/Or.go
Normal file
14
src/arm/Or.go
Normal file
@ -0,0 +1,14 @@
|
||||
package arm
|
||||
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// OrRegisterNumber performs a bitwise OR using a register and a number.
|
||||
func OrRegisterNumber(destination cpu.Register, source cpu.Register, number int) (uint32, bool) {
|
||||
imm13, encodable := encodeLogicalImmediate(uint(number))
|
||||
return 0b101100100<<23 | reg2BitmaskImm(destination, source, imm13), encodable
|
||||
}
|
||||
|
||||
// OrRegisterRegister performs a bitwise OR using two registers.
|
||||
func OrRegisterRegister(destination cpu.Register, source cpu.Register, operand cpu.Register) uint32 {
|
||||
return 0b10101010<<24 | reg3(destination, source, operand)
|
||||
}
|
Reference in New Issue
Block a user