This is an archive of the discontinued LLVM Phabricator instance.

ARM: Add missing selection patterns for vnmla
ClosedPublic

Authored by gergo- on Jul 26 2017, 1:32 PM.

Details

Summary

(This is my first patch to LLVM. Let me know if there's anything I could improve.)

For the following function:

double fn1(double d0, double d1, double d2) {
  double a = -d0 - d1 * d2;
  return a;
}

on ARM, LLVM generates code along the lines of

	vneg.f64	d0, d0
	vmls.f64	d0, d1, d2

i.e., a negate and a multiply-subtract. The attached patch adds instruction selection patterns to allow it to generate the single instruction

	vnmla.f64	d0, d1, d2

(multiply-add with negation) instead, like GCC does.

Diff Detail

Repository
rL LLVM

Event Timeline

gergo- created this revision.Jul 26 2017, 1:32 PM
fhahn added a subscriber: fhahn.Aug 4 2017, 7:18 AM
RKSimon added a subscriber: RKSimon.

Makes sense to me, but the ARM guys should take a look

efriedma accepted this revision.Sep 19 2017, 2:16 PM

Yes, LGTM.

This revision is now accepted and ready to land.Sep 19 2017, 2:16 PM
RKSimon edited edge metadata.Sep 22 2017, 1:38 AM

@gergo- Do you have access rights to commit this?

No, I have no commit rights, someone else will have to commit.

This revision was automatically updated to reflect the committed changes.