Can both operands name the same register?
Yes. x & x = x; both operands use the same old register value and the result writes rd'.
RV32/RV64: AND the XLEN-bit values of rd' and rs2' (x8–x15), then write rd'.
C.AND (CA format, x8-x15 only) computes bitwise AND of rd' and rs2', writes to rd'. Expands to and rd',rd',rs2'.
Explore the 16-bit encoding, operands, calculation, and architectural result.
RV32C/RV64C / Zca
16-bit encoding fields
RV32/RV64: AND the XLEN-bit values of rd' and rs2' (x8–x15), then write rd'.
RV32/RV64, x8=0xf0f0 and x9=0x0ff0: c.and x8, x9 gives x8=0x00f0; both registers are in x8–x15.
Yes. x & x = x; both operands use the same old register value and the result writes rd'.
No. Both three-bit compressed fields encode only x8–x15. C.AND has no immediate; the compressed immediate form is C.ANDI.