mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 07:09:08 +00:00
ComputeMaskedBits: sub falls through to add, and sub doesn't have the same overflow semantics as add.
Should fix the selfhost failures that started with r127463. llvm-svn: 127465
This commit is contained in:
parent
666407939f
commit
d4ea449e7e
@ -431,7 +431,8 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
|
||||
}
|
||||
|
||||
// Are we still trying to solve for the sign bit?
|
||||
if (Mask.isNegative() && !KnownZero.isNegative() && !KnownOne.isNegative()){
|
||||
if (I->getOpcode() == Instruction::Add &&
|
||||
Mask.isNegative() && !KnownZero.isNegative() && !KnownOne.isNegative()){
|
||||
OverflowingBinaryOperator *OBO = cast<OverflowingBinaryOperator>(I);
|
||||
if (OBO->hasNoSignedWrap()) {
|
||||
// Adding two positive numbers can't wrap into negative ...
|
||||
|
@ -126,3 +126,13 @@ define void @test11(<2 x i16> %srcA, <2 x i16> %srcB, <2 x i16>* %dst) {
|
||||
; CHECK-NEXT: store <2 x i16>
|
||||
; CHECK-NEXT: ret
|
||||
}
|
||||
|
||||
define i64 @test12(i32 %x) nounwind {
|
||||
%shr = lshr i32 %x, 1
|
||||
%sub = sub nsw i32 0, %shr
|
||||
%conv = sext i32 %sub to i64
|
||||
ret i64 %conv
|
||||
; CHECK: @test12
|
||||
; CHECK: sext
|
||||
; CHECK: ret
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user