@@ -2581,3 +2581,92 @@ entry:
2581
2581
%val = call i8 @llvm.umin.i8 (i8 %sub , i8 3 )
2582
2582
ret i8 %val
2583
2583
}
2584
+
2585
+ define i8 @test_umax_and (i8 %x , i8 %y ) {
2586
+ ; CHECK-LABEL: @test_umax_and(
2587
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.umax.i8(i8 [[X1:%.*]], i8 [[Y1:%.*]])
2588
+ ; CHECK-NEXT: [[RES1:%.*]] = and i8 [[RES]], -64
2589
+ ; CHECK-NEXT: ret i8 [[RES1]]
2590
+ ;
2591
+ %x1 = and i8 %x , -64
2592
+ %y1 = and i8 %y , -64
2593
+ %res = call i8 @llvm.umax.i8 (i8 %x1 , i8 %y1 )
2594
+ ret i8 %res
2595
+ }
2596
+
2597
+ define i8 @test_umin_and (i8 %x , i8 %y ) {
2598
+ ; CHECK-LABEL: @test_umin_and(
2599
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.umin.i8(i8 [[X1:%.*]], i8 [[Y1:%.*]])
2600
+ ; CHECK-NEXT: [[RES1:%.*]] = and i8 [[RES]], -64
2601
+ ; CHECK-NEXT: ret i8 [[RES1]]
2602
+ ;
2603
+ %x1 = and i8 %x , -64
2604
+ %y1 = and i8 %y , -64
2605
+ %res = call i8 @llvm.umin.i8 (i8 %x1 , i8 %y1 )
2606
+ ret i8 %res
2607
+ }
2608
+
2609
+ define i8 @test_smax_and (i8 %x , i8 %y ) {
2610
+ ; CHECK-LABEL: @test_smax_and(
2611
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.smax.i8(i8 [[X1:%.*]], i8 [[Y1:%.*]])
2612
+ ; CHECK-NEXT: [[RES1:%.*]] = and i8 [[RES]], -64
2613
+ ; CHECK-NEXT: ret i8 [[RES1]]
2614
+ ;
2615
+ %x1 = and i8 %x , -64
2616
+ %y1 = and i8 %y , -64
2617
+ %res = call i8 @llvm.smax.i8 (i8 %x1 , i8 %y1 )
2618
+ ret i8 %res
2619
+ }
2620
+
2621
+ define i8 @test_smin_and (i8 %x , i8 %y ) {
2622
+ ; CHECK-LABEL: @test_smin_and(
2623
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.smin.i8(i8 [[X1:%.*]], i8 [[Y1:%.*]])
2624
+ ; CHECK-NEXT: [[RES1:%.*]] = and i8 [[RES]], -64
2625
+ ; CHECK-NEXT: ret i8 [[RES1]]
2626
+ ;
2627
+ %x1 = and i8 %x , -64
2628
+ %y1 = and i8 %y , -64
2629
+ %res = call i8 @llvm.smin.i8 (i8 %x1 , i8 %y1 )
2630
+ ret i8 %res
2631
+ }
2632
+
2633
+ define i8 @test_smin_and_mismatch (i8 %x , i8 %y ) {
2634
+ ; CHECK-LABEL: @test_smin_and_mismatch(
2635
+ ; CHECK-NEXT: [[X1:%.*]] = and i8 [[X:%.*]], -64
2636
+ ; CHECK-NEXT: [[Y1:%.*]] = and i8 [[Y:%.*]], -32
2637
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.smin.i8(i8 [[X1]], i8 [[Y1]])
2638
+ ; CHECK-NEXT: ret i8 [[RES]]
2639
+ ;
2640
+ %x1 = and i8 %x , -64
2641
+ %y1 = and i8 %y , -32
2642
+ %res = call i8 @llvm.smin.i8 (i8 %x1 , i8 %y1 )
2643
+ ret i8 %res
2644
+ }
2645
+
2646
+ define i8 @test_smin_and_non_negated_pow2 (i8 %x , i8 %y ) {
2647
+ ; CHECK-LABEL: @test_smin_and_non_negated_pow2(
2648
+ ; CHECK-NEXT: [[X1:%.*]] = and i8 [[X:%.*]], 31
2649
+ ; CHECK-NEXT: [[Y1:%.*]] = and i8 [[Y:%.*]], 31
2650
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.smin.i8(i8 [[X1]], i8 [[Y1]])
2651
+ ; CHECK-NEXT: ret i8 [[RES]]
2652
+ ;
2653
+ %x1 = and i8 %x , 31
2654
+ %y1 = and i8 %y , 31
2655
+ %res = call i8 @llvm.smin.i8 (i8 %x1 , i8 %y1 )
2656
+ ret i8 %res
2657
+ }
2658
+
2659
+ define i8 @test_smin_and_multiuse (i8 %x , i8 %y ) {
2660
+ ; CHECK-LABEL: @test_smin_and_multiuse(
2661
+ ; CHECK-NEXT: [[X1:%.*]] = and i8 [[X:%.*]], 31
2662
+ ; CHECK-NEXT: [[Y1:%.*]] = and i8 [[Y:%.*]], 31
2663
+ ; CHECK-NEXT: call void @use(i8 [[Y1]])
2664
+ ; CHECK-NEXT: [[RES:%.*]] = call i8 @llvm.smin.i8(i8 [[X1]], i8 [[Y1]])
2665
+ ; CHECK-NEXT: ret i8 [[RES]]
2666
+ ;
2667
+ %x1 = and i8 %x , 31
2668
+ %y1 = and i8 %y , 31
2669
+ call void @use (i8 %y1 )
2670
+ %res = call i8 @llvm.smin.i8 (i8 %x1 , i8 %y1 )
2671
+ ret i8 %res
2672
+ }
0 commit comments