mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[InstCombine] add tests for umin/umax via usub.sat; NFC
llvm-svn: 365999
This commit is contained in:
parent
d9b989ce66
commit
fe7c6172e8
@ -1614,3 +1614,75 @@ define i32 @unsigned_sat_constant_using_min_wrong_constant(i32 %x) {
|
||||
%r = add i32 %s, -42
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
define i8 @umax(i8 %a, i8 %b) {
|
||||
; CHECK-LABEL: @umax(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
|
||||
; CHECK-NEXT: [[R:%.*]] = add i8 [[USUB]], [[B]]
|
||||
; CHECK-NEXT: ret i8 [[R]]
|
||||
;
|
||||
%usub = tail call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
|
||||
%r = add i8 %usub, %b
|
||||
ret i8 %r
|
||||
}
|
||||
|
||||
define <2 x i8> @umax_vec(<2 x i8> %a, <2 x i8> %b) {
|
||||
; CHECK-LABEL: @umax_vec(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[B:%.*]])
|
||||
; CHECK-NEXT: [[R:%.*]] = add <2 x i8> [[USUB]], [[B]]
|
||||
; CHECK-NEXT: ret <2 x i8> [[R]]
|
||||
;
|
||||
%usub = tail call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> %b)
|
||||
%r = add <2 x i8> %usub, %b
|
||||
ret <2 x i8> %r
|
||||
}
|
||||
|
||||
define i8 @umax_extra_use(i8 %a, i8 %b) {
|
||||
; CHECK-LABEL: @umax_extra_use(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
|
||||
; CHECK-NEXT: call void @use(i8 [[USUB]])
|
||||
; CHECK-NEXT: [[R:%.*]] = add i8 [[USUB]], [[B]]
|
||||
; CHECK-NEXT: ret i8 [[R]]
|
||||
;
|
||||
%usub = tail call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
|
||||
call void @use(i8 %usub)
|
||||
%r = add i8 %usub, %b
|
||||
ret i8 %r
|
||||
}
|
||||
|
||||
define i8 @umin(i8 %a, i8 %b) {
|
||||
; CHECK-LABEL: @umin(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
|
||||
; CHECK-NEXT: [[R:%.*]] = sub i8 [[A]], [[USUB]]
|
||||
; CHECK-NEXT: ret i8 [[R]]
|
||||
;
|
||||
%usub = tail call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
|
||||
%r = sub i8 %a, %usub
|
||||
ret i8 %r
|
||||
}
|
||||
|
||||
define <2 x i8> @umin_vec(<2 x i8> %a, <2 x i8> %b) {
|
||||
; CHECK-LABEL: @umin_vec(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[B:%.*]])
|
||||
; CHECK-NEXT: [[R:%.*]] = sub <2 x i8> [[A]], [[USUB]]
|
||||
; CHECK-NEXT: ret <2 x i8> [[R]]
|
||||
;
|
||||
%usub = tail call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> %b)
|
||||
%r = sub <2 x i8> %a, %usub
|
||||
ret <2 x i8> %r
|
||||
}
|
||||
|
||||
define i8 @umin_extra_use(i8 %a, i8 %b) {
|
||||
; CHECK-LABEL: @umin_extra_use(
|
||||
; CHECK-NEXT: [[USUB:%.*]] = tail call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[B:%.*]])
|
||||
; CHECK-NEXT: call void @use(i8 [[USUB]])
|
||||
; CHECK-NEXT: [[R:%.*]] = sub i8 [[A]], [[USUB]]
|
||||
; CHECK-NEXT: ret i8 [[R]]
|
||||
;
|
||||
%usub = tail call i8 @llvm.usub.sat.i8(i8 %a, i8 %b)
|
||||
call void @use(i8 %usub)
|
||||
%r = sub i8 %a, %usub
|
||||
ret i8 %r
|
||||
}
|
||||
|
||||
declare void @use(i8)
|
||||
|
Loading…
Reference in New Issue
Block a user