71. Sign EXTend

71.1. Name

EXT, EXTB -- Sign extend

71.2. Synopsis

        EXT.W        Dn        Extend byte to word
        EXT.L        Dn        Extend word to long word
        EXTB.L        Dn        Extend byte to long word        (68020+)

        Size = (Word, Long)

71.3. Function

Extends a byte to a word, or a word to a long word in a data register by copying the sign bit through the upper bits. If the operation is from byte to word, bit 7 is copied to bits 8 through 15. If the operation is from word to long word, bit 15 is copied to bits 16 through 31. The EXTB copies bit 7 to bits 8 through 31.

71.4. Format

        -----------------------------------------------------------------
        |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
        |---|---|---|---|---|---|---|-----------|---|---|---|-----------|
        | 0 | 1 | 0 | 0 | 1 | 0 | 0 |  OP-MODE  | 0 | 0 | 0 | REGISTER  |
        -----------------------------------------------------------------

        "REGISTER" specifies a data register.

OP-MODE
        010->Extending from 8 bits to 16 bits.
        011->Extending from 16 bits to 32 bits.
        111->Extending from 8 bits to 32 bits.

71.5. Result

        X - Not affected
        N - Set if the result is negative. Cleared otherwise.
        Z - Set if the result is zero. Cleared otherwise.
        V - Always cleared
        C - Always cleared

71.6. See also

BFEXTS BFEXTU