SPRUIE9D May 2017 – May 2024 DRA74P , DRA75P , DRA76P , DRA77P
Assembly syntax: | VSHF src1, src2, dst |
Operation: | Arithmetic shift, shift left when src2 > 0, shift right by –src2 when src2 < 0 |
Classification: | 2-input 1-output |
Bit width: | 40-bit src1/dst, 6-bit src2, allowing shifting by -32 ~ 31 bits |
Delay slot: | no |
C statement: | dst = (src2 >= 0) ? (src1 << src2) : (src1 >> –src2); |
VSHF is an arithmetic shift, not logic shift, compared to conventional instruction sets that have both options. This is because VCOP performs sign extension in the load stage, and all signed/unsigned 8/16/32-bit operations are carried out with the 40-bit register file.
Only src2[5:0] are read, so for example src2 = 32 causes a right-shift by 32 bits, since src2[5:0] = 0x20.