gas-preprocessor icon indicating copy to clipboard operation
gas-preprocessor copied to clipboard

Unable to compile NEON support for libjpeg-turbo with latest Clang in Xcode 5

Open swisspol opened this issue 10 years ago • 2 comments

Self-contained build script to reproduce: https://gist.github.com/swisspol/8498104

Build script output: https://gist.github.com/swisspol/8498120

And where it fails:

jsimd_arm_neon.S:270:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 1 * 8))]
               ^
jsimd_arm_neon.S:276:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 2 * 8))]
               ^
jsimd_arm_neon.S:283:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 3 * 8))]
               ^
jsimd_arm_neon.S:291:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 4 * 8))]
               ^
jsimd_arm_neon.S:299:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 5 * 8))]
               ^
jsimd_arm_neon.S:306:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 6 * 8))]
               ^
jsimd_arm_neon.S:313:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 7 * 8))]
               ^
jsimd_arm_neon.S:321:16: error: invalid operand for instruction
      ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 0 * 8))]

I asked about the issue on the libjpeg-turbo mailing list and someone suggested to ask here: http://sourceforge.net/p/libjpeg-turbo/mailman/message/31870599/

swisspol avatar Jan 21 '14 19:01 swisspol

Some feedback from DRC on the libjpeg-turbo mailing list:

I would like to support Xcode 5.0. In order to make that happen, then
gas-preprocessor.pl needs to be modified to work around a couple of
issues with LLVM/clang. The "invalid operand" issue is one of them.
The other is that, when you pass "-x assembler" to clang, which is
necessary when feeding it an assembly file via stdin like
gas-preprocessor does, it seems to ignore some of the other arguments.
The latter can be worked around in gas-preprocessor pretty easily, but
the former seems to be a basic incompatibility between the assembly file
and the new assembler. The lines of code in question are unmodified
relative to the original assembly file, so the presence of
gas-preprocessor doesn't seem to be what's causing the failure. The
assembly code just won't assemble in clang. That is not something I am
capable of resolving, and note that I did spend about 4 hours trying
various things in gas-preprocessor.

swisspol avatar Jan 29 '14 16:01 swisspol

I ended up fixing this issue locally in the libjpeg-turbo repository:

https://sourceforge.net/p/libjpeg-turbo/code/HEAD/tree/gas-preprocessor/

dcommander avatar Mar 17 '14 20:03 dcommander