__builtin_bcdshift
Purpose
Decimal shift.
This built-in function is valid only when -qarch(-mcpu) is set to utilize POWER9™ technology and the altivec.h file is included.
Prototype
vector unsigned char __builtin_bcdshift (vector unsigned char a, int b, unsigned char c);
Usage
The built-in function decimal shifts the signed packed decimal value of a into the result.
If the value of b is positive, a is shifted left by (b<32)?b:31 digits. If the value of b is negative, a is shifted right by ((-b+1)<32)?(-b+1):31 digits.
The sign code of the result is set according to the following rules:
- If a is positive, the sign code is set to 0xD.
- If a is negative, the sign code is set according to the following rules:
- If c equals to 0, the sign code is set to 0xC.
- If c equals to 1, the sign code is set to 0xF.
Notes:
- You can determine whether a packed decimal value is positive or negative according to the
following rules:
- Packed decimal values with sign code of 0xA, 0xC, 0xE, or 0xF are interpreted as positive values.
- Packed decimal values with sign code of 0xB or 0xD are interpreted as negative values.
- The value of c can only be 0 or 1.


