Merging r257875:
[oota-llvm.git] / test / Transforms / CodeGenPrepare / ARM / bitreverse-recognize.ll
1 ; RUN: opt -S -loop-unroll -codegenprepare < %s | FileCheck %s
2
3 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
4 target triple = "armv7--linux-gnueabihf"
5
6 ; CHECK-LABEL: @f
7 define i32 @f(i32 %a) #0 {
8 ; CHECK: call i32 @llvm.bitreverse.i32
9 entry:
10   br label %for.body
11
12 for.cond.cleanup:                                 ; preds = %for.body
13   ret i32 %or
14
15 for.body:                                         ; preds = %for.body, %entry
16   %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
17   %b.07 = phi i32 [ 0, %entry ], [ %or, %for.body ]
18   %shr = lshr i32 %a, %i.08
19   %and = and i32 %shr, 1
20   %sub = sub nuw nsw i32 31, %i.08
21   %shl = shl i32 %and, %sub
22   %or = or i32 %shl, %b.07
23   %inc = add nuw nsw i32 %i.08, 1
24   %exitcond = icmp eq i32 %inc, 32
25   br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !3
26 }
27
28 attributes #0 = { norecurse nounwind readnone "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a8" "target-features"="+dsp,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
29
30 !llvm.module.flags = !{!0, !1}
31 !llvm.ident = !{!2}
32
33 !0 = !{i32 1, !"wchar_size", i32 4}
34 !1 = !{i32 1, !"min_enum_size", i32 4}
35 !2 = !{!"clang version 3.8.0 (http://llvm.org/git/clang.git b7441a0f42c43a8eea9e3e706be187252db747fa)"}
36 !3 = distinct !{!3, !4}
37 !4 = !{!"llvm.loop.unroll.full"}