summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorWeiming Zhao <weimingz@codeaurora.org>2016-01-08 18:43:41 +0000
committerWeiming Zhao <weimingz@codeaurora.org>2016-01-08 18:43:41 +0000
commit4b3b13d3bc270e2097c8736c8971ea74e496d34f (patch)
tree84e377144f959d27ebfa80b01f80fffaf3313ff8 /llvm/test/CodeGen
parent48c033e021b8b9682ce87becae75b13934d5f84a (diff)
downloadbcm5719-llvm-4b3b13d3bc270e2097c8736c8971ea74e496d34f.tar.gz
bcm5719-llvm-4b3b13d3bc270e2097c8736c8971ea74e496d34f.zip
RBIT Instruction only available for ARMv6t2 and above.
Summary: r255334 matches bit-reverse pattern in InstCombine and generates calls to Instrinsic::bitreverse. RBIT instruction is only available for ARMv6t2 and above. This patch has the intrinsic expanded during legalization for ARMv4 and ARMv5. Patch by Z. Zheng <zhaoshiz@codeaurora.org> Reviewers: apazos, jmolloy, weimingz Subscribers: aemerson, rengolin, llvm-commits Differential Revision: http://reviews.llvm.org/D15932 llvm-svn: 257188
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/ARM/bit-reverse-to-rbit.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/bit-reverse-to-rbit.ll b/llvm/test/CodeGen/ARM/bit-reverse-to-rbit.ll
new file mode 100644
index 00000000000..8482cbf69f2
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/bit-reverse-to-rbit.ll
@@ -0,0 +1,34 @@
+;RUN: opt -instcombine -S < %s | llc -mtriple=armv5e--linux-gnueabi | FileCheck %s
+;RUN: opt -instcombine -S < %s | llc -mtriple=thumbv4t--linux-gnueabi | FileCheck %s
+;RUN: opt -instcombine -S < %s | llc -mtriple=armv6--linux-gnueabi | FileCheck %s
+
+;RUN: opt -instcombine -S < %s | llc -mtriple=armv7--linux-gnueabi | FileCheck %s --check-prefix=RBIT
+;RUN: opt -instcombine -S < %s | llc -mtriple=thumbv8--linux-gnueabi | FileCheck %s --check-prefix=RBIT
+
+;CHECK-NOT: rbit
+;RBIT: rbit
+
+define void @byte_reversal(i8* %p, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+ %cmp = icmp ult i32 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %0 = sext i32 %i.0 to i64
+ %arrayidx = getelementptr inbounds i8, i8* %p, i64 %0
+ %1 = load i8, i8* %arrayidx, align 1
+ %or19 = call i8 @llvm.bitreverse.i8(i8 %1)
+ store i8 %or19, i8* %arrayidx, align 1
+ %inc = add i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+; Function Attrs: nounwind readnone
+declare i8 @llvm.bitreverse.i8(i8)
OpenPOWER on IntegriCloud