This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gcc with neon

Hi

I add a piece of code in multimedia.

It makes data in array reverse.

It works, but when I add -O2 or -O3 the result is error and vmov with -O2 ,-O3 create illegal instruction.

I don't understand...

Is this a gcc bug??

asm volatile

  (

  "pld [%0, #0xFFF];\n\t\

  vldm %0!,{d0-d3};\n\t\

  vswp.32 d0,d3;\n\t\

  vswp.32 d1,d2;\n\t\

  VREV64.32 q0, q0;\n\t\

  VREV64.32 q1, q1;\n\t\

  vstm %1!,{d0-d3};"

  :

  :"r"(data),"r"(coeff),"r"(tmp),"r"(sum),"r"(ptr)

  :"d0", "d1","d2","d3","d4","d5","d6","d7"

  );

asm volatile

  (

  "pld [%0, #0xFFF];\n\t\

  vldm %0!,{d0-d3};\n\t\

  vldm %1!,{d4-d7};\n\t\

  VMUL.I32 d0,d0,d4;\n\t\

  VMUL.I32 d1,d1,d5;\n\t\

  VMUL.I32 d2,d2,d6;\n\t\

  VMUL.I32 d3,d3,d7;\n\t\

  VADD.I32 d0,d0,d1;\n\t\

  VADD.I32 d2,d2,d3;\n\t\

  VADD.I32 d0,d0,d2;\n\t\

  VMOV %2,%3,d0;\n\t\

  add %3,%3,%2;\n\t\

  str %3,[%4]"

  :

  :"r"(data),"r"(coeff),"r"(tmp),"r"(sum),"r"(ptr)

  :"d0", "d1","d2","d3","d4","d5","d6","d7"

  );

Parents
  • Hi Ching Hsiung Yu,

    it seems to depend on the compiler version. GCC 4.3.1 could compile the code successfully. However, GCC 4.9.3 could not recognize the neon instructions. The correspondent assembler with GCC 4.9.3 could recognize those neon instructions. So you should better write the code not by the inline assembler but by the pure assembly code as jebsbauer says.

    Best regards,

    Yasuhiko Koumoto.

Reply
  • Hi Ching Hsiung Yu,

    it seems to depend on the compiler version. GCC 4.3.1 could compile the code successfully. However, GCC 4.9.3 could not recognize the neon instructions. The correspondent assembler with GCC 4.9.3 could recognize those neon instructions. So you should better write the code not by the inline assembler but by the pure assembly code as jebsbauer says.

    Best regards,

    Yasuhiko Koumoto.

Children