Hi,
Similar to http://reviews.llvm.org/D6781 we can select lower fsub, fabs pattern to fabd on AArch64.
Add pattern matching in .td file to handle the same.
For example for the below code -
float a[4],b[4],c[4]; void fabd_test() { a[0] = fabs(b[0]-c[0]); a[1] = fabs(b[1]-c[1]); a[2] = fabs(b[2]-c[2]); a[3] = fabs(b[3]-c[3]); }
gcc produces a single
fabd v0.4s, v1.4s, v0.4s
instead of
fsub v0.4s, v0.4s, v1.4s fabs v0.4s, v0.4s
which was previously produced by clang. After this patch we are able to lower fsub fabs to fabd.
This is also valid for scalar operands in case of fabd.
Please let me know if this is good to commit.
Thanks and Regards
Karthik Bhat