forked from OSchip/llvm-project
[InstCombine] add tests to show miscompiled smin/smax; NFC
This commit is contained in:
parent
0be6fd44f3
commit
cc8f981987
|
@ -249,3 +249,51 @@ define i8 @umin_umax(i8 %x) {
|
|||
%s = select i1 %c, i8 %m, i8 126
|
||||
ret i8 %s
|
||||
}
|
||||
|
||||
define i8 @not_smax(i8 %i41, i8 %i43) {
|
||||
; CHECK-LABEL: @not_smax(
|
||||
; CHECK-NEXT: [[I46:%.*]] = sub nsw i8 [[I41:%.*]], [[I43:%.*]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smax.i8(i8 [[I46]], i8 0)
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
;
|
||||
%i44 = icmp slt i8 %i41, %i43
|
||||
%i46 = sub nsw i8 %i41, %i43
|
||||
%spec.select = select i1 %i44, i8 0, i8 %i46
|
||||
ret i8 %spec.select
|
||||
}
|
||||
|
||||
define i8 @not_smax_swap(i8 %i41, i8 %i43) {
|
||||
; CHECK-LABEL: @not_smax_swap(
|
||||
; CHECK-NEXT: [[I46:%.*]] = sub nsw i8 [[I41:%.*]], [[I43:%.*]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smax.i8(i8 [[I46]], i8 0)
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
;
|
||||
%i44 = icmp sgt i8 %i41, %i43
|
||||
%i46 = sub nsw i8 %i41, %i43
|
||||
%spec.select = select i1 %i44, i8 %i46, i8 0
|
||||
ret i8 %spec.select
|
||||
}
|
||||
|
||||
define i8 @not_smin(i8 %i41, i8 %i43) {
|
||||
; CHECK-LABEL: @not_smin(
|
||||
; CHECK-NEXT: [[I46:%.*]] = sub nsw i8 [[I41:%.*]], [[I43:%.*]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smin.i8(i8 [[I46]], i8 0)
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
;
|
||||
%i44 = icmp sgt i8 %i41, %i43
|
||||
%i46 = sub nsw i8 %i41, %i43
|
||||
%spec.select = select i1 %i44, i8 0, i8 %i46
|
||||
ret i8 %spec.select
|
||||
}
|
||||
|
||||
define i8 @not_smin_swap(i8 %i41, i8 %i43) {
|
||||
; CHECK-LABEL: @not_smin_swap(
|
||||
; CHECK-NEXT: [[I46:%.*]] = sub nsw i8 [[I41:%.*]], [[I43:%.*]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smin.i8(i8 [[I46]], i8 0)
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
;
|
||||
%i44 = icmp slt i8 %i41, %i43
|
||||
%i46 = sub nsw i8 %i41, %i43
|
||||
%spec.select = select i1 %i44, i8 %i46, i8 0
|
||||
ret i8 %spec.select
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue