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.
Assumes readable/writable ordinary memory without additional permission faults. The EEI option applies only to addresses not naturally 4-byte aligned; byte order, general permissions, device effects, and post-trap state are not modeled.
Not committed; registers, memory and PC retain their initial state.
Teaching stages show ISA-visible effects, not a CPU pipeline, cache, or timing model.
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) # RV64: sp=0x2000, word at 0x2010=0xFFFFFF80 -> x10=0xFFFFFFFFFFFFFF80».
No. It expands to lw, so the loaded 32-bit word is sign-extended to XLEN.