Juned
Juned

Reputation: 6326

How to deal with this : selected processor does not support `qadd16 r1,r1,r0'

I am developing android application and in that i am working on NDK. while compiling the files i got the error of selected processor does not support `qadd16 r1,r1,r0'. can anyone explain me why and where this error comes and how to deal with this error? Here is my code snippet of basic_op.h file

static inline Word32 L_add(register Word32 ra, register Word32 rb)
{
  Word32 out;

  __asm__("qadd %0, %1, %2"
          : "=r"(out)
          : "r"(ra), "r"(rb));

  return (out);
}

Thanks in advance

Upvotes: 2

Views: 2421

Answers (1)

Sergey K.
Sergey K.

Reputation: 25386

This happens because QADD instruction is not supported on your target architecture (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Chddhfig.html). To compile this code you need to enable arm-v7 support in NDK.

Add the line

APP_ABI := armeabi-v7a

to your Application.mk and this code will compile perfectly:

static inline unsigned int L_add(register unsigned int ra, register unsigned int rb)
{
  unsigned int out;

  __asm__("qadd %0, %1, %2"
          : "=r"(out)
          : "r"(ra), "r"(rb));

  return (out);
}

P.S. I am using Android NDK r8.

P.P.S. Why you need this ugly assembly? The output assembly listing for:

static inline unsigned int L_add(register unsigned int ra, register unsigned int rb)
{
  return (ra > 0xFFFFFFFF - rb) ? 0xFFFFFFFF : ra + rb;
}

looks still reasonably efficient and it is much more portable!

Upvotes: 5

Related Questions