aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis/ValueTracking/knownbits-shift.ll
blob: 5cb355eff5a699a2173bc55ca673c11a93c8d2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=instcombine -S < %s | FileCheck %s

define i8 @simplify_lshr_with_exact(i8 %x) {
; CHECK-LABEL: @simplify_lshr_with_exact(
; CHECK-NEXT:    ret i8 2
;
  %shr = lshr exact i8 6, %x
  %r = and i8 %shr, 2
  ret i8 %r
}

define i8 @simplify_ashr_with_exact(i8 %x) {
; CHECK-LABEL: @simplify_ashr_with_exact(
; CHECK-NEXT:    ret i8 2
;
  %shr = ashr exact i8 -122, %x
  %r = and i8 %shr, 2
  ret i8 %r
}