@@ -1030,3 +1030,115 @@ define i8 @umin_demand_and_7_8(i8 %x) {
1030
1030
%r = and i8 %m , -8
1031
1031
ret i8 %r
1032
1032
}
1033
+
1034
+ define i8 @neg_neg_nsw_smax (i8 %x , i8 %y ) {
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]])
1039
+ ; CHECK-NEXT: ret i8 [[M]]
1040
+ ;
1041
+ %nx = sub nsw i8 0 , %x
1042
+ %ny = sub nsw i8 0 , %y
1043
+ %m = call i8 @llvm.smax.i8 (i8 %nx , i8 %ny )
1044
+ ret i8 %m
1045
+ }
1046
+
1047
+ define <3 x i8 > @neg_neg_nsw_smin (<3 x i8 > %x , <3 x i8 > %y ) {
1048
+ ; 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]])
1052
+ ; CHECK-NEXT: ret <3 x i8> [[M]]
1053
+ ;
1054
+ %nx = sub nsw <3 x i8 > zeroinitializer , %x
1055
+ %ny = sub nsw <3 x i8 > zeroinitializer , %y
1056
+ %m = call <3 x i8 > @llvm.smin.v3i8 (<3 x i8 > %nx , <3 x i8 > %ny )
1057
+ ret <3 x i8 > %m
1058
+ }
1059
+
1060
+ define i8 @neg_neg_nsw_smax_use0 (i8 %x , i8 %y ) {
1061
+ ; CHECK-LABEL: @neg_neg_nsw_smax_use0(
1062
+ ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1063
+ ; 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]])
1066
+ ; CHECK-NEXT: ret i8 [[M]]
1067
+ ;
1068
+ %nx = sub nsw i8 0 , %x
1069
+ call void @use (i8 %nx )
1070
+ %ny = sub nsw i8 0 , %y
1071
+ %m = call i8 @llvm.smax.i8 (i8 %nx , i8 %ny )
1072
+ ret i8 %m
1073
+ }
1074
+
1075
+ define i8 @neg_neg_nsw_smin_use1 (i8 %x , i8 %y ) {
1076
+ ; CHECK-LABEL: @neg_neg_nsw_smin_use1(
1077
+ ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1078
+ ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1079
+ ; CHECK-NEXT: call void @use(i8 [[NY]])
1080
+ ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[NX]], i8 [[NY]])
1081
+ ; CHECK-NEXT: ret i8 [[M]]
1082
+ ;
1083
+ %nx = sub nsw i8 0 , %x
1084
+ %ny = sub nsw i8 0 , %y
1085
+ call void @use (i8 %ny )
1086
+ %m = call i8 @llvm.smin.i8 (i8 %nx , i8 %ny )
1087
+ ret i8 %m
1088
+ }
1089
+
1090
+ define i8 @neg_neg_nsw_smin_use2 (i8 %x , i8 %y ) {
1091
+ ; CHECK-LABEL: @neg_neg_nsw_smin_use2(
1092
+ ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1093
+ ; CHECK-NEXT: call void @use(i8 [[NX]])
1094
+ ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1095
+ ; CHECK-NEXT: call void @use(i8 [[NY]])
1096
+ ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[NX]], i8 [[NY]])
1097
+ ; CHECK-NEXT: ret i8 [[M]]
1098
+ ;
1099
+ %nx = sub nsw i8 0 , %x
1100
+ call void @use (i8 %nx )
1101
+ %ny = sub nsw i8 0 , %y
1102
+ call void @use (i8 %ny )
1103
+ %m = call i8 @llvm.smin.i8 (i8 %nx , i8 %ny )
1104
+ ret i8 %m
1105
+ }
1106
+
1107
+ define i8 @neg_neg_smax (i8 %x , i8 %y ) {
1108
+ ; CHECK-LABEL: @neg_neg_smax(
1109
+ ; CHECK-NEXT: [[NX:%.*]] = sub i8 0, [[X:%.*]]
1110
+ ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1111
+ ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[NX]], i8 [[NY]])
1112
+ ; CHECK-NEXT: ret i8 [[M]]
1113
+ ;
1114
+ %nx = sub i8 0 , %x
1115
+ %ny = sub nsw i8 0 , %y
1116
+ %m = call i8 @llvm.smax.i8 (i8 %nx , i8 %ny )
1117
+ ret i8 %m
1118
+ }
1119
+
1120
+ define i8 @neg_neg_smin (i8 %x , i8 %y ) {
1121
+ ; CHECK-LABEL: @neg_neg_smin(
1122
+ ; CHECK-NEXT: [[NX:%.*]] = sub i8 0, [[X:%.*]]
1123
+ ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1124
+ ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[NX]], i8 [[NY]])
1125
+ ; CHECK-NEXT: ret i8 [[M]]
1126
+ ;
1127
+ %nx = sub i8 0 , %x
1128
+ %ny = sub nsw i8 0 , %y
1129
+ %m = call i8 @llvm.smin.i8 (i8 %nx , i8 %ny )
1130
+ ret i8 %m
1131
+ }
1132
+
1133
+ define i8 @neg_neg_nsw_umin (i8 %x , i8 %y ) {
1134
+ ; CHECK-LABEL: @neg_neg_nsw_umin(
1135
+ ; CHECK-NEXT: [[NX:%.*]] = sub nsw i8 0, [[X:%.*]]
1136
+ ; CHECK-NEXT: [[NY:%.*]] = sub nsw i8 0, [[Y:%.*]]
1137
+ ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[NX]], i8 [[NY]])
1138
+ ; CHECK-NEXT: ret i8 [[M]]
1139
+ ;
1140
+ %nx = sub nsw i8 0 , %x
1141
+ %ny = sub nsw i8 0 , %y
1142
+ %m = call i8 @llvm.umin.i8 (i8 %nx , i8 %ny )
1143
+ ret i8 %m
1144
+ }
0 commit comments