<div dir="ltr">Hello Renato,<br><br>It turned out I just didn't do the cross-compilation correctly, and Tim Northover already pointed me to a guide you have written on it (<a href="http://clang.llvm.org/docs/CrossCompilation.html">http://clang.llvm.org/docs/CrossCompilation.html</a>), so I will read that before continuing with my efforts.<br>
<br>To answer your question I am testing on a pandaboard currently, which has an arm cortex-a9 processor, which I think is 64-bit.<br><br>I am much happy to compile the latest code and am successfully doing so. I tried to compile release 2.9, as I (wrongly) believed that I need llvm-gcc in order to compile NEON code on LLVM.<br>
<br>Tim's minimalist example worked on my clang3.4:<br><br><span style="font-family:arial,sans-serif;font-size:13px">$ cat > neon.c</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">#include <arm_neon.h></span><br style="font-family:arial,sans-serif;font-size:13px">
<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">float32x4_t my_func(float32x4_t lhs, float32x4_t rhs) {</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">  return vaddq_f32(lhs, rhs);</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">}</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">$ clang --target=arm-linux-gnueabihf -mcpu=cortex-a15 -ffreestanding</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">-O3 -S -o - neon.c<br>
</span><br>however it doesn't if I remove the -ffreestanding flag. I need to figure this out next.<br><br>Thank you for your help.<br><br>Cheers,<div> - Stan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Sep 26, 2013 at 4:01 PM, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div dir="ltr"><div class="im">On 26 September 2013 12:22, Stanislav Manilov <span dir="ltr"><<a href="mailto:S.Z.Manilov@sms.ed.ac.uk" target="_blank">S.Z.Manilov@sms.ed.ac.uk</a>></span> wrote:<br>
</div><div class="gmail_extra">
<div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>In the process I found out that clang doesn't support NEON (as per <a href="http://blog.llvm.org/2010/04/arm-advanced-simd-neon-intrinsics-and.html" target="_blank">http://blog.llvm.org/2010/04/arm-advanced-simd-neon-intrinsics-and.html</a>), but there
 has been at least some effort in adding it (<a href="https://www.codeaurora.org/patches/quic/llvm/32040/clang-Initial-Neon-support.patch" target="_blank">https://www.codeaurora.org/patches/quic/llvm/32040/clang-Initial-Neon-support.patch</a>).<br>

</div>
</div>
</blockquote>
<div><br>
</div>
</div><div>Hi Stanislav,</div>
<div><br>
</div>
<div>LLVM does support NEON on ARM32 for a very long time. The commit you're referring is about AArch64, and yes, support for ARM64 NEON is patchy at the moment, but it's progressing quite quickly. What back-end are you trying to use? 32-bits or 64-bits?</div>
<div class="im">
<div><br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>I also tried compiling LLVM 2.9 + llvm-gcc but that failed too many times and I gave up. After some discussions with colleagues (notably Alberto Magni, who added OpenCL support to clang some time ago <a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-November/012293.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-November/012293.html</a>)
 my current plan is to implement the ARM NEON intrinsics as a shared library, using attributes as in:<br>
</div>
</div>
</blockquote>
<div><br>
</div>
</div><div>LLVM 2.9 is really old, and llvm-gcc is discontinued, so I wouldn't even try that. If you don't want to use trunk, I recommend you to use LLVM with Clang 3.3 and see what you get.</div><div class="im">

<div><br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>typedef float float4 __attribute__((ext_vector_type(4)));</div>
<div>or if that doesn't work, I will try to implement the intrinsics in clang itself (not sure this is the best way of doing it).<br>
</div>
<div>Ideally, I want to be able to compile C code that includes ARM NEON intrinsics to other targets (TI processors, e.g.).<br>
</div>
</div>
</blockquote>
<div></div>
</div></div>
<br>
</div>
<div class="gmail_extra">So, if I get it right, you have a file with ARM NEON intrinsics (the ones defined in arm_neon.h) and passed it through LLVM 2.9 with LLVM-GCC front-end and failed.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">As of 2010, LLVM can compile every single NEON instruction, but you should use LLVM's own version of arm_neon.h, since the type definitions do vary between toolchains. In the end, they amount to the same thing on each toolchain, but
 their representation can be different.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">I suggest you try with Clang 3.3 and if that fails, we'll start from there.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">cheers,</div>
<div class="gmail_extra">--renato</div>
</div>
</div>

</blockquote></div><br></div>