This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] exploit P9 new instruction maddld
ClosedPublic

Authored by shchenz on Feb 18 2019, 6:40 PM.

Details

Summary
typedef long long T;
T foo(T a, T b)
{
    return a*b+a;
}

on Power8 we get:

0000000000000000 <foo>:
   0:   d2 19 84 7c     mulld   r4,r4,r3
   4:   14 1a 64 7c     add     r3,r4,r3
   8:   20 00 80 4e     blr

On power9 we can fold add + mulld to maddld

Diff Detail

Repository
rL LLVM

Event Timeline

shchenz created this revision.Feb 18 2019, 6:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2019, 6:40 PM
shchenz edited the summary of this revision. (Show Details)Feb 18 2019, 6:48 PM
nemanjai accepted this revision.Feb 19 2019, 10:19 AM

LGTM once the minor nits are addressed.

llvm/lib/Target/PowerPC/PPCInstr64Bit.td
779 ↗(On Diff #187289)

Here and below, it looks like the lines are too long. Please keep them to 80 columns.

llvm/test/CodeGen/PowerPC/maddld.ll
5 ↗(On Diff #187289)

It would perhaps be nice to make one of these use 3 different registers (i.e. by taking 3 parameters).

This revision is now accepted and ready to land.Feb 19 2019, 10:19 AM
shchenz updated this revision to Diff 187484.Feb 19 2019, 6:10 PM

address comments

This revision was automatically updated to reflect the committed changes.