This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add missing pattern for VSX Scalar Negative Multiply-Subtract Single Precision
ClosedPublic

Authored by jsji on Sep 15 2019, 1:37 PM.

Details

Summary

This was found during review of https://reviews.llvm.org/D66050.
In the simple test of fdiv, we miss to fold

fneg 2, 2
xsmaddasp 3, 2, 0

to

xsnmsubasp 3, 2, 0

We have the patterns for Double Precision and vectors, just missing
Single Precision, the patch add that.

Diff Detail

Repository
rL LLVM

Event Timeline

jsji created this revision.Sep 15 2019, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2019, 1:37 PM
steven.zhang accepted this revision.Sep 26 2019, 3:15 AM

LGTM with some minor comments. Thank you for the fix.

llvm/lib/Target/PowerPC/PPCInstrVSX.td
1508 ↗(On Diff #220252)

minor comments. It would be better to write it as follows to align with "-(a*c-b);

def : Pat<(fma (fneg f32:$A), f32:$C, f32:$B),
          (XSNMSUBASP $B, $A, $C)>;
1508 ↗(On Diff #220252)

Additional XSNMSUBASP patterns ...

And It would be more clear to write it as:
XSNMSUBASP $B, $A, $C

This revision is now accepted and ready to land.Sep 26 2019, 3:15 AM
jsji updated this revision to Diff 221955.Sep 26 2019, 8:01 AM

Address Steven's comments. Thanks.

This revision was automatically updated to reflect the committed changes.