This is an archive of the discontinued LLVM Phabricator instance.

[X86][MMX] Add support for MMX build vectors (PR29222)
ClosedPublic

Authored by RKSimon on Feb 22 2018, 6:28 AM.

Details

Summary

64-bit MMX vector generation usually ends up lowering into SSE instructions before being spilled/reloaded as a MMX type.

This patch creates a MMX vector from MMX source values, taking the lowest element from each source and constructing broadcasts/build_vectors with direct calls to the MMX PUNPCKL/PSHUFW intrinsics.

We're missing a few consecutive load combines that could be handled in a future patch if that would be useful - my main interest here is avoid SSE usage.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Feb 22 2018, 6:28 AM
efriedma added inline comments.
lib/Target/X86/X86ISelLowering.h
164 ↗(On Diff #135410)

Overloading a node based purely on the number of operands is confusing.

Could we just generate calls to the relevant MMX intrinsics instead?

RKSimon added inline comments.Feb 22 2018, 1:48 PM
lib/Target/X86/X86ISelLowering.h
164 ↗(On Diff #135410)

Those intrinsics were removed a long time ago - the remnants are converted to generic IR straight away in CGBuiltin.cpp.

efriedma added inline comments.Feb 22 2018, 2:32 PM
lib/Target/X86/X86ISelLowering.h
164 ↗(On Diff #135410)

"int_x86_mmx_punpckldq" still exists, as far as I can tell?

RKSimon added inline comments.Feb 22 2018, 2:37 PM
lib/Target/X86/X86ISelLowering.h
164 ↗(On Diff #135410)

Sorry - misunderstood, I'll see what I can do

RKSimon updated this revision to Diff 136983.Mar 5 2018, 5:53 AM
RKSimon edited the summary of this revision. (Show Details)
RKSimon added a reviewer: efriedma.

Create MMX build vectors from intrinsics instead of relying on new DAG opcodes.

craig.topper added inline comments.Mar 11 2018, 11:09 AM
lib/Target/X86/X86ISelLowering.cpp
30863 ↗(On Diff #136983)

Why does this require 64-bit?

30865 ↗(On Diff #136983)

Should this be SCALAR_TO_VECTOR?

RKSimon added inline comments.Mar 11 2018, 11:19 AM
lib/Target/X86/X86ISelLowering.cpp
30863 ↗(On Diff #136983)

I think it was just because we still make a mess of elts from consecutive loads for MMX and that messes with float args on i686 - I'll relax it and see what happens.

30865 ↗(On Diff #136983)

Yes, it should be.

RKSimon updated this revision to Diff 137949.Mar 11 2018, 11:55 AM

Fixed Craig's comments

This revision is now accepted and ready to land.Mar 11 2018, 12:03 PM
This revision was automatically updated to reflect the committed changes.