AditiRM wrote: ## Prototypes
```c vector unsigned char __builtin_bcdshift(vector unsigned char, int, unsigned char); vector unsigned char __builtin_bcdshiftround(vector unsigned char, int, unsigned char); vector unsigned char __builtin_bcdtruncate(vector unsigned char, int, unsigned char); vector unsigned char __builtin_bcdunsignedtruncate(vector unsigned char, int); vector unsigned char __builtin_bcdunsignedshift(vector unsigned char, int); ``` ## Usage Details `__builtin_bcdshift`: 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: > The value of c can only be 0 or 1. > 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. `__builtin_bcdshiftround`: The built-in function decimal shifts and rounds the signed packed decimal value of a into the result. If the value of b is positive, a is shifted left by `b % 32` digits. If the value of b is negative, a is shifted right by `(-b) % 32` digits. If the last digit shifted out on the right is greater than 5, the result is incremented by 1. 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 0, the sign code is set to 0xC. - If c equals 1, the sign code is set to 0xF. > notes: > The other digits of the result are set to zero. > 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. `__builtin_bcdtruncate`: The built-in function copies the rightmost b digits of the unsigned decimal value of a into the result. 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 0, the sign code is set to 0xC. - If c equals 1, the sign code is set to 0xF. `__builtin_bcdutruncate`: The built-in function copies the rightmost b digits of the unsigned decimal value of a into the result. The other digits of the result are set to zero. `__builtin_bcdushift`: The built-in function decimal shifts the unsigned packed decimal value of a into the result. - If the value of b is positive, a is shifted left by (b < 33) ? b : 32 digits. - If the value of b is negative, a is shifted right by ((-b + 1) < 33) ? (-b + 1) : 32 digits. https://github.com/llvm/llvm-project/pull/154715 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
