This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 2)
ClosedPublic

Authored by RKSimon on Apr 20 2016, 5:10 AM.

Details

Summary

Split from D17490. This patch improves support for determining the demanded vector elements through SSE scalar intrinsics:

1 - demanded vector element support for unary and some extra binary scalar intrinsics (RCP/RSQRT/SQRT/FRCZ and ADD/CMP/DIV/ROUND).
2 - addss/addsd get simplified to a fadd call if we aren't interested in the pass through elements
3 - if we don't need the lowest element of a scalar operation then just use the first argument (the pass through elements) directly

We can add support for propagating demanded elements through any equivalent packed SSE intrinsics in a future patch (these wouldn't use the pass through patterns).

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon updated this revision to Diff 54346.Apr 20 2016, 5:10 AM
RKSimon retitled this revision from to [InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 2).
RKSimon updated this object.
RKSimon added reviewers: majnemer, mkuper, ab, spatel.
RKSimon set the repository for this revision to rL LLVM.
RKSimon added a subscriber: llvm-commits.
RKSimon added inline comments.Apr 20 2016, 5:23 AM
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
1236 ↗(On Diff #54346)

I'm trying to work out if we need to be worried about rounding/exceptions checks for DIVSS/DIVSD - we have no equivalent packed intrinsics they always use FDIV.

spatel added inline comments.Apr 20 2016, 6:04 PM
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
1236 ↗(On Diff #54346)

How is div different than the other math ops?

RKSimon added inline comments.Apr 21 2016, 5:22 AM
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
1236 ↗(On Diff #54346)

Turns out it isn't - we can safely add the DIVSS/DIVSD -> FDIV conversion

spatel accepted this revision.Apr 21 2016, 7:32 AM
spatel edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Apr 21 2016, 7:32 AM
This revision was automatically updated to reflect the committed changes.