[LLVMbugs] [Bug 22936] New: __ARM_NEON not defined for cross compiling

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 17 05:53:30 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=22936

            Bug ID: 22936
           Summary: __ARM_NEON not defined for cross compiling
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yyc1992 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

It seems that `__ARM_NEON` is not defined by clang even when `-mfpu=neon` and
the correct target is used. This generate error when including `<arm_neon.h>`
but if I define `__ARM_NEON` manually, the program compiles and generate
correct code.

Native compiling on ARM seems to be fine.

Comparing to arm-linux-gnueabihf-gcc and native ARM clang, it seems that at
least `__ARM_NEON__` is also missing.

Cross compiling clang
```
% clang --target=arm-linux-gnueabihf -mfpu=neon -dM -E - < /dev/null | grep -i
neon
```

GCC
```
% arm-linux-gnueabihf-gcc -mfpu=neon -dM -E - < /dev/null | grep -i neon 
#define __ARM_NEON_FP 4
#define __ARM_NEON__ 1
#define __ARM_NEON 1
```

Native clang
```
$ clang -dM -E - < /dev/null | grep -i neon
#define __ARM_NEON 1
#define __ARM_NEON__ 1
```

Example code (taken from stackoverflow)
```
#include <arm_neon.h>

void
runTest(const float vector[], float result[])
{
    float32x4_t vA = vld1q_f32(vector);
    vA = vmulq_f32(vA, vA);
    vst1q_f32(result, vA);
}
```

A single line `#include <arm_neon.h>` is also enough to trigger the issue.

System:
clang 3.6.0 (and 3.5.0) from official ArchLinux x86_64 repo.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150317/2e13af51/attachment.html>


More information about the llvm-bugs mailing list