mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[GlobalISel] Don't arbitrarily limit a mask to 64 bits
Reviewers: arsenm Subscribers: wdng, rovka, hiraditya, volkan, Petar.Avramovic, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72853
This commit is contained in:
parent
43278bacb4
commit
cfc365cf6e
@ -1436,9 +1436,10 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) {
|
||||
// Do the arithmetic in the larger type.
|
||||
auto NewOp = MIRBuilder.buildInstr(Opcode, {WideTy}, {LHSZext, RHSZext});
|
||||
LLT OrigTy = MRI.getType(MI.getOperand(0).getReg());
|
||||
APInt Mask = APInt::getAllOnesValue(OrigTy.getSizeInBits());
|
||||
APInt Mask =
|
||||
APInt::getLowBitsSet(WideTy.getSizeInBits(), OrigTy.getSizeInBits());
|
||||
auto AndOp = MIRBuilder.buildAnd(
|
||||
WideTy, NewOp, MIRBuilder.buildConstant(WideTy, Mask.getZExtValue()));
|
||||
WideTy, NewOp, MIRBuilder.buildConstant(WideTy, Mask));
|
||||
// There is no overflow if the AndOp is the same as NewOp.
|
||||
MIRBuilder.buildICmp(CmpInst::ICMP_NE, MI.getOperand(1), NewOp, AndOp);
|
||||
// Now trunc the NewOp to the original result.
|
||||
|
Loading…
Reference in New Issue
Block a user