Hi, Hi, I was going through Code of LLVM instruction code generation for ARM. I came across VMLA instruction hazards (Floating point multiply and accumulate). I was comparing assembly code emitted by LLVM and GCC, where i saw that GCC was happily using VMLA instruction for floating point while LLVM never used it, instead it used a pair of VMUL and VADD instruction. I wanted to know if there is any way in which these VMLA hazards can be ignored and make LLVM to emit VMLA instructions? Is there any command line option/compiler switch/FLAG for doing this? I tried '-ffast-math' but it didn't work. -- With regards, Suyog -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131218/0f4439c1/attachment.html>
> I was going through Code of LLVM instruction code generation for ARM. I came > across VMLA instruction hazards (Floating point multiply and accumulate). I > was comparing assembly code emitted by LLVM and GCC, where i saw that GCC > was happily using VMLA instruction for floating point while LLVM never used > it, instead it used a pair of VMUL and VADD instruction.It looks like Clang allows the formation by default, but you need to be compiling for a CPU that actually supports the instruction (the key feature is called "VFPv4". That means one strictly newer than cortex-a8: cortex-a7 (don't ask), cortex-a9, cortex-a12, cortex-a15 or krait I believe. With that I get: $ cat tmp.c float foo(float accum, float lhs, float rhs) { return accum + lhs*rhs; } $ clang -target armv7-linux-gnueabihf -mcpu=cortex-a15 -S -o- -O3 tmp.c [...] foo: @ @foo @ BB#0: @ %entry vmla.f32 s0, s1, s2 bx lr Cheers. Tim.
On 18 December 2013 09:42, Tim Northover <t.p.northover at gmail.com> wrote:> That means one strictly newer than > cortex-a8: cortex-a7 (don't ask), cortex-a9, cortex-a12, cortex-a15 or > krait I believe. >Hi Tim, Cortex A8 and A9 use VFPv3. A7, A12 and A15 use VFPv4. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131218/4d77d09c/attachment.html>