@@ -605,56 +605,10 @@ define <2 x i8> @ashr_known_pos_exact_vec(<2 x i8> %x, <2 x i8> %y) {
605
605
ret <2 x i8 > %r
606
606
}
607
607
608
- define i32 @ashr_mul_times_3_div_2 (i32 %0 ) {
609
- ; CHECK-LABEL: @ashr_mul_times_3_div_2(
610
- ; CHECK-NEXT: [[MUL:%.*]] = mul nuw nsw i32 [[TMP0:%.*]], 3
611
- ; CHECK-NEXT: [[ASHR:%.*]] = ashr i32 [[MUL]], 1
612
- ; CHECK-NEXT: ret i32 [[ASHR]]
613
- ;
614
- %mul = mul nsw nuw i32 %0 , 3
615
- %ashr = ashr i32 %mul , 1
616
- ret i32 %ashr
617
- }
618
-
619
- define i32 @ashr_mul_times_3_div_2_exact (i32 %x ) {
620
- ; CHECK-LABEL: @ashr_mul_times_3_div_2_exact(
621
- ; CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[X:%.*]], 3
622
- ; CHECK-NEXT: [[ASHR:%.*]] = ashr exact i32 [[MUL]], 1
623
- ; CHECK-NEXT: ret i32 [[ASHR]]
624
- ;
625
- %mul = mul nsw i32 %x , 3
626
- %ashr = ashr exact i32 %mul , 1
627
- ret i32 %ashr
628
- }
629
-
630
- define i32 @mul_times_3_div_2_multiuse (i32 %x ) {
631
- ; CHECK-LABEL: @mul_times_3_div_2_multiuse(
632
- ; CHECK-NEXT: [[MUL:%.*]] = mul nuw i32 [[X:%.*]], 3
633
- ; CHECK-NEXT: [[RES:%.*]] = ashr i32 [[MUL]], 1
634
- ; CHECK-NEXT: call void @use(i32 [[MUL]])
635
- ; CHECK-NEXT: ret i32 [[RES]]
636
- ;
637
- %mul = mul nuw i32 %x , 3
638
- %res = ashr i32 %mul , 1
639
- call void @use (i32 %mul )
640
- ret i32 %res
641
- }
642
-
643
- define i32 @ashr_mul_times_3_div_2_exact_2 (i32 %x ) {
644
- ; CHECK-LABEL: @ashr_mul_times_3_div_2_exact_2(
645
- ; CHECK-NEXT: [[MUL:%.*]] = mul nuw i32 [[X:%.*]], 3
646
- ; CHECK-NEXT: [[ASHR:%.*]] = ashr exact i32 [[MUL]], 1
647
- ; CHECK-NEXT: ret i32 [[ASHR]]
648
- ;
649
- %mul = mul nuw i32 %x , 3
650
- %ashr = ashr exact i32 %mul , 1
651
- ret i32 %ashr
652
- }
653
-
654
608
define i32 @lshr_mul_times_3_div_2 (i32 %0 ) {
655
609
; CHECK-LABEL: @lshr_mul_times_3_div_2(
656
- ; CHECK-NEXT: [[MUL :%.*]] = mul nuw nsw i32 [[TMP0:%.*]], 3
657
- ; CHECK-NEXT: [[LSHR:%.*]] = lshr i32 [[MUL ]], 1
610
+ ; CHECK-NEXT: [[TMP2 :%.*]] = lshr i32 [[TMP0:%.*]], 1
611
+ ; CHECK-NEXT: [[LSHR:%.*]] = add nuw nsw i32 [[TMP2 ]], [[TMP0]]
658
612
; CHECK-NEXT: ret i32 [[LSHR]]
659
613
;
660
614
%mul = mul nsw nuw i32 %0 , 3
@@ -664,8 +618,8 @@ define i32 @lshr_mul_times_3_div_2(i32 %0) {
664
618
665
619
define i32 @lshr_mul_times_3_div_2_exact (i32 %x ) {
666
620
; CHECK-LABEL: @lshr_mul_times_3_div_2_exact(
667
- ; CHECK-NEXT: [[MUL :%.*]] = mul nsw i32 [[X:%.*]], 3
668
- ; CHECK-NEXT: [[LSHR:%.*]] = lshr exact i32 [[MUL ]], 1
621
+ ; CHECK-NEXT: [[TMP1 :%.*]] = lshr exact i32 [[X:%.*]], 1
622
+ ; CHECK-NEXT: [[LSHR:%.*]] = add nsw i32 [[TMP1 ]], [[X]]
669
623
; CHECK-NEXT: ret i32 [[LSHR]]
670
624
;
671
625
%mul = mul nsw i32 %x , 3
@@ -688,8 +642,8 @@ define i32 @mul_times_3_div_2_multiuse_lshr(i32 %x) {
688
642
689
643
define i32 @lshr_mul_times_3_div_2_exact_2 (i32 %x ) {
690
644
; CHECK-LABEL: @lshr_mul_times_3_div_2_exact_2(
691
- ; CHECK-NEXT: [[MUL :%.*]] = mul nuw i32 [[X:%.*]], 3
692
- ; CHECK-NEXT: [[LSHR:%.*]] = lshr exact i32 [[MUL ]], 1
645
+ ; CHECK-NEXT: [[TMP1 :%.*]] = lshr exact i32 [[X:%.*]], 1
646
+ ; CHECK-NEXT: [[LSHR:%.*]] = add nuw i32 [[TMP1 ]], [[X]]
693
647
; CHECK-NEXT: ret i32 [[LSHR]]
694
648
;
695
649
%mul = mul nuw i32 %x , 3
0 commit comments