0

What am I missing? I am getting this error: Unknown symbolic operand name in inline assembly string.

#if defined(__MATH_NEON_64)
    int x0 = 4;
    const int* pX0 = &x0;
    asm(
    "ld1.1s {v0}, [%[x0]] \n\t"
    :"+r"(pX0) :: "memory");
#endif

EDIT: ok this compiles now.

#if defined(__MATH_NEON_64)
    int x0 = 4;
    const int* pX0 = &x0;
    asm(
    "ld1.2s {v0}, [%[x0]] \n\t"
    :[x0] "+r" (pX0) :: "v0", "memory");
#endif
  • `%[foo]` refers to an operand named `foo`, like you could name with `[foo] "+r" (pX0)`, rather than a numbered operand. IDK if you meant to write `%x0` to use an `x` modifier with `%0` (if that's a thing), or what, but you didn't name an operand `[x0]`. – Peter Cordes Dec 24 '21 at 16:48
  • Are you trying to learn inline asm? If you just want to use ARM64 SIMD, probably best to just use intrinsics instead of inline asm at all. (Unless there's a case where the compiler makes sub-optimal asm.) This is missing a clobber on `v0`, which you write without telling the compiler about. – Peter Cordes Dec 24 '21 at 16:51
  • Yes, I am trying to convert my asm code previously written for ARM32 to ARM64. I got confused on some of the syntax changes. Thanks for the replies!! – Edwin Zeng Dec 24 '21 at 16:58
  • Probably best to rewrite with intrinsics, especially if the original code had unsafe stuff like writing to `q0` without telling the compiler about it. Perhaps you were compiling without telling the compiler the CPU even had NEON? But for ARM64, SIMD registers are baseline I think, so the compiler might already be using vector regs to copy around local vars. – Peter Cordes Dec 24 '21 at 17:04
  • ok, I will have a look at the intrinsic functions. – Edwin Zeng Dec 24 '21 at 17:46

0 Answers0