This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't combine (x86cmp (trunc (movmsk (bitcast X))), 0) if the truncate discards bits.
ClosedPublic

Authored by craig.topper on Nov 19 2021, 7:11 PM.

Details

Summary

We have transform that tries turn a pmovmskb into movmskps/pd or
movmskps to movmskpd. This transform isn't valid if the truncate
discarded bits that might be set by the original movmsk.

We could fix this by inserting an AND after the new movmsk to discard
the equivalent of the truncated bits, but I've left that for later
patch.

Fixes PR52567.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 19 2021, 7:11 PM
craig.topper requested review of this revision.Nov 19 2021, 7:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 7:12 PM
pengfei accepted this revision.Nov 19 2021, 7:51 PM

LGTM.

This revision is now accepted and ready to land.Nov 19 2021, 7:51 PM
This revision was landed with ongoing or failed builds.Nov 19 2021, 9:51 PM
This revision was automatically updated to reflect the committed changes.

Nice catch!