forked from OSchip/llvm-project
[InstCombine] add tests for vector cmp-bitcast; NFC
This commit is contained in:
parent
c5d84d2eb3
commit
f3c39ee84a
|
@ -399,3 +399,110 @@ define <vscale x 2 x i1> @icmp_logical_or_scalablevec(<vscale x 2 x i64> %x, <vs
|
|||
%sel = select <vscale x 2 x i1> %cmp.ne, <vscale x 2 x i1> shufflevector (<vscale x 2 x i1> insertelement (<vscale x 2 x i1> undef, i1 true, i32 0), <vscale x 2 x i1> undef, <vscale x 2 x i32> zeroinitializer), <vscale x 2 x i1> %falseval
|
||||
ret <vscale x 2 x i1> %sel
|
||||
}
|
||||
|
||||
define i1 @eq_cast_eq-1(<2 x i4> %x, <2 x i4> %y) {
|
||||
; CHECK-LABEL: @eq_cast_eq-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp eq <2 x i4> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <2 x i1> [[NZ]] to i2
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp eq i2 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp eq <2 x i4> %x, %y
|
||||
%b = bitcast <2 x i1> %nz to i2
|
||||
%r = icmp eq i2 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @ne_cast_eq-1(<3 x i7> %x, <3 x i7> %y) {
|
||||
; CHECK-LABEL: @ne_cast_eq-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp ne <3 x i7> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x i1> [[NZ]] to i3
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp eq i3 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp ne <3 x i7> %x, %y
|
||||
%b = bitcast <3 x i1> %nz to i3
|
||||
%r = icmp eq i3 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @eq_cast_ne-1(<2 x i7> %x, <2 x i7> %y) {
|
||||
; CHECK-LABEL: @eq_cast_ne-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp eq <2 x i7> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <2 x i1> [[NZ]] to i2
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp ne i2 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp eq <2 x i7> %x, %y
|
||||
%b = bitcast <2 x i1> %nz to i2
|
||||
%r = icmp ne i2 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @ne_cast_ne-1(<3 x i5> %x, <3 x i5> %y) {
|
||||
; CHECK-LABEL: @ne_cast_ne-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp ne <3 x i5> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x i1> [[NZ]] to i3
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp ne i3 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp ne <3 x i5> %x, %y
|
||||
%b = bitcast <3 x i1> %nz to i3
|
||||
%r = icmp ne i3 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @ugt_cast_eq-1(<2 x i4> %x, <2 x i4> %y) {
|
||||
; CHECK-LABEL: @ugt_cast_eq-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp ugt <2 x i4> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <2 x i1> [[NZ]] to i2
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp eq i2 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp ugt <2 x i4> %x, %y
|
||||
%b = bitcast <2 x i1> %nz to i2
|
||||
%r = icmp eq i2 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @eq_cast_sgt-1(<3 x i4> %x, <3 x i4> %y) {
|
||||
; CHECK-LABEL: @eq_cast_sgt-1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp eq <3 x i4> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x i1> [[NZ]] to i3
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp sgt i3 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp eq <3 x i4> %x, %y
|
||||
%b = bitcast <3 x i1> %nz to i3
|
||||
%r = icmp sgt i3 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @eq_cast_eq1(<2 x i4> %x, <2 x i4> %y) {
|
||||
; CHECK-LABEL: @eq_cast_eq1(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp eq <2 x i4> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <2 x i1> [[NZ]] to i2
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp eq i2 [[B]], 1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp eq <2 x i4> %x, %y
|
||||
%b = bitcast <2 x i1> %nz to i2
|
||||
%r = icmp eq i2 %b, 1
|
||||
ret i1 %r
|
||||
}
|
||||
|
||||
define i1 @eq_cast_eq-1_use(<2 x i4> %x, <2 x i4> %y, i2* %p) {
|
||||
; CHECK-LABEL: @eq_cast_eq-1_use(
|
||||
; CHECK-NEXT: [[NZ:%.*]] = icmp sgt <2 x i4> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[B:%.*]] = bitcast <2 x i1> [[NZ]] to i2
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i2* [[P:%.*]] to <2 x i1>*
|
||||
; CHECK-NEXT: store <2 x i1> [[NZ]], <2 x i1>* [[TMP1]], align 1
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp eq i2 [[B]], -1
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%nz = icmp sgt <2 x i4> %x, %y
|
||||
%b = bitcast <2 x i1> %nz to i2
|
||||
store i2 %b, i2* %p
|
||||
%r = icmp eq i2 %b, -1
|
||||
ret i1 %r
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue