1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -O3 -S < %s | FileCheck %s
3 ; RUN: opt -passes='default<O3>' -S < %s | FileCheck %s
5 ; This should become a single funnel shift through a combination
6 ; of aggressive-instcombine, simplifycfg, and instcombine.
7 ; https://bugs.llvm.org/show_bug.cgi?id=34924
9 define i32 @rotl(i32 %a, i32 %b) {
12 ; CHECK-NEXT: [[COND:%.*]] = tail call i32 @llvm.fshl.i32(i32 [[A:%.*]], i32 [[A]], i32 [[B:%.*]])
13 ; CHECK-NEXT: ret i32 [[COND]]
16 %cmp = icmp eq i32 %b, 0
17 br i1 %cmp, label %end, label %rotbb
21 %shr = lshr i32 %a, %sub
23 %or = or i32 %shr, %shl
27 %cond = phi i32 [ %or, %rotbb ], [ %a, %entry ]