[PATCH][AARCH64] Fixed fused multiply add/sub patterns

Ana Pazos apazos at codeaurora.org
Wed Dec 18 11:56:34 PST 2013

Hello Tim and reviewers,


1)      Bug issue: fnmadd and fnmsub patterns are switched in the current
code in AArch64InstInfo.td


-   fnmadd is (-Ra) + (-Rn)*Rm  which should be matched as:


                fma (fneg node:$Rn),  node:$Rm, (fneg node:$Ra) and as


                (f32 (fsub (f32 (fneg FPR32:$Ra)), (f32 (fmul_su FPR32:$Rn,


-   fnmsub is (-Ra) + Rn*Rm which should be matched as 


     fma node:$Rn,  node:$Rm, (fneg node:$Ra) and as


                (f32 (fsub (f32 (fmul_su FPR32:$Rn, FPR32:$Rm)),



2)      Performance issue: In the current code we allow matching patterns
like (fadd(fmul)) to create fused multiply add/sub instructions.

In ARM we saw that this caused the multiply operation to be repeated many
times which affected performance.

So in ARM the pattern is only matched if fmul has a single use.

AArch64 targets most probably have one MAC pipe and this will be a
performance issue as well.


Let me know if you agree with both changes.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131218/17a448b7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fixed-fused-multiply-add-sub-patterns.patch
Type: application/octet-stream
Size: 10552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131218/17a448b7/attachment.obj>

More information about the llvm-commits mailing list