Commit 4bb4f5b1 authored by Sanjay Patel's avatar Sanjay Patel
Browse files

[InstCombine] add tests for vector icmp with undef constant elements; NFC

parent f533fa3a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -90,6 +90,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
  ret <3 x i1> %ret
}

define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
; CHECK-LABEL: @p3_vec_nonsplat_undef(
; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt <3 x i8> [[X:%.*]], <i8 -1, i8 undef, i8 3>
; CHECK-NEXT:    ret <3 x i1> [[TMP1]]
;
  %tmp0 = and <3 x i8> %x, <i8 -1, i8 undef, i8 3>
  %ret = icmp ne <3 x i8> %tmp0, %x
  ret <3 x i1> %ret
}

; ============================================================================ ;
; Commutativity tests.
; ============================================================================ ;
+12 −0
Original line number Diff line number Diff line
@@ -85,6 +85,18 @@ define <3 x i1> @p3_vec_splat_undef() {
  ret <3 x i1> %ret
}

define <3 x i1> @p3_vec_nonsplat_undef() {
; CHECK-LABEL: @p3_vec_nonsplat_undef(
; CHECK-NEXT:    [[X:%.*]] = call <3 x i8> @gen3x8()
; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt <3 x i8> [[X]], <i8 15, i8 3, i8 undef>
; CHECK-NEXT:    ret <3 x i1> [[TMP1]]
;
  %x = call <3 x i8> @gen3x8()
  %tmp0 = and <3 x i8> %x, <i8 15, i8 3, i8 undef>
  %ret = icmp sgt <3 x i8> %x, %tmp0
  ret <3 x i1> %ret
}

; ============================================================================ ;
; One-use tests. We don't care about multi-uses here.
; ============================================================================ ;
+10 −0
Original line number Diff line number Diff line
@@ -69,6 +69,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
  ret <3 x i1> %ret
}

define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
; CHECK-LABEL: @p3_vec_nonsplat_undef(
; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt <3 x i8> [[X:%.*]], <i8 undef, i8 15, i8 3>
; CHECK-NEXT:    ret <3 x i1> [[TMP1]]
;
  %tmp0 = and <3 x i8> %x, <i8 undef, i8 15, i8 3>
  %ret = icmp slt <3 x i8> %tmp0, %x
  ret <3 x i1> %ret
}

; ============================================================================ ;
; One-use tests. We don't care about multi-uses here.
; ============================================================================ ;
+12 −0
Original line number Diff line number Diff line
@@ -108,6 +108,18 @@ define <3 x i1> @p3_vec_splat_undef() {
  ret <3 x i1> %ret
}

define <3 x i1> @p3_vec_nonsplat_undef() {
; CHECK-LABEL: @p3_vec_nonsplat_undef(
; CHECK-NEXT:    [[X:%.*]] = call <3 x i8> @gen3x8()
; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt <3 x i8> [[X]], <i8 3, i8 undef, i8 15>
; CHECK-NEXT:    ret <3 x i1> [[TMP1]]
;
  %x = call <3 x i8> @gen3x8()
  %tmp0 = and <3 x i8> %x, <i8 3, i8 undef, i8 15>
  %ret = icmp ugt <3 x i8> %x, %tmp0
  ret <3 x i1> %ret
}

; ============================================================================ ;
; Commutativity tests.
; ============================================================================ ;
+10 −0
Original line number Diff line number Diff line
@@ -91,6 +91,16 @@ define <3 x i1> @p3_vec_splat_undef(<3 x i8> %x) {
  ret <3 x i1> %ret
}

define <3 x i1> @p3_vec_nonsplat_undef(<3 x i8> %x) {
; CHECK-LABEL: @p3_vec_nonsplat_undef(
; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt <3 x i8> [[X:%.*]], <i8 7, i8 31, i8 undef>
; CHECK-NEXT:    ret <3 x i1> [[TMP1]]
;
  %tmp0 = and <3 x i8> %x, <i8 7, i8 31, i8 undef>
  %ret = icmp ult <3 x i8> %tmp0, %x
  ret <3 x i1> %ret
}

; ============================================================================ ;
; Commutativity tests.
; ============================================================================ ;