Skip to content

Commit

Permalink
[InstCombine] precommit tests for D124590
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCBing committed May 6, 2022
1 parent 4c8c101 commit 53069de
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions llvm/test/Transforms/InstCombine/sext.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 53069de

Please sign in to comment.