[X86] Attempt to fix ubsan failure.
authorCraig Topper <craig.topper@sifive.com>
Fri, 10 Feb 2023 18:02:51 +0000 (10:02 -0800)
committerCraig Topper <craig.topper@sifive.com>
Fri, 10 Feb 2023 18:02:51 +0000 (10:02 -0800)
commitd37a31cf237cb4f8a18b12c91a9204feca5900ef
tree6aed289b87d01553c6834f8ff5386c95ec762900
parent185dbf9d6f00262caa4b0e56532ab868d0ef2aa3
[X86] Attempt to fix ubsan failure.

operator~ promote the single bit input to int. The ~ will cause the upper
31 bits to become 1s making it a negative value. This is undefined for
shift.

Mask it back down to a single bit.

The extra 1s were being shifted to bit 8 and above and the they aren't
used by the emitByte call so this shouldn't be a functional change.
llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp