@@ -1033,9 +1033,8 @@ define i8 @umin_demand_and_7_8(i8 %x) {
1033
1033
1034
1034
define i8 @neg_neg_nsw_smax (i8 %x , i8 %y ) {
1035
1035
; CHECK-LABEL: @neg_neg_nsw_smax(
1036
- ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1037
- ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1038
- ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[NX]], i8 [[NY]])
1036
+ ; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1037
+ ; CHECK-NEXT: [[M:%.*]] = sub nsw i8 0, [[TMP1]]
1039
1038
; CHECK-NEXT: ret i8 [[M]]
1040
1039
;
1041
1040
%nx = sub nsw i8 0 , %x
@@ -1046,9 +1045,8 @@ define i8 @neg_neg_nsw_smax(i8 %x, i8 %y) {
1046
1045
1047
1046
define <3 x i8 > @neg_neg_nsw_smin (<3 x i8 > %x , <3 x i8 > %y ) {
1048
1047
; CHECK-LABEL: @neg_neg_nsw_smin(
1049
- ; CHECK-NEXT: [[NX:%.*]] = sub nsw <3 x i8> zeroinitializer, [[X:%.*]]
1050
- ; CHECK-NEXT: [[NY:%.*]] = sub nsw <3 x i8> zeroinitializer, [[Y:%.*]]
1051
- ; CHECK-NEXT: [[M:%.*]] = call <3 x i8> @llvm.smin.v3i8(<3 x i8> [[NX]], <3 x i8> [[NY]])
1048
+ ; CHECK-NEXT: [[TMP1:%.*]] = call <3 x i8> @llvm.smax.v3i8(<3 x i8> [[X:%.*]], <3 x i8> [[Y:%.*]])
1049
+ ; CHECK-NEXT: [[M:%.*]] = sub nsw <3 x i8> zeroinitializer, [[TMP1]]
1052
1050
; CHECK-NEXT: ret <3 x i8> [[M]]
1053
1051
;
1054
1052
%nx = sub nsw <3 x i8 > zeroinitializer , %x
@@ -1061,8 +1059,8 @@ define i8 @neg_neg_nsw_smax_use0(i8 %x, i8 %y) {
1061
1059
; CHECK-LABEL: @neg_neg_nsw_smax_use0(
1062
1060
; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1063
1061
; CHECK-NEXT: call void @use(i8 [[NX]])
1064
- ; CHECK-NEXT: [[NY :%.*]] = sub nsw i8 0, [[Y:%.*]]
1065
- ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[NX]], i8 [[NY]])
1062
+ ; CHECK-NEXT: [[TMP1 :%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y:%.*]])
1063
+ ; CHECK-NEXT: [[M:%.*]] = sub nsw i8 0, [[TMP1]]
1066
1064
; CHECK-NEXT: ret i8 [[M]]
1067
1065
;
1068
1066
%nx = sub nsw i8 0 , %x
@@ -1074,10 +1072,10 @@ define i8 @neg_neg_nsw_smax_use0(i8 %x, i8 %y) {
1074
1072
1075
1073
define i8 @neg_neg_nsw_smin_use1 (i8 %x , i8 %y ) {
1076
1074
; CHECK-LABEL: @neg_neg_nsw_smin_use1(
1077
- ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1078
1075
; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1079
1076
; CHECK-NEXT: call void @use(i8 [[NY]])
1080
- ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[NX]], i8 [[NY]])
1077
+ ; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y]])
1078
+ ; CHECK-NEXT: [[M:%.*]] = sub nsw i8 0, [[TMP1]]
1081
1079
; CHECK-NEXT: ret i8 [[M]]
1082
1080
;
1083
1081
%nx = sub nsw i8 0 , %x
@@ -1087,6 +1085,8 @@ define i8 @neg_neg_nsw_smin_use1(i8 %x, i8 %y) {
1087
1085
ret i8 %m
1088
1086
}
1089
1087
1088
+ ; negative test - too many uses
1089
+
1090
1090
define i8 @neg_neg_nsw_smin_use2 (i8 %x , i8 %y ) {
1091
1091
; CHECK-LABEL: @neg_neg_nsw_smin_use2(
1092
1092
; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
@@ -1104,6 +1104,8 @@ define i8 @neg_neg_nsw_smin_use2(i8 %x, i8 %y) {
1104
1104
ret i8 %m
1105
1105
}
1106
1106
1107
+ ; negative test - need nsw on both ops
1108
+
1107
1109
define i8 @neg_neg_smax (i8 %x , i8 %y ) {
1108
1110
; CHECK-LABEL: @neg_neg_smax(
1109
1111
; CHECK-NEXT: [[NX:%.*]] = sub i8 0, [[X:%.*]]
@@ -1117,6 +1119,8 @@ define i8 @neg_neg_smax(i8 %x, i8 %y) {
1117
1119
ret i8 %m
1118
1120
}
1119
1121
1122
+ ; negative test - need nsw on both ops
1123
+
1120
1124
define i8 @neg_neg_smin (i8 %x , i8 %y ) {
1121
1125
; CHECK-LABEL: @neg_neg_smin(
1122
1126
; CHECK-NEXT: [[NX:%.*]] = sub i8 0, [[X:%.*]]
@@ -1130,6 +1134,8 @@ define i8 @neg_neg_smin(i8 %x, i8 %y) {
1130
1134
ret i8 %m
1131
1135
}
1132
1136
1137
+ ; negative test - need signed min/max
1138
+
1133
1139
define i8 @neg_neg_nsw_umin (i8 %x , i8 %y ) {
1134
1140
; CHECK-LABEL: @neg_neg_nsw_umin(
1135
1141
; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
0 commit comments