Is the immediate zero-extended?
XOR immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
Bitwise XOR of rs1 and rs2, result in rd
XOR uses opcode 0110011 (0x33), funct3 100, funct7 0000000. The rs1 and rs2 fields select the two source registers, and rd selects the destination register.
XOR (R-type) performs bitwise XOR of rs1 and rs2, writing to rd. funct7=0000000, funct3=100. XOR rd,rd,rd is the recommended register clearing method (preferred over ADDI rd,x0,0, no immediate dependency). XOR's self-inverse property (A XOR B XOR B = A) makes it useful for encryption/decryption.
XOR is a base integer bitwise logical instruction. It operates across XLEN bits; immediate forms use a sign-extended 12-bit immediate.
Understand this scenario with real code like «xor x5, x6, x7 # x5 = x6 ^ x7».
Understand this scenario with real code like «xor x5, x6, x7 # x5 = x6 ^ x7».
Understand this scenario with real code like «xor x5, x6, x7 # x5 = x6 ^ x7».
XOR immediate forms use a 12-bit signed immediate that is sign-extended to XLEN.
The base integer ISA has no condition-code flags; only rd is written.