# Signed and Unsigned Loads in a 32-bit Registers

I have a question over this quote directly out of Computer Organization and Design, 5e:

Signed versus unsigned applies to loads as well as to arithmetic. The function of a signed load is to copy the sign repeatedly to fill the rest of the register—called sign extension—but its purpose is to place a correct representation of the number within that register. Unsigned loads simply fill with 0s to the left of the data, since the number represented by the bit pattern is unsigned.

When loading a 32-bit word into a 32-bit register, the point is moot; signed and unsigned loads are identical.

(Chapter 2.4, pg 76; Patterson and Hennessy). [emphasis mine]

I do not immediately grasp why signed values do not matter for a full 32-bit word in a 32-bit register. The authors do not go on to clarify exactly why this is. My best guess from the materials of the book is because registers are to be sign agnostic with regard to the data within them and how they are interpreted is up to the assembly code? This would make sense if it weren't for the lack of a signed lw operation for MIPS, the language chosen for the text.

Thank you for any clarification on this.

• Why not try it? Consider all three cases (negative, positive, and zero). Put a signed 32-bit value in a memory location, then consider what that would look like if you wanted to load it into a 32-bit register in a way that preserves the sign. What do you notice? Sep 18, 2017 at 1:34

A $n$-bit bitstring can be interpreted semantically both as an unsigned integer in the range $0$ to $2^n-1$, and as a signed integer in the range $-2^{n-1}$ to $2^{n-1}-1$. There is always a way to assign an $n_1$-bit bitstring to an $n_2$-bit bitstring so that both have the same semantics, but the way to do that depends on whether the semantics is unsigned or signed. In the unsigned case, we use zero extension: we affix $n_2-n_1$ zeroes on the left. In the signed case, we use zero extension: we affix $n_2-n_1$ copies of the sign bit on the left.
As an example, consider $x=1111$, and suppose that we wish to assign it into an 8-bit bitstring. In the unsigned case, the value of $x$ is $15$, and the extension is $00001111$. In the signed case, the value of $x$ is $-1$, and the extension is $11111111$.
When $n_2 = n_1$, there is nothing to extend, so the signed and unsigned cases are the same. That's why the point is moot in such cases.