Object Code Accelerator Manual
Preparing Your Program for TNS/E Systems
Object Code Accelerator Manual—528144-003
2-12
Shift Instructions With Dynamic Shift Counts
difference applies to both single-word (16-bit) and double-word (32-bit) shift
instructions.
For single-word shift operations with dynamic shift counts:
•
TNS systems accept counts within the range of 0 to 255. Shift counts of 16 to 255
are treated as 16.
•
TNS/E systems counts within the range of 0 to 31. Shift counts of 16 to 31 are
treated as 16. Shift counts greater than 31 give undefined results.
For double-word shift operations with dynamic shift counts:
•
TNS systems accept counts within the range of 0 to 255. Shift counts of 32 to 255
are treated as 32.
•
TNS/E systems accept counts within the range of 0 to 32,767. Shift counts greater
than 32 are treated as 32.
Dynamic shift counts that fall outside the acceptable ranges give undefined results.
The ALS, LLS, ARS, and LRS instructions implement single-word shifts and the DALS,
DLLS, DARS, and DLRS instructions implement double-word shifts.
The TAL compiler generates these instructions for the bit-shift operators ('<<', '>>', <<,
and >>) if the operand to the right of the operators is not a constant. These instructions
can also be found in TAL CODE statements. Refer to the appropriate system
description manual for more information about the TNS instruction set. Refer to the
TAL Reference Manual for details on TAL bit-shift operators.
Detection Guidelines
•
Use a text editor to search for ALS 0, LLS 0, ARS 0, and LRS 0 in TAL CODE
statements. Make sure that the operands for these instructions do not use shift
counts greater than 31.
•
Use a text editor to search for the TAL bit-shift operators: unsigned left and right
shift ('<<' and '>>') and signed left and right shift (<< and >>). Make sure that in
cases where the left operand is a 16-bit unit and the shift count is dynamic, the
count is never greater than 31.
Required Change
•
Recode statements that use dynamic shift counts greater than 31.
Examples
In this example, the value of p is arithmetically shifted to the right 35 positions. The
value of p differs on TNS and TNS/E systems.
INT p, nbits, q; ! INT variables
p := -128;