Skip to content

Commit f19d9e1

Browse files
committed
[KnownBits] Add test for computing more information for lshr/ashr with exact flag; NFC
1 parent f832bee commit f19d9e1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
3+
4+
define i8 @simplify_lshr_with_exact(i8 %x) {
5+
; CHECK-LABEL: @simplify_lshr_with_exact(
6+
; CHECK-NEXT: [[SHR:%.*]] = lshr exact i8 6, [[X:%.*]]
7+
; CHECK-NEXT: [[R:%.*]] = and i8 [[SHR]], 2
8+
; CHECK-NEXT: ret i8 [[R]]
9+
;
10+
%shr = lshr exact i8 6, %x
11+
%r = and i8 %shr, 2
12+
ret i8 %r
13+
}
14+
15+
define i8 @simplify_ashr_with_exact(i8 %x) {
16+
; CHECK-LABEL: @simplify_ashr_with_exact(
17+
; CHECK-NEXT: [[SHR:%.*]] = ashr exact i8 -122, [[X:%.*]]
18+
; CHECK-NEXT: [[R:%.*]] = and i8 [[SHR]], 2
19+
; CHECK-NEXT: ret i8 [[R]]
20+
;
21+
%shr = ashr exact i8 -122, %x
22+
%r = and i8 %shr, 2
23+
ret i8 %r
24+
}

0 commit comments

Comments
 (0)