mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[InstSimplify] add tests for icmp with partial undef constant; NFC
This commit is contained in:
parent
0769122e0b
commit
d72f79b2c4
@ -19,6 +19,15 @@ define <2 x i1> @tautological_ule_vec(<2 x i8> %x) {
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define <2 x i1> @tautological_ule_vec_partial_undef(<2 x i8> %x) {
|
||||
; CHECK-LABEL: @tautological_ule_vec_partial_undef(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ule <2 x i8> [[X:%.*]], <i8 -1, i8 undef>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%cmp = icmp ule <2 x i8> %x, <i8 255, i8 undef>
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define i1 @tautological_ugt(i8 %x) {
|
||||
; CHECK-LABEL: @tautological_ugt(
|
||||
; CHECK-NEXT: ret i1 false
|
||||
@ -35,6 +44,15 @@ define <2 x i1> @tautological_ugt_vec(<2 x i8> %x) {
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define <2 x i1> @tautological_ugt_vec_partial_undef(<2 x i8> %x) {
|
||||
; CHECK-LABEL: @tautological_ugt_vec_partial_undef(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i8> [[X:%.*]], <i8 undef, i8 -1>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%cmp = icmp ugt <2 x i8> %x, <i8 undef, i8 255>
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
; 'urem x, C2' produces [0, C2)
|
||||
define i1 @urem3(i32 %X) {
|
||||
; CHECK-LABEL: @urem3(
|
||||
@ -54,6 +72,17 @@ define <2 x i1> @urem3_vec(<2 x i32> %X) {
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
define <2 x i1> @urem3_vec_partial_undef(<2 x i32> %X) {
|
||||
; CHECK-LABEL: @urem3_vec_partial_undef(
|
||||
; CHECK-NEXT: [[A:%.*]] = urem <2 x i32> [[X:%.*]], <i32 10, i32 10>
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp ult <2 x i32> [[A]], <i32 undef, i32 15>
|
||||
; CHECK-NEXT: ret <2 x i1> [[B]]
|
||||
;
|
||||
%A = urem <2 x i32> %X, <i32 10, i32 10>
|
||||
%B = icmp ult <2 x i32> %A, <i32 undef, i32 15>
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
;'srem x, C2' produces (-|C2|, |C2|)
|
||||
define i1 @srem1(i32 %X) {
|
||||
; CHECK-LABEL: @srem1(
|
||||
@ -73,6 +102,17 @@ define <2 x i1> @srem1_vec(<2 x i32> %X) {
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
define <2 x i1> @srem1_vec_partial_undef(<2 x i32> %X) {
|
||||
; CHECK-LABEL: @srem1_vec_partial_undef(
|
||||
; CHECK-NEXT: [[A:%.*]] = srem <2 x i32> [[X:%.*]], <i32 -5, i32 -5>
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp sgt <2 x i32> [[A]], <i32 5, i32 undef>
|
||||
; CHECK-NEXT: ret <2 x i1> [[B]]
|
||||
;
|
||||
%A = srem <2 x i32> %X, <i32 -5, i32 -5>
|
||||
%B = icmp sgt <2 x i32> %A, <i32 5, i32 undef>
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
;'udiv C2, x' produces [0, C2]
|
||||
define i1 @udiv5(i32 %X) {
|
||||
; CHECK-LABEL: @udiv5(
|
||||
@ -169,6 +209,17 @@ define <2 x i1> @shl5_vec(<2 x i32> %X) {
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
define <2 x i1> @shl5_vec_partial_undef(<2 x i32> %X) {
|
||||
; CHECK-LABEL: @shl5_vec_partial_undef(
|
||||
; CHECK-NEXT: [[SUB:%.*]] = shl nuw <2 x i32> <i32 4, i32 4>, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[SUB]], <i32 undef, i32 3>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%sub = shl nuw <2 x i32> <i32 4, i32 4>, %X
|
||||
%cmp = icmp ugt <2 x i32> %sub, <i32 undef, i32 3>
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
; 'shl nsw C2, x' produces [C2 << CLO(C2)-1, C2]
|
||||
define i1 @shl2(i32 %X) {
|
||||
; CHECK-LABEL: @shl2(
|
||||
@ -378,6 +429,17 @@ define <2 x i1> @or1_vec(<2 x i32> %X) {
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
define <2 x i1> @or1_vec_partial_undef(<2 x i32> %X) {
|
||||
; CHECK-LABEL: @or1_vec_partial_undef(
|
||||
; CHECK-NEXT: [[A:%.*]] = or <2 x i32> [[X:%.*]], <i32 62, i32 62>
|
||||
; CHECK-NEXT: [[B:%.*]] = icmp ult <2 x i32> [[A]], <i32 undef, i32 50>
|
||||
; CHECK-NEXT: ret <2 x i1> [[B]]
|
||||
;
|
||||
%A = or <2 x i32> %X, <i32 62, i32 62>
|
||||
%B = icmp ult <2 x i32> %A, <i32 undef, i32 50>
|
||||
ret <2 x i1> %B
|
||||
}
|
||||
|
||||
; Single bit OR.
|
||||
define i1 @or2_true(i8 %x) {
|
||||
; CHECK-LABEL: @or2_true(
|
||||
|
Loading…
Reference in New Issue
Block a user