73 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -loop-unroll -codegenprepare -S -mtriple=x86_64-- -mattr=+xop | FileCheck %s3 4define i32 @bitreverse_i32(i32 %a) {5; CHECK-LABEL: @bitreverse_i32(6; CHECK-NEXT: entry:7; CHECK-NEXT: [[REV:%.*]] = call i32 @llvm.bitreverse.i32(i32 [[A:%.*]])8; CHECK-NEXT: ret i32 [[REV]]9;10entry:11 br label %for.body12 13for.cond.cleanup: ; preds = %for.body14 ret i32 %or15 16for.body: ; preds = %for.body, %entry17 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]18 %b.07 = phi i32 [ 0, %entry ], [ %or, %for.body ]19 %shr = lshr i32 %a, %i.0820 %and = and i32 %shr, 121 %sub = sub nuw nsw i32 31, %i.0822 %shl = shl i32 %and, %sub23 %or = or i32 %shl, %b.0724 %inc = add nuw nsw i32 %i.08, 125 %exitcond = icmp eq i32 %inc, 3226 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !327}28 29; PR4005830define i64 @bitreverse_i64(i64 %0) {31; CHECK-LABEL: @bitreverse_i64(32; CHECK-NEXT: [[REV:%.*]] = call i64 @llvm.bitreverse.i64(i64 [[TMP0:%.*]])33; CHECK-NEXT: ret i64 [[REV]]34;35 %2 = lshr i64 %0, 136 %3 = and i64 %2, 614891469123651720537 %4 = shl i64 %0, 138 %5 = and i64 %4, -614891469123651720639 %6 = or i64 %3, %540 %7 = lshr i64 %6, 241 %8 = and i64 %7, 368934881474191032342 %9 = shl i64 %6, 243 %10 = and i64 %9, -368934881474191032444 %11 = or i64 %8, %1045 %12 = lshr i64 %11, 446 %13 = and i64 %12, 108510259257115009547 %14 = shl i64 %11, 448 %15 = and i64 %14, -108510259257115009649 %16 = or i64 %13, %1550 %17 = lshr i64 %16, 851 %18 = and i64 %17, 7177721429458969552 %19 = shl i64 %16, 853 %20 = and i64 %19, -7177721429458969654 %21 = or i64 %18, %2055 %22 = lshr i64 %21, 1656 %23 = and i64 %22, 28147068180889557 %24 = shl i64 %21, 1658 %25 = and i64 %24, -28147068180889659 %26 = or i64 %23, %2560 %27 = tail call i64 @llvm.fshl.i64(i64 %26, i64 %26, i64 32)61 ret i64 %2762}63declare i64 @llvm.fshl.i64(i64, i64, i64)64 65!llvm.module.flags = !{!0, !1}66!llvm.ident = !{!2}67 68!0 = !{i32 1, !"wchar_size", i32 4}69!1 = !{i32 1, !"min_enum_size", i32 4}70!2 = !{!"clang version 3.8.0"}71!3 = distinct !{!3, !4}72!4 = !{!"llvm.loop.unroll.full"}73