Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__ARM_NEON not defined for cross compiling #23310

Closed
yuyichao opened this issue Mar 17, 2015 · 2 comments
Closed

__ARM_NEON not defined for cross compiling #23310

yuyichao opened this issue Mar 17, 2015 · 2 comments
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" invalid Resolved as invalid, i.e. not a bug

Comments

@yuyichao
Copy link
Contributor

Bugzilla Link 22936
Resolution INVALID
Resolved on Oct 26, 2015 04:02
Version 3.6
OS Linux
CC @jmolloy

Extended Description

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.

@yuyichao
Copy link
Contributor Author

Seems that this is only available for ARMv7+ and it seems to be intended from the source code.

@jmolloy
Copy link

jmolloy commented Oct 26, 2015

Hi,

Yes, the default architecture when none is specified is ARMv4t, which does not have NEON. Specifying a -mcpu= with NEON support or -march=armv7 or later will enable NEON.

Cheers,

James

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" invalid Resolved as invalid, i.e. not a bug
Projects
None yet
Development

No branches or pull requests

2 participants