[InstCombine] Add sext version of pre-commit tests for PR65852. NFC.

This commit is contained in:
Yingwei Zheng 2023-09-19 01:51:46 +08:00
parent 1645b5d321
commit d10ee8942f
No known key found for this signature in database
GPG Key ID: C05527F42C59664F

View File

@ -1256,6 +1256,227 @@ define <2 x i1> @icmp_ne_zext_eq_non_boolean_vec(<2 x i32> %a) {
ret <2 x i1> %cmp1
}
define i1 @icmp_ne_sext_eq_zero(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_zero(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, 0
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_ne_sext_ne_zero(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_ne_zero(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], 0
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, 0
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_eq_zero(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_eq_zero(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, 0
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_ne_zero(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_ne_zero(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], 0
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, 0
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_ne_sext_eq_allone(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_allone(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], -1
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, -1
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_ne_sext_ne_allone(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_ne_allone(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], -1
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, -1
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_eq_allone(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_eq_allone(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], -1
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, -1
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_ne_allone(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_ne_allone(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], -1
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, -1
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_ne_sext_eq_otherwise(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_otherwise(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], 2
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, 2
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_ne_sext_ne_otherwise(i32 %a) {
; CHECK-LABEL: @icmp_ne_sext_ne_otherwise(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], 2
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, 2
%conv = sext i1 %cmp to i32
%cmp1 = icmp ne i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_eq_otherwise(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_eq_otherwise(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A:%.*]], 2
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp eq i32 %a, 2
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define i1 @icmp_eq_sext_ne_otherwise(i32 %a) {
; CHECK-LABEL: @icmp_eq_sext_ne_otherwise(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[A:%.*]], 2
; CHECK-NEXT: [[CONV:%.*]] = sext i1 [[CMP]] to i32
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[CONV]], [[A]]
; CHECK-NEXT: ret i1 [[CMP1]]
;
%cmp = icmp ne i32 %a, 2
%conv = sext i1 %cmp to i32
%cmp1 = icmp eq i32 %conv, %a
ret i1 %cmp1
}
define <2 x i1> @icmp_ne_sext_eq_zero_vec(<2 x i32> %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_zero_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[A:%.*]], zeroinitializer
; CHECK-NEXT: [[CONV:%.*]] = sext <2 x i1> [[CMP]] to <2 x i32>
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[CONV]], [[A]]
; CHECK-NEXT: ret <2 x i1> [[CMP1]]
;
%cmp = icmp eq <2 x i32> %a, <i32 0, i32 0>
%conv = sext <2 x i1> %cmp to <2 x i32>
%cmp1 = icmp ne <2 x i32> %conv, %a
ret <2 x i1> %cmp1
}
define <2 x i1> @icmp_ne_sext_ne_zero_vec(<2 x i32> %a) {
; CHECK-LABEL: @icmp_ne_sext_ne_zero_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[A:%.*]], zeroinitializer
; CHECK-NEXT: [[CONV:%.*]] = sext <2 x i1> [[CMP]] to <2 x i32>
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[CONV]], [[A]]
; CHECK-NEXT: ret <2 x i1> [[CMP1]]
;
%cmp = icmp ne <2 x i32> %a, <i32 0, i32 0>
%conv = sext <2 x i1> %cmp to <2 x i32>
%cmp1 = icmp ne <2 x i32> %conv, %a
ret <2 x i1> %cmp1
}
define <2 x i1> @icmp_ne_sext_eq_allone_vec(<2 x i32> %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_allone_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[A:%.*]], <i32 -1, i32 -1>
; CHECK-NEXT: [[CONV:%.*]] = sext <2 x i1> [[CMP]] to <2 x i32>
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[CONV]], [[A]]
; CHECK-NEXT: ret <2 x i1> [[CMP1]]
;
%cmp = icmp eq <2 x i32> %a, <i32 -1, i32 -1>
%conv = sext <2 x i1> %cmp to <2 x i32>
%cmp1 = icmp ne <2 x i32> %conv, %a
ret <2 x i1> %cmp1
}
define <2 x i1> @icmp_ne_sext_ne_allone_vec(<2 x i32> %a) {
; CHECK-LABEL: @icmp_ne_sext_ne_allone_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[A:%.*]], <i32 -1, i32 -1>
; CHECK-NEXT: [[CONV:%.*]] = sext <2 x i1> [[CMP]] to <2 x i32>
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[CONV]], [[A]]
; CHECK-NEXT: ret <2 x i1> [[CMP1]]
;
%cmp = icmp ne <2 x i32> %a, <i32 -1, i32 -1>
%conv = sext <2 x i1> %cmp to <2 x i32>
%cmp1 = icmp ne <2 x i32> %conv, %a
ret <2 x i1> %cmp1
}
define <2 x i1> @icmp_ne_sext_eq_otherwise_vec(<2 x i32> %a) {
; CHECK-LABEL: @icmp_ne_sext_eq_otherwise_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[A:%.*]], <i32 2, i32 2>
; CHECK-NEXT: [[CONV:%.*]] = sext <2 x i1> [[CMP]] to <2 x i32>
; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i32> [[CONV]], [[A]]
; CHECK-NEXT: ret <2 x i1> [[CMP1]]
;
%cmp = icmp eq <2 x i32> %a, <i32 2, i32 2>
%conv = sext <2 x i1> %cmp to <2 x i32>
%cmp1 = icmp ne <2 x i32> %conv, %a
ret <2 x i1> %cmp1
}
!0 = !{i32 1, i32 6}
!1 = !{i32 0, i32 6}
!2 = !{i8 0, i8 1}