In case of 64-bit processor,if word operation is to be performed then will the 32nd bit will be considered as signed bit or as a magnitude bit?
Asked
Active
Viewed 392 times
1 Answers
0
The ADDW, SUBW instructions, for example, from riscv-spec-v2.2:
ADDW and SUBW are RV64I-only instructions that are defined analogously to ADD and SUB but operate on 32-bit values and produce signed 32-bit results. Overflows are ignored, and the low 32-bits of the result is sign-extended to 64-bits and written to the destination register.
thus a sign bit. If you don’t want this, then don’t use the ‘w’ variants and make sure the upper register bits are zeros. It gets a bit unusual around the multiply instructions, where you have to manage the upper and lower explicitly.

mevets
- 10,070
- 1
- 21
- 33