forked from OSchip/llvm-project
[InstCombine] add tests for min/max reassociation; NFC
D119851
This commit is contained in:
parent
c5a20b5182
commit
f150d295da
|
@ -2233,8 +2233,8 @@ define i8 @umax_umax_reassoc_constant(i8 %x, i8 %y) {
|
|||
ret i8 %m2
|
||||
}
|
||||
|
||||
define <3 x i8> @umin_smin_reassoc_constant(<3 x i8> %x, <3 x i8> %y) {
|
||||
; CHECK-LABEL: @umin_smin_reassoc_constant(
|
||||
define <3 x i8> @umin_umin_reassoc_constant(<3 x i8> %x, <3 x i8> %y) {
|
||||
; CHECK-LABEL: @umin_umin_reassoc_constant(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call <3 x i8> @llvm.umin.v3i8(<3 x i8> [[X:%.*]], <3 x i8> [[Y:%.*]])
|
||||
; CHECK-NEXT: [[M2:%.*]] = call <3 x i8> @llvm.umin.v3i8(<3 x i8> [[M1]], <3 x i8> <i8 43, i8 -43, i8 0>)
|
||||
; CHECK-NEXT: ret <3 x i8> [[M2]]
|
||||
|
@ -2257,6 +2257,63 @@ define i8 @umin_umin_reassoc_constant_use(i8 %x, i8 %y) {
|
|||
ret i8 %m2
|
||||
}
|
||||
|
||||
define i8 @smax_smax_reassoc_constant_sink(i8 %x, i8 %y) {
|
||||
; CHECK-LABEL: @smax_smax_reassoc_constant_sink(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 42)
|
||||
; CHECK-NEXT: [[M2:%.*]] = call i8 @llvm.smax.i8(i8 [[M1]], i8 [[Y:%.*]])
|
||||
; CHECK-NEXT: ret i8 [[M2]]
|
||||
;
|
||||
%m1 = call i8 @llvm.smax.i8(i8 %x, i8 42)
|
||||
%m2 = call i8 @llvm.smax.i8(i8 %m1, i8 %y)
|
||||
ret i8 %m2
|
||||
}
|
||||
|
||||
define <3 x i8> @smin_smin_reassoc_constant_sink(<3 x i8> %x, <3 x i8> %y) {
|
||||
; CHECK-LABEL: @smin_smin_reassoc_constant_sink(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call <3 x i8> @llvm.smin.v3i8(<3 x i8> [[X:%.*]], <3 x i8> <i8 43, i8 -43, i8 0>)
|
||||
; CHECK-NEXT: [[M2:%.*]] = call <3 x i8> @llvm.smin.v3i8(<3 x i8> [[M1]], <3 x i8> [[Y:%.*]])
|
||||
; CHECK-NEXT: ret <3 x i8> [[M2]]
|
||||
;
|
||||
%m1 = call <3 x i8> @llvm.smin.v3i8(<3 x i8> %x, <3 x i8> <i8 43, i8 -43, i8 0>)
|
||||
%m2 = call <3 x i8> @llvm.smin.v3i8(<3 x i8> %m1, <3 x i8> %y)
|
||||
ret <3 x i8> %m2
|
||||
}
|
||||
|
||||
define i8 @umax_umax_reassoc_constant_sink(i8 %x, i8 %y) {
|
||||
; CHECK-LABEL: @umax_umax_reassoc_constant_sink(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 42)
|
||||
; CHECK-NEXT: [[M2:%.*]] = call i8 @llvm.umax.i8(i8 [[M1]], i8 [[Y:%.*]])
|
||||
; CHECK-NEXT: ret i8 [[M2]]
|
||||
;
|
||||
%m1 = call i8 @llvm.umax.i8(i8 %x, i8 42)
|
||||
%m2 = call i8 @llvm.umax.i8(i8 %m1, i8 %y)
|
||||
ret i8 %m2
|
||||
}
|
||||
|
||||
define <3 x i8> @umin_umin_reassoc_constant_sink(<3 x i8> %x, <3 x i8> %y) {
|
||||
; CHECK-LABEL: @umin_umin_reassoc_constant_sink(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call <3 x i8> @llvm.umin.v3i8(<3 x i8> [[X:%.*]], <3 x i8> <i8 43, i8 -43, i8 0>)
|
||||
; CHECK-NEXT: [[M2:%.*]] = call <3 x i8> @llvm.umin.v3i8(<3 x i8> [[M1]], <3 x i8> [[Y:%.*]])
|
||||
; CHECK-NEXT: ret <3 x i8> [[M2]]
|
||||
;
|
||||
%m1 = call <3 x i8> @llvm.umin.v3i8(<3 x i8> %x, <3 x i8> <i8 43, i8 -43, i8 0>)
|
||||
%m2 = call <3 x i8> @llvm.umin.v3i8(<3 x i8> %m1, <3 x i8> %y)
|
||||
ret <3 x i8> %m2
|
||||
}
|
||||
|
||||
define i8 @umin_umin_reassoc_constant_sink_use(i8 %x, i8 %y) {
|
||||
; CHECK-LABEL: @umin_umin_reassoc_constant_sink_use(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 42)
|
||||
; CHECK-NEXT: call void @use(i8 [[M1]])
|
||||
; CHECK-NEXT: [[M2:%.*]] = call i8 @llvm.umin.i8(i8 [[M1]], i8 [[Y:%.*]])
|
||||
; CHECK-NEXT: ret i8 [[M2]]
|
||||
;
|
||||
%m1 = call i8 @llvm.umin.i8(i8 %x, i8 42)
|
||||
call void @use(i8 %m1)
|
||||
%m2 = call i8 @llvm.umin.i8(i8 %m1, i8 %y)
|
||||
ret i8 %m2
|
||||
}
|
||||
|
||||
define i8 @smax_smax_smax_reassoc_constants(i8 %x, i8 %y) {
|
||||
; CHECK-LABEL: @smax_smax_smax_reassoc_constants(
|
||||
; CHECK-NEXT: [[M1:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 42)
|
||||
|
|
Loading…
Reference in New Issue