30 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -O3 -S < %s | FileCheck %s3; RUN: opt -passes="default<O3>" -S < %s | FileCheck %s4 5; This should become a single funnel shift through a combination6; of aggressive-instcombine, simplifycfg, and instcombine.7; https://bugs.llvm.org/show_bug.cgi?id=349248 9define i32 @rotl(i32 %a, i32 %b) {10; CHECK-LABEL: @rotl(11; CHECK-NEXT: entry:12; CHECK-NEXT: [[COND:%.*]] = tail call i32 @llvm.fshl.i32(i32 [[A:%.*]], i32 [[A]], i32 [[B:%.*]])13; CHECK-NEXT: ret i32 [[COND]]14;15entry:16 %cmp = icmp eq i32 %b, 017 br i1 %cmp, label %end, label %rotbb18 19rotbb:20 %sub = sub i32 32, %b21 %shr = lshr i32 %a, %sub22 %shl = shl i32 %a, %b23 %or = or i32 %shr, %shl24 br label %end25 26end:27 %cond = phi i32 [ %or, %rotbb ], [ %a, %entry ]28 ret i32 %cond29}30