This is an archive of the discontinued LLVM Phabricator instance.

[x86, SSE] fold 'isPositive' vector integer operations (PR26701)
ClosedPublic

Authored by spatel on Feb 25 2016, 5:32 PM.

Details

Summary

This is one of the cases shown in:
https://llvm.org/bugs/show_bug.cgi?id=26701

Shift and negate is what InstCombine appears to prefer, so I've started with that pattern. Note that the 'pcmpeq' instructions are always generating the negative one for the actual 'pcmpgt' comparison in each case.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 49129.Feb 25 2016, 5:32 PM
spatel retitled this revision from to [x86, SSE] fold 'isPositive' vector integer operations (PR26701).
spatel updated this object.
spatel added reviewers: ab, delena, RKSimon.
spatel added a subscriber: llvm-commits.
ab accepted this revision.Feb 25 2016, 5:56 PM
ab edited edge metadata.

LGTM

lib/Target/X86/X86ISelLowering.cpp
26802 ↗(On Diff #49129)

Could this miss something crazy like v128i1, or v1i128?

This revision is now accepted and ready to land.Feb 25 2016, 5:56 PM
spatel added inline comments.Feb 26 2016, 7:39 AM
lib/Target/X86/X86ISelLowering.cpp
26802 ↗(On Diff #49129)

Nice catch. Yes, that will fail horribly for an unsupported type. I'll enumerate the types that we can handle instead. I'll also add a comment about why we do this before type legalization: the pattern is obscured by bitcasts and other stuff after legalization.

This revision was automatically updated to reflect the committed changes.