This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead of ZERO_EXTEND when promoting ISD::CTTZ/CTTZ_ZERO_UNDEF.
ClosedPublic

Authored by craig.topper on Feb 6 2020, 12:04 AM.

Details

Summary

For CTTZ we place a set bit just past where the non-promoted type
stopped so the extended bits won't be used for the count. For
CTTZ_ZERO_UNDEF we don't care what happens if no bits are set in
the original type and we end up counting into the extended bits.
So we can just use ANY_EXTEND for both cases.

This matches what is done in type legalization for these operations.
We make no effort to force the upper bits to zero.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 6 2020, 12:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2020, 12:04 AM
efriedma accepted this revision.Feb 7 2020, 2:09 PM

LGTM

This revision is now accepted and ready to land.Feb 7 2020, 2:09 PM
This revision was automatically updated to reflect the committed changes.