File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
llvm/test/Transforms/InstCombine Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -857,3 +857,31 @@ define i1 @mul_of_pow2_no_lz_other_op(i32 %x, i8 %y) {
857857 %r = icmp sgt i32 %m , 254
858858 ret i1 %r
859859}
860+
861+ define i1 @splat_mul_known_lz (i32 %x ) {
862+ ; CHECK-LABEL: @splat_mul_known_lz(
863+ ; CHECK-NEXT: [[Z:%.*]] = zext i32 [[X:%.*]] to i128
864+ ; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i128 [[Z]], 18446744078004518913
865+ ; CHECK-NEXT: [[R:%.*]] = icmp ult i128 [[M]], 79228162514264337593543950336
866+ ; CHECK-NEXT: ret i1 [[R]]
867+ ;
868+ %z = zext i32 %x to i128
869+ %m = mul i128 %z , 18446744078004518913 ; 0x00000000_00000001_00000001_00000001
870+ %s = lshr i128 %m , 96
871+ %r = icmp eq i128 %s , 0
872+ ret i1 %r
873+ }
874+
875+ define i1 @splat_mul_unknown_lz (i32 %x ) {
876+ ; CHECK-LABEL: @splat_mul_unknown_lz(
877+ ; CHECK-NEXT: [[Z:%.*]] = zext i32 [[X:%.*]] to i128
878+ ; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i128 [[Z]], 18446744078004518913
879+ ; CHECK-NEXT: [[R:%.*]] = icmp ult i128 [[M]], 39614081257132168796771975168
880+ ; CHECK-NEXT: ret i1 [[R]]
881+ ;
882+ %z = zext i32 %x to i128
883+ %m = mul i128 %z , 18446744078004518913 ; 0x00000000_00000001_00000001_00000001
884+ %s = lshr i128 %m , 95
885+ %r = icmp eq i128 %s , 0
886+ ret i1 %r
887+ }
You can’t perform that action at this time.
0 commit comments