Implemented bitwise operations on arm64

This commit is contained in:
2025-03-14 18:37:39 +01:00
parent e123a26a1d
commit 5f339187e6
9 changed files with 190 additions and 9 deletions

14
src/arm/Or.go Normal file
View 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)
}