forked from OSchip/llvm-project
[InstCombine] Turn subtract of vectors of i1 into xor like we do for scalar i1. Matches what we already do for add.
llvm-svn: 299472
This commit is contained in:
parent
f58991b7a4
commit
c745b6a1f6
|
@ -1563,7 +1563,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
|||
return Res;
|
||||
}
|
||||
|
||||
if (I.getType()->isIntegerTy(1))
|
||||
if (I.getType()->getScalarType()->isIntegerTy(1))
|
||||
return BinaryOperator::CreateXor(Op0, Op1);
|
||||
|
||||
// Replace (-1 - A) with (~A).
|
||||
|
|
|
@ -744,3 +744,12 @@ define i32 @test52(i32 %X) {
|
|||
%res = and i32 %sub, 127
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define <2 x i1> @test53(<2 x i1> %A, <2 x i1> %B) {
|
||||
%sub = sub <2 x i1> %A, %B
|
||||
ret <2 x i1> %sub
|
||||
; CHECK-LABEL: @test53(
|
||||
; CHECK-NEXT: %sub = xor <2 x i1> %A, %B
|
||||
; CHECK-NEXT: ret <2 x i1> %sub
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue