1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -loop-unroll -codegenprepare -S -mtriple=x86_64-- -mattr=+xop | FileCheck %s
4 define i32 @bitreverse_i32(i32 %a) {
5 ; CHECK-LABEL: @bitreverse_i32(
7 ; CHECK-NEXT: [[REV:%.*]] = call i32 @llvm.bitreverse.i32(i32 [[A:%.*]])
8 ; CHECK-NEXT: ret i32 [[REV]]
13 for.cond.cleanup: ; preds = %for.body
16 for.body: ; preds = %for.body, %entry
17 %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.08
20 %and = and i32 %shr, 1
21 %sub = sub nuw nsw i32 31, %i.08
22 %shl = shl i32 %and, %sub
23 %or = or i32 %shl, %b.07
24 %inc = add nuw nsw i32 %i.08, 1
25 %exitcond = icmp eq i32 %inc, 32
26 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !3
30 define 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]]
36 %3 = and i64 %2, 6148914691236517205
38 %5 = and i64 %4, -6148914691236517206
41 %8 = and i64 %7, 3689348814741910323
43 %10 = and i64 %9, -3689348814741910324
46 %13 = and i64 %12, 1085102592571150095
48 %15 = and i64 %14, -1085102592571150096
51 %18 = and i64 %17, 71777214294589695
53 %20 = and i64 %19, -71777214294589696
55 %22 = lshr i64 %21, 16
56 %23 = and i64 %22, 281470681808895
58 %25 = and i64 %24, -281470681808896
60 %27 = tail call i64 @llvm.fshl.i64(i64 %26, i64 %26, i64 32)
63 declare i64 @llvm.fshl.i64(i64, i64, i64)
65 !llvm.module.flags = !{!0, !1}
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"}