ret i1 %cmp
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test17vec(<2 x i32> %x) {
+; CHECK-LABEL: @test17vec(
+; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SHL]], <i32 8, i32 8>
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %shl = shl <2 x i32> <i32 1, i32 1>, %x
+ %and = and <2 x i32> %shl, <i32 8, i32 8>
+ %cmp = icmp eq <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
define i1 @test17a(i32 %x) {
; CHECK-LABEL: @test17a(
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 %x, 2
ret i1 %cmp
}
-define i1 @test18(i32 %x) {
-; CHECK-LABEL: @test18(
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test17a_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test17a_vec(
+; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SHL]], <i32 7, i32 7>
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %shl = shl <2 x i32> <i32 1, i32 1>, %x
+ %and = and <2 x i32> %shl, <i32 7, i32 7>
+ %cmp = icmp eq <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
+define i1 @test18_eq(i32 %x) {
+; CHECK-LABEL: @test18_eq(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 %x, 3
; CHECK-NEXT: ret i1 [[CMP]]
;
ret i1 %cmp
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test18_eq_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test18_eq_vec(
+; CHECK-NEXT: [[SH:%.*]] = lshr <2 x i32> <i32 8, i32 8>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SH]], <i32 1, i32 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sh = lshr <2 x i32> <i32 8, i32 8>, %x
+ %and = and <2 x i32> %sh, <i32 1, i32 1>
+ %cmp = icmp eq <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
+define i1 @test18_ne(i32 %x) {
+; CHECK-LABEL: @test18_ne(
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 %x, 3
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %sh = lshr i32 8, %x
+ %and = and i32 %sh, 1
+ %cmp = icmp ne i32 %and, 0
+ ret i1 %cmp
+}
+
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test18_ne_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test18_ne_vec(
+; CHECK-NEXT: [[SH:%.*]] = lshr <2 x i32> <i32 8, i32 8>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SH]], <i32 1, i32 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sh = lshr <2 x i32> <i32 8, i32 8>, %x
+ %and = and <2 x i32> %sh, <i32 1, i32 1>
+ %cmp = icmp ne <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
define i1 @test19(i32 %x) {
; CHECK-LABEL: @test19(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 %x, 3
}
; FIXME: Vectors should fold the same way.
-
define <2 x i1> @test19vec(<2 x i32> %x) {
; CHECK-LABEL: @test19vec(
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, %x
ret i1 %cmp
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test20vec(<2 x i32> %x) {
+; CHECK-LABEL: @test20vec(
+; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SHL]], <i32 8, i32 8>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %shl = shl <2 x i32> <i32 1, i32 1>, %x
+ %and = and <2 x i32> %shl, <i32 8, i32 8>
+ %cmp = icmp ne <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
define i1 @test20a(i32 %x) {
; CHECK-LABEL: @test20a(
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 %x, 3
ret i1 %cmp
}
+; FIXME: Vectors should fold the same way.
+define <2 x i1> @test20a_vec(<2 x i32> %x) {
+; CHECK-LABEL: @test20a_vec(
+; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> <i32 1, i32 1>, %x
+; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[SHL]], <i32 7, i32 7>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[AND]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %shl = shl <2 x i32> <i32 1, i32 1>, %x
+ %and = and <2 x i32> %shl, <i32 7, i32 7>
+ %cmp = icmp ne <2 x i32> %and, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
define i1 @test21(i8 %x, i8 %y) {
; CHECK-LABEL: @test21(
; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 3