ASR#
Format: ASR.signPos dest, source1, source2
Phase0: -
Phase1: -
Phase2: ASR.signPos FT5, FT4, S4
Description: Arithmetic Shift Right
FT5 = arithmetic shift right of FT4 by S4 bits, where modifier SignPos indicates position of sign bit;
switch (SignPos)
{
case TWB:
sb=31;
break; // Top Word
case PWB:
sb=15;
break; // Partial Word
case MTB:
sb=FT0&0x1F;
break; // Mask Top
case FTB:
sb=FT3&0x1F;
break; // Find Top
}
FT5=(signed)(FT4<<(31-sb))>>(31+S4-sb)
Example:
uniform highp int a;
uniform highp int b;
void main()
{
fragColor = vec4(a >> b);
}
1 : mov ft0, ft1, c0, c0
mov ft2, sh0
cbs ft3, sh0
or ft4, _, ft2, _, c0
asr.twb ft5, ft4, i0
mov i0, ft5;