21

I'm trying to build ios project for $(ARCHS_STANDARD_32_BIT) architecture - armv7 for the latest iOS (iOS 7.0) and I've got the following error:

Unknown register name 'q0' in asm

in function

static void neon_asm_mat4_vec4_mul(const float* __restrict m, const int* __restrict v, int* __restrict output)
      {
        asm volatile
        (
         // Store m & v - avoiding q4-q7 which need to be preserved - q0 = result
         "vldmia %1, { q8-q11 } \n\t"   // q8-q11 = m
         "vldmia %2, { q1 }     \n\t"   // q1     = v

         // Convert v to floats
         "vcvt.f32.s32 q1, q1 \n\t"

         // result = first column of A x V.x
         "vmul.f32 q0, q8, d2[0] \n\t"

         // result += second column of A x V.y
         "vmla.f32 q0, q9, d2[1] \n\t"

         // result += third column of A x V.z
         "vmla.f32 q0, q10, d3[0] \n\t"

         // result += last column of A x V.w
         "vmla.f32 q0, q11, d3[1] \n\t"

         // convert to integer
         "vcvt.s32.f32 q0, q0 \n\t"

         // output = result registers
         "vstmia %0, { q0 }  \n\t"

         : // no output
         : "r" (output), "r" (m), "r" (v)      // input - note *value* of pointer doesn't change
         : "memory", "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11" //clobber
         );
      }

Could you please help me to either update my code so it can be built for the latest hardware or simply configure build settings differently. I'm new to iOS development, so I'm kind of lost...

4

2 Answers 2

47

try changing in neon_matrix_impl.c and mat4.c
#if defined(ARM_NEON)
to
#if defined(_ARM_ARCH_7)

3
  • 7
    I found I had to change this is two files: neon_matrix_impl.c and mat4.c .
    – elprl
    Mar 22, 2014 at 15:49
  • What changes you have made?
    – Jag
    Apr 1, 2014 at 1:32
  • You seem to be mixing and matching... NEON is nearly ubiquitous with ARMv7 and ARMv8. Changing __ARM_NEON__ to _ARM_ARCH_7 seems wrong. If you have an ARM device with NEON available, then you should add -march=armv7-a -mfpu=neon to your CFLAGS and CXXFLAGS. Depending on the flags present in /proc/cpuinfo, you might be able to use -march=armv7-a -mfpu=neon-vfpv4, which should indicate VFPv4 and 32 D-registers overlapping 16 Q-registers.
    – jww
    Jul 27, 2016 at 21:22
20

Those who are using Cocos2d 2.1 , modification(#if defined(ARM_NEON) ->#if defined(_ARM_ARCH_7)) is needed in two macros

  1. neon_matrix_impl.c and
  2. mat4.c at line number 218

enter image description here

Actually ARM NEON was used as multimedia rendering engine in iOS devices but now with iOS 7.0 and onwards new rendering engines(ARM ARCH 64 bit) are used.

More details can be obtained from here.

But it was really confusing for me that my Xcode project was perfectly compiled and successfully executed on my iPod Touch (5th generation) with out these modifications.Modification was needed only when i tried to archive my project to submit it on AppStore.

1
  • You seem to be mixing and matching... NEON is nearly ubiquitous with ARMv7 and ARMv8. Changing __ARM_NEON__ to _ARM_ARCH_7 seems wrong. If you have an ARM device with NEON available, then you should add -march=armv7-a -mfpu=neon to your CFLAGS and CXXFLAGS. Depending on the flags present in /proc/cpuinfo, you might be able to use -march=armv7-a -mfpu=neon-vfpv4, which should indicate VFPv4 and 32 D-registers overlapping 16 Q-registers.
    – jww
    Jul 27, 2016 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.