[X86] Don't combine (x86cmp (trunc (movmsk (bitcast X))), 0) if the truncate discards...
authorCraig Topper <craig.topper@sifive.com>
Sat, 20 Nov 2021 03:05:10 +0000 (19:05 -0800)
committerCraig Topper <craig.topper@sifive.com>
Sat, 20 Nov 2021 05:50:35 +0000 (21:50 -0800)
commita4373f6753fa9aa89d39fbd4ec9e273f76459a58
treeb7e1959b39875f624a1422d3de230e57c1f0ad21
parent1cb991e754053ce2b5d551eb6c1a0ce759ab381e
[X86] Don't combine (x86cmp (trunc (movmsk (bitcast X))), 0) if the truncate discards unknown bits.

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.

Differential Revision: https://reviews.llvm.org/D114306
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pr52567.ll