Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix AArch64 ABI conformance issue in SIMD code.
In the AArch64 ABI, the high (unused) DWORD of a 32-bit argument's register is undefined, so it was incorrect to use 64-bit instructions to transfer a JDIMENSION argument in the 64-bit NEON SIMD functions. The code worked thus far only because the existing compiler optimizers weren't smart enough to do anything else with the register in question, so the upper 32 bits happened to be all zeroes. The latest builds of Clang/LLVM have a smarter optimizer, and under certain circumstances, it will attempt to load-combine adjacent 32-bit integers from one of the libjpeg structures into a single 64-bit integer and pass that 64-bit integer as a 32-bit argument to one of the SIMD functions (which is allowed by the ABI, since the upper 32 bits of the 32-bit argument's register are undefined.) This caused the libjpeg-turbo regression tests to crash. This patch tries to use the Wn registers whenever possible. Otherwise, it uses a zero-extend instruction to avoid using the upper 32 bits of the 64-bit registers, which are not guaranteed to be valid for 32-bit arguments. Based on sebpop@1fbae13 Closes #91. Refer also to android/ndk#110 and https://llvm.org/bugs/show_bug.cgi?id=28393 (cherrypick from external/libjpeg-turbo of c8282be605a139b269f2b8f4b4fb6f4118e740ab.) Change-Id: I935a3696106e7ffcf9b1a6c12cb7f31d95b4ccc8
- Loading branch information