[PATCH] [AArch64] Select lower fsub,fabs pattern to fabd on AArch64

Karthik Bhat kv.bhat at samsung.com
Sun Dec 28 23:48:59 PST 2014


Hi t.p.northover, jmolloy,

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

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6791

Files:
  lib/Target/AArch64/AArch64InstrInfo.td
  test/CodeGen/AArch64/arm64-fabd.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6791.17665.patch
Type: text/x-patch
Size: 4183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141229/0ad4982f/attachment.bin>


More information about the llvm-commits mailing list