GCC to retrieve ARM idiv instructions (continued)

I am wondering if this is possible for the Krait 400 processor. I followed some suggestions here

When I compile with mcpu = cortexa15, then the code compiles and effectively I see the udiv commands in the build dump.

However, I would like to know:

  • Is it possible to make it work with the march = armv7-a? (without specifying the processor, since I originally had it)
  • I tried to use mcpu = krait2, but since I am not using snapdragon llvm (I still do not know how much effort this will be), he will not recognize it. Is it possible to get the cpu definition from llvm and somehow make it available to my compiler?
  • Any other method / patch / trick?

My compiler options are as follows:

 /development/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc  -DANDROID -DNEON -fexceptions -Wno-psabi --sysroot=/development/android-ndk-r8e/platforms/android-14/arch-arm -fpic -funwind-tables -funswitch-loops -finline-limit=300 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack  -marm -fomit-frame-pointer -fstrict-aliasing -O3 -DNDEBUG

The error I get is:

Error: selected processor does not support ARM mode `udiv r1,r1,r3'

, , , , , .

.

1:

, udiv. -mcpu = cortex-a15 arameter, -march = armv7-a. (- ), . , tring inline , . Snapdragon, , , . .

+3
1

idiv - , sdiv, udiv - Cortex-A. Cortex-A ID_ISAR0 cp15 [27:24].

  /* Get idiv support. */
  unsigned int ISAR0;
  int idiv;
  __asm ("mrc 15, 0, %0, c0, c2, 0" :"=r" (ISAR0));
#ifdef __thumb2__
  idiv = (ISAR0 & 0xf000000UL) ? 1 : 0;
#else
  idiv = (ISAR0 & 0xf000000UL) == 0x2000000UL ? 1 : 0;
#endif

[27:24] 0001, thumb2 udiv sdiv. [27:24] 0010, .

gcc flags -march=armv7-a .. , ALL , , gcc .

,

gcc -march=armv7-a -o general.o -c general.c 
gcc -mcpu=cortex-a15 -D_USE_IDIV_=1 -o fast_idiv.o -c fast_div.c 

, . , ,

  #include "fir_template.def"

#ifdef _USE_IDIV_
  #define _FUNC(x) idiv_ ## x
#else
  #define _FUNC(x) x
#endif

int _FUNC(fir8)(FILTER8 *filter, SAMPLE *data,)
{
   ....
}

, Cortex-a15, -mcpu. , IF, ( armv7-a), CPU, , .

: (general.c fast_idiv.c) API. /proc/cpuinfo , idiv. LD_LIBRARY_PATH ( dlopen()) . , .

+3

All Articles