Type *Ty = Op0->getType();
// icmp's with boolean values can always be turned into bitwise operations
- if (Ty->isIntegerTy(1)) {
+ if (Ty->getScalarType()->isIntegerTy(1)) {
switch (I.getPredicate()) {
default: llvm_unreachable("Invalid icmp instruction!");
case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B)
define <3 x i1> @test19vec2(<3 x i1> %X) {
; CHECK-LABEL: @test19vec2(
-; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq <3 x i1> %X, zeroinitializer
+; CHECK-NEXT: [[CMPEQ:%.*]] = xor <3 x i1> %X, <i1 true, i1 true, i1 true>
; CHECK-NEXT: ret <3 x i1> [[CMPEQ]]
;
%sext = sext <3 x i1> %X to <3 x i32>
ret i1 %C
}
-; FIXME: Vectors should fold the same as scalars.
define <2 x i1> @test13vec(<2 x i1> %A, <2 x i1> %B) {
; CHECK-LABEL: @test13vec(
-; CHECK-NEXT: [[C:%.*]] = icmp uge <2 x i1> %A, %B
+; CHECK-NEXT: [[CTMP:%.*]] = xor <2 x i1> %B, <i1 true, i1 true>
+; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[CTMP]], %A
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%C = icmp uge <2 x i1> %A, %B
ret i1 %C
}
-; FIXME: Vectors should fold the same as scalars.
define <3 x i1> @test14vec(<3 x i1> %A, <3 x i1> %B) {
; CHECK-LABEL: @test14vec(
-; CHECK-NEXT: [[C:%.*]] = icmp eq <3 x i1> %A, %B
+; CHECK-NEXT: [[CTMP:%.*]] = xor <3 x i1> %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[CTMP]], <i1 true, i1 true, i1 true>
; CHECK-NEXT: ret <3 x i1> [[C]]
;
%C = icmp eq <3 x i1> %A, %B