@@ -2284,3 +2284,51 @@ define { i64, i64 } @PR57576(i64 noundef %x, i64 noundef %y, i64 noundef %z, i64
2284
2284
%r2 = insertvalue { i64 , i64 } %r1 , i64 %t2 , 1
2285
2285
ret { i64 , i64 } %r2
2286
2286
}
2287
+
2288
+ define i8 @mul_negpow2 (i8 %x , i8 %y ) {
2289
+ ; CHECK-LABEL: @mul_negpow2(
2290
+ ; CHECK-NEXT: [[M:%.*]] = mul i8 [[X:%.*]], -2
2291
+ ; CHECK-NEXT: [[A:%.*]] = add i8 [[M]], [[Y:%.*]]
2292
+ ; CHECK-NEXT: ret i8 [[A]]
2293
+ ;
2294
+ %m = mul i8 %x , -2
2295
+ %a = add i8 %m , %y
2296
+ ret i8 %a
2297
+ }
2298
+
2299
+ define <2 x i8 > @mul_negpow2_commute_vec (<2 x i8 > %x , <2 x i8 > %p ) {
2300
+ ; CHECK-LABEL: @mul_negpow2_commute_vec(
2301
+ ; CHECK-NEXT: [[Y:%.*]] = mul <2 x i8> [[P:%.*]], [[P]]
2302
+ ; CHECK-NEXT: [[M:%.*]] = mul <2 x i8> [[X:%.*]], <i8 -8, i8 -8>
2303
+ ; CHECK-NEXT: [[A:%.*]] = add <2 x i8> [[Y]], [[M]]
2304
+ ; CHECK-NEXT: ret <2 x i8> [[A]]
2305
+ ;
2306
+ %y = mul <2 x i8 > %p , %p ; thwart complexity-based canonicalization
2307
+ %m = mul <2 x i8 > %x , <i8 -8 , i8 -8 >
2308
+ %a = add <2 x i8 > %y , %m
2309
+ ret <2 x i8 > %a
2310
+ }
2311
+
2312
+ define i8 @mul_negpow2_use (i8 %x ) {
2313
+ ; CHECK-LABEL: @mul_negpow2_use(
2314
+ ; CHECK-NEXT: [[M:%.*]] = mul i8 [[X:%.*]], -2
2315
+ ; CHECK-NEXT: call void @use(i8 [[M]])
2316
+ ; CHECK-NEXT: [[A:%.*]] = add i8 [[M]], 42
2317
+ ; CHECK-NEXT: ret i8 [[A]]
2318
+ ;
2319
+ %m = mul i8 %x , -2
2320
+ call void @use (i8 %m )
2321
+ %a = add i8 %m , 42
2322
+ ret i8 %a
2323
+ }
2324
+
2325
+ define i8 @mul_not_negpow2 (i8 %x ) {
2326
+ ; CHECK-LABEL: @mul_not_negpow2(
2327
+ ; CHECK-NEXT: [[M:%.*]] = mul i8 [[X:%.*]], -3
2328
+ ; CHECK-NEXT: [[A:%.*]] = add i8 [[M]], 42
2329
+ ; CHECK-NEXT: ret i8 [[A]]
2330
+ ;
2331
+ %m = mul i8 %x , -3
2332
+ %a = add i8 %m , 42
2333
+ ret i8 %a
2334
+ }
0 commit comments