Skip to content

Commit

Permalink
[InstCombine] add tests for vector icmp with undef constant elements;…
Browse files Browse the repository at this point in the history
… NFC
  • Loading branch information
rotateright committed Jan 2, 2020
1 parent f533fa3 commit 4bb4f5b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
Expand Up @@ -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.
; ============================================================================ ;
Expand Down
Expand Up @@ -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.
; ============================================================================ ;
Expand Down
Expand Up @@ -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.
; ============================================================================ ;
Expand Down
Expand Up @@ -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.
; ============================================================================ ;
Expand Down
Expand Up @@ -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.
; ============================================================================ ;
Expand Down

0 comments on commit 4bb4f5b

Please sign in to comment.