Does C.LWSP zero-extend on RV64?
No. It expands to lw, so the loaded 32-bit word is sign-extended to XLEN.
Load 32-bit word from sp+offset. CI format. rd!=x0.
C.LWSP uses CI format to load a 32-bit word from sp (x2) plus a zero-extended, 4-byte-scaled offset into rd. It expands to lw rd, offset(x2), so on RV64 the word is sign-extended to XLEN. It is valid only when rd is not x0; rd=x0 encodings are reserved. The offset range is 0 through 252 bytes.
Shows only RISC-V ISA-visible 16-bit encoding, operands, and state; it does not simulate a pipeline, cache, endianness implementation, or timing.
The EEI choice affects this result only when the effective address is not divisible by 4; a naturally aligned access must not raise an address-misaligned exception.
x10 <- 0xFFFFFFFFFFFFFF80
C.LWSP adds x2/sp to a 4-byte-multiple offset from 0 through 252; because it is equivalent to lw, RV64 sign-extends the loaded 32-bit value to XLEN.
Understand this scenario with real code like «c.lwsp x10, 16(sp) # x10 = *(sp+16)».
No. It expands to lw, so the loaded 32-bit word is sign-extended to XLEN.