Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm neon sli_n: Fix invalid shift warnings (#1253)
Per the ARMv8 manual, the valid range of shifts for the vector SLI operations is "0 to the element width in bits minus 1." The existing SIMDe implementation creates an invalid shift in the case of 0, as the shifts are (element width - n) - so, for a 0-bit shift on a 64-bit value, the shift is 64. This is undefined per the C spec, and leads to compiler warnings on build. This fix changes the sli_n shift operations to work properly for the valid range of values, shifting ((element width - 1) - n), with a modified constant value to generate the same results (7f... instead of ff...). While the existing tests all pass with the change, a number of the tests have been modified (and have new constant values generated) to properly exercise and demonstrate the "n == 0" shift case. These test vectors were generated on an ARMv9 system (Google Compute Engine C4A system), and pass on x86 hardware as well.
- Loading branch information