@@ -1075,10 +1075,12 @@ entry:
1075
1075
call void @use (i32 %and )
1076
1076
%shr = ashr i32 %and , 31
1077
1077
ret i32 %shr
1078
+ }
1079
+
1078
1080
define i32 @ashr_shift_mul (i32 noundef %x ) {
1079
1081
; CHECK-LABEL: @ashr_shift_mul(
1080
1082
; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X:%.*]], 3
1081
- ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[A ]], 9
1083
+ ; CHECK-NEXT: [[RES:%.*]] = add i32 [[X ]], [[A]]
1082
1084
; CHECK-NEXT: ret i32 [[RES]]
1083
1085
;
1084
1086
%a = ashr exact i32 %x , 3
@@ -1088,8 +1090,8 @@ define i32 @ashr_shift_mul(i32 noundef %x) {
1088
1090
1089
1091
define i32 @ashr_shift_mul_nuw (i32 noundef %x ) {
1090
1092
; CHECK-LABEL: @ashr_shift_mul_nuw(
1091
- ; CHECK-NEXT: [[A :%.*]] = ashr exact i32 [[X:%.*]], 3
1092
- ; CHECK-NEXT: [[RES:%.*]] = mul nuw i32 [[A ]], 9
1093
+ ; CHECK-NEXT: [[TMP1 :%.*]] = lshr exact i32 [[X:%.*]], 3
1094
+ ; CHECK-NEXT: [[RES:%.*]] = add nuw i32 [[X ]], [[TMP1]]
1093
1095
; CHECK-NEXT: ret i32 [[RES]]
1094
1096
;
1095
1097
%a = ashr exact i32 %x , 3
@@ -1100,7 +1102,7 @@ define i32 @ashr_shift_mul_nuw(i32 noundef %x) {
1100
1102
define i32 @ashr_shift_mul_nsw (i32 noundef %x ) {
1101
1103
; CHECK-LABEL: @ashr_shift_mul_nsw(
1102
1104
; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X:%.*]], 3
1103
- ; CHECK-NEXT: [[RES:%.*]] = mul nsw i32 [[A ]], 9
1105
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X ]], [[A]]
1104
1106
; CHECK-NEXT: ret i32 [[RES]]
1105
1107
;
1106
1108
%a = ashr exact i32 %x , 3
@@ -1111,7 +1113,7 @@ define i32 @ashr_shift_mul_nsw(i32 noundef %x) {
1111
1113
define i32 @lshr_shift_mul_nuw (i32 noundef %x ) {
1112
1114
; CHECK-LABEL: @lshr_shift_mul_nuw(
1113
1115
; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X:%.*]], 3
1114
- ; CHECK-NEXT: [[RES:%.*]] = mul nuw i32 [[A ]], 9
1116
+ ; CHECK-NEXT: [[RES:%.*]] = add nuw i32 [[X ]], [[A]]
1115
1117
; CHECK-NEXT: ret i32 [[RES]]
1116
1118
;
1117
1119
%a = lshr exact i32 %x , 3
@@ -1122,7 +1124,7 @@ define i32 @lshr_shift_mul_nuw(i32 noundef %x) {
1122
1124
define i32 @lshr_shift_mul (i32 noundef %x ) {
1123
1125
; CHECK-LABEL: @lshr_shift_mul(
1124
1126
; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X:%.*]], 3
1125
- ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[A ]], 9
1127
+ ; CHECK-NEXT: [[RES:%.*]] = add i32 [[X ]], [[A]]
1126
1128
; CHECK-NEXT: ret i32 [[RES]]
1127
1129
;
1128
1130
%a = lshr exact i32 %x , 3
@@ -1133,7 +1135,7 @@ define i32 @lshr_shift_mul(i32 noundef %x) {
1133
1135
define i32 @lshr_shift_mul_nsw (i32 noundef %x ) {
1134
1136
; CHECK-LABEL: @lshr_shift_mul_nsw(
1135
1137
; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X:%.*]], 3
1136
- ; CHECK-NEXT: [[RES:%.*]] = mul nuw nsw i32 [[A ]], 9
1138
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X ]], [[A]]
1137
1139
; CHECK-NEXT: ret i32 [[RES]]
1138
1140
;
1139
1141
%a = lshr exact i32 %x , 3
@@ -1169,8 +1171,8 @@ define i32 @ashr_no_exact(i32 %x) {
1169
1171
1170
1172
define i32 @lshr_no_undef (i32 %x ) {
1171
1173
; CHECK-LABEL: @lshr_no_undef(
1172
- ; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X :%.*]], 3
1173
- ; CHECK-NEXT: [[RES:%.*]] = mul nuw nsw i32 [[A ]], 9
1174
+ ; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X_FR :%.*]], 3
1175
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X_FR ]], [[A]]
1174
1176
; CHECK-NEXT: ret i32 [[RES]]
1175
1177
;
1176
1178
%a = lshr exact i32 %x , 3
@@ -1180,8 +1182,8 @@ define i32 @lshr_no_undef(i32 %x) {
1180
1182
1181
1183
define i32 @ashr_no_undef (i32 %x ) {
1182
1184
; CHECK-LABEL: @ashr_no_undef(
1183
- ; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X :%.*]], 3
1184
- ; CHECK-NEXT: [[RES:%.*]] = mul nsw i32 [[A ]], 9
1185
+ ; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X_FR :%.*]], 3
1186
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X_FR ]], [[A]]
1185
1187
; CHECK-NEXT: ret i32 [[RES]]
1186
1188
;
1187
1189
%a = ashr exact i32 %x , 3
@@ -1193,7 +1195,7 @@ define i32 @lshr_multiuse(i32 noundef %x) {
1193
1195
; CHECK-LABEL: @lshr_multiuse(
1194
1196
; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X:%.*]], 3
1195
1197
; CHECK-NEXT: call void @use(i32 [[A]])
1196
- ; CHECK-NEXT: [[RES:%.*]] = mul nuw nsw i32 [[A ]], 9
1198
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X ]], [[A]]
1197
1199
; CHECK-NEXT: ret i32 [[RES]]
1198
1200
;
1199
1201
%a = lshr exact i32 %x , 3
@@ -1206,7 +1208,7 @@ define i32 @lshr_multiuse_no_flags(i32 noundef %x) {
1206
1208
; CHECK-LABEL: @lshr_multiuse_no_flags(
1207
1209
; CHECK-NEXT: [[A:%.*]] = lshr exact i32 [[X:%.*]], 3
1208
1210
; CHECK-NEXT: call void @use(i32 [[A]])
1209
- ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[A ]], 9
1211
+ ; CHECK-NEXT: [[RES:%.*]] = add i32 [[X ]], [[A]]
1210
1212
; CHECK-NEXT: ret i32 [[RES]]
1211
1213
;
1212
1214
%a = lshr exact i32 %x , 3
@@ -1219,7 +1221,7 @@ define i32 @ashr_multiuse_no_flags(i32 noundef %x) {
1219
1221
; CHECK-LABEL: @ashr_multiuse_no_flags(
1220
1222
; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X:%.*]], 3
1221
1223
; CHECK-NEXT: call void @use(i32 [[A]])
1222
- ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[A ]], 9
1224
+ ; CHECK-NEXT: [[RES:%.*]] = add i32 [[X ]], [[A]]
1223
1225
; CHECK-NEXT: ret i32 [[RES]]
1224
1226
;
1225
1227
%a = ashr exact i32 %x , 3
@@ -1232,7 +1234,7 @@ define i32 @ashr_multiuse(i32 noundef %x) {
1232
1234
; CHECK-LABEL: @ashr_multiuse(
1233
1235
; CHECK-NEXT: [[A:%.*]] = ashr exact i32 [[X:%.*]], 3
1234
1236
; CHECK-NEXT: call void @use(i32 [[A]])
1235
- ; CHECK-NEXT: [[RES:%.*]] = mul nsw i32 [[A ]], 9
1237
+ ; CHECK-NEXT: [[RES:%.*]] = add nsw i32 [[X ]], [[A]]
1236
1238
; CHECK-NEXT: ret i32 [[RES]]
1237
1239
;
1238
1240
%a = ashr exact i32 %x , 3
0 commit comments