31.14.2.5 Explanation of the SHR and SHRP Instructions

When the SHR or SHRP instruction is executed, the S1 bits are shifted to the right of the S2 number of bits. Every time 1 bit is shifted, the rightmost bit (least significant bit) is lost. 0 is stored in the empty topmost bit positions. The result is stored in D1.

The SHR and SHRP instructions always pass power. When using SHR and SHRP instructions, an error will occur if the variables specified in operands S1 and D1 operands are not the same type. Designate the same variable type in operands S1 and D1.

Refer to the following for specifying a constant.

Specify the address to shift.

Specifies the number of bits to shift.

Specifies the address to store the shift result.

For example, when 1 bit is shifted to the right

When operand D1 is an integer variable

When operand D1 is an integer variable and you want to input hexadecimal values in operands S1 and S2.

When 0x (zero and lower case "x") is input, the following values become hexadecimal values.

Use the same format when shifting data in a specified array (integer variable array) and when specifying an array element.

An error will occur if the formats are different.

If the S1 and D1 arrays are the same size, S1 is treated like a single giant integer. Bits are shifted one element to the next element.

The bottom-most bits of each element are not lost. However, the bottom-most bit in the first element is lost. Specify S2 as 0 or higher, up to (32 x Array Size -1).

If both S1 and D1 are not arrays, 32 bits are shifted. For S2, specify a value between 0 and 31.