Why the Programming Reference 1.0 stubbornly claims everywhere that ASHIFT X by Y (V) will shift RIGHT when Y is positive, when I see LEFT shift?

Why the Programming Reference 1.0 stubbornly claims everywhere that ASHIFT X by Y (V) will shift RIGHT when Y is positive, when I see LEFT shift?

- 1 person found this helpful
People from AD, you should be more serious, I guess.

It seems you do not care at all about what you do.

Now read by syllables:

A S H I F T S H I F T S * * * L E F T * * * W I T H P O S I T I V E S H I F T M A G N I T U D E.

This is so because I say so.

And if you are care just a bit, you could understand that it should be this way BECAUSE IT SHOULD BE COMPATIBLE WITH BF5xx.

It is a pity that I have no time to swear about all what I find, for example about erroneous dynamic scaling in cfft_fr16_bf2 function.

Hi Alex,

Apologies for the delay in getting back on this. I have written a code and checked the working of ASHIFT operation.

R2.L = -2;

R1.L = 0xFF;

R0.L = 0;R0.L = ASHIFT R1.L by R2.L;

From the above example I just observed that, if I take R2.L value as negative (eg: -2), it gives the shift result of R0.L as 0x3F, it actually does the RIGHT shift operation with negative magnitude. In case the value of R2.L is positive (eg: 2) the result is LEFT shifted by 2, that is 0x3FC;

It seems like your observation is correct and it indeed a mistake in the documentation. Thanks for bringing this to our notice and we shall take necessary action to correct this.

Best Regards,

Jithul

I suggest you to refer the AShift16 Description section(Page No:401 / 717) in the ADSP-BF7xx Blackfin Processor Programming Reference manual.

The versions of this instruction using ashift syntax support the following shift operations:

For a positive shift_magnitude, ashift produces an arithmetic shift right with sign bit preservation. The

sign bit value back-fills the left-most bit positions vacated by the arithmetic shift right.

For a negative shift_magnitude, ashift produces a logical shift left, but does not guarantee sign bit preservation. If the negative shift_magnitude is too large, the ashift operation saturates the destination register. A logical shift left that would otherwise lose non-sign bits off the left-hand side saturates to the maximum

positive or negative value instead.

The versions of this instruction using >>> syntax only support arithmetic right shift operations using positive

shift_magnitude values.

The versions of this instruction using <<< syntax only support logical left shift operations using positive

shift_magnitude values.