1;RUN: opt -instcombine -S < %s | llc -mtriple=armv5e--linux-gnueabi | FileCheck %s
2;RUN: opt -instcombine -S < %s | llc -mtriple=thumbv4t--linux-gnueabi | FileCheck %s
3;RUN: opt -instcombine -S < %s | llc -mtriple=armv6--linux-gnueabi | FileCheck %s
4
5;RUN: opt -instcombine -S < %s | llc -mtriple=armv7--linux-gnueabi | FileCheck %s --check-prefix=RBIT
6;RUN: opt -instcombine -S < %s | llc -mtriple=thumbv8--linux-gnueabi | FileCheck %s --check-prefix=RBIT
7
8;CHECK-NOT: rbit
9;RBIT: rbit
10
11define void @byte_reversal(i8* %p, i32 %n) {
12entry:
13  br label %for.cond
14
15for.cond:                                         ; preds = %for.body, %entry
16  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
17  %cmp = icmp ult i32 %i.0, %n
18  br i1 %cmp, label %for.body, label %for.end
19
20for.body:                                         ; preds = %for.cond
21  %0 = sext i32 %i.0 to i64
22  %arrayidx = getelementptr inbounds i8, i8* %p, i64 %0
23  %1 = load i8, i8* %arrayidx, align 1
24  %or19 = call i8 @llvm.bitreverse.i8(i8 %1)
25  store i8 %or19, i8* %arrayidx, align 1
26  %inc = add i32 %i.0, 1
27  br label %for.cond
28
29for.end:                                          ; preds = %for.cond
30  ret void
31}
32
33; Function Attrs: nounwind readnone
34declare i8 @llvm.bitreverse.i8(i8)
35