Skip to content

Commit ac1b6d4

Browse files
[InstCombine] Precommit a test
This patch precommits a test for: #61650
1 parent 804467d commit ac1b6d4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2+
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3+
4+
define i32 @trunc_shl_zext_32(i32 %a) {
5+
; CHECK-LABEL: define i32 @trunc_shl_zext_32
6+
; CHECK-SAME: (i32 [[A:%.*]]) {
7+
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 [[A]] to i16
8+
; CHECK-NEXT: [[SHL:%.*]] = shl i16 [[TRUNC]], 4
9+
; CHECK-NEXT: [[EXT:%.*]] = zext i16 [[SHL]] to i32
10+
; CHECK-NEXT: ret i32 [[EXT]]
11+
;
12+
%trunc = trunc i32 %a to i16
13+
%shl = shl i16 %trunc, 4
14+
%ext = zext i16 %shl to i32
15+
ret i32 %ext
16+
}
17+
18+
define i64 @trunc_shl_zext_64(i64 %a) {
19+
; CHECK-LABEL: define i64 @trunc_shl_zext_64
20+
; CHECK-SAME: (i64 [[A:%.*]]) {
21+
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[A]] to i8
22+
; CHECK-NEXT: [[SHL:%.*]] = shl i8 [[TRUNC]], 7
23+
; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[SHL]] to i64
24+
; CHECK-NEXT: ret i64 [[EXT]]
25+
;
26+
%trunc = trunc i64 %a to i8
27+
%shl = shl i8 %trunc, 7
28+
%ext = zext i8 %shl to i64
29+
ret i64 %ext
30+
}

0 commit comments

Comments
 (0)