This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Generalised CMP+AND1 combine to ZERO/ALLBITS+MASK
ClosedPublic

Authored by RKSimon on Mar 24 2017, 11:44 AM.

Details

Summary

Patch to generalize combinePCMPAnd1 (for handling SETCC + ZEXT cases) to work for any input that has zero/all bits set masked with an 'all low bits' mask.

Replaced the implicit assumption of shift availability with a call to SupportedVectorShiftWithImm and added support to ComputeNumSignBitsForTargetNode for SSE arithmetic shifts.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Mar 24 2017, 11:44 AM
spatel added inline comments.Mar 24 2017, 2:43 PM
lib/Target/X86/X86ISelLowering.cpp
31390–31391

There's no PCMP dependency now, so "combineAndMaskToShift()"?

test/CodeGen/X86/combine-and.ll
255–256

We should be able to remove the psraw here?

RKSimon updated this revision to Diff 93021.Mar 24 2017, 4:20 PM

Updated based on Sanjay's feedback

spatel accepted this revision.Mar 25 2017, 9:22 AM

LGTM. I'd make the VSRAI signbits part a follow-up commit for the sake of minimalism and bug bisection (if needed), but if you think it works better as one piece, that's ok too.

This revision is now accepted and ready to land.Mar 25 2017, 9:22 AM
This revision was automatically updated to reflect the committed changes.