<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - __ARM_NEON not defined for cross compiling"
   href="https://llvm.org/bugs/show_bug.cgi?id=22936">22936</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__ARM_NEON not defined for cross compiling
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yyc1992@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>