| ; 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 | |
| } |