[InstCombine] precommit tests for D124590

This commit is contained in:
Chenbing Zheng 2022-05-06 10:53:12 +08:00
parent 4c8c101b49
commit 53069de6aa
1 changed files with 30 additions and 0 deletions

View File

@ -395,3 +395,33 @@ define i16 @smear_set_bit_different_dest_type(i32 %x) {
%s = sext i8 %a to i16
ret i16 %s
}
; negative test - extra use
define i16 @smear_set_bit_different_dest_type_extra_use(i32 %x) {
; CHECK-LABEL: @smear_set_bit_different_dest_type_extra_use(
; CHECK-NEXT: [[T:%.*]] = trunc i32 [[X:%.*]] to i8
; CHECK-NEXT: call void @use(i8 [[T]])
; CHECK-NEXT: [[A:%.*]] = ashr i8 [[T]], 7
; CHECK-NEXT: [[S:%.*]] = sext i8 [[A]] to i16
; CHECK-NEXT: ret i16 [[S]]
;
%t = trunc i32 %x to i8
call void @use(i8 %t)
%a = ashr i8 %t, 7
%s = sext i8 %a to i16
ret i16 %s
}
define i64 @smear_set_bit_different_dest_type_wider_dst(i32 %x) {
; CHECK-LABEL: @smear_set_bit_different_dest_type_wider_dst(
; CHECK-NEXT: [[T:%.*]] = trunc i32 [[X:%.*]] to i8
; CHECK-NEXT: [[A:%.*]] = ashr i8 [[T]], 7
; CHECK-NEXT: [[S:%.*]] = sext i8 [[A]] to i64
; CHECK-NEXT: ret i64 [[S]]
;
%t = trunc i32 %x to i8
%a = ashr i8 %t, 7
%s = sext i8 %a to i64
ret i64 %s
}