summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2014-06-27 18:35:27 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2014-06-27 18:35:27 +0000
commitef92cf50d6101ee56445c9056d4f476047b8d180 (patch)
treeb8c8577549524ab39726651691be834401e13eb1 /test
parentde7bbdff33d8025d3d8c895689ea70b9377bc4d5 (diff)
downloadllvm-ef92cf50d6101ee56445c9056d4f476047b8d180.tar.gz
llvm-ef92cf50d6101ee56445c9056d4f476047b8d180.tar.bz2
llvm-ef92cf50d6101ee56445c9056d4f476047b8d180.tar.xz
[NVPTX] Add isel patterns for bit-field extract (bfe)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/NVPTX/bfe.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/NVPTX/bfe.ll b/test/CodeGen/NVPTX/bfe.ll
new file mode 100644
index 0000000000..2e816fec2c
--- /dev/null
+++ b/test/CodeGen/NVPTX/bfe.ll
@@ -0,0 +1,32 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+
+; CHECK: bfe0
+define i32 @bfe0(i32 %a) {
+; CHECK: bfe.u32 %r{{[0-9]+}}, %r{{[0-9]+}}, 4, 4
+; CHECK-NOT: shr
+; CHECK-NOT: and
+ %val0 = ashr i32 %a, 4
+ %val1 = and i32 %val0, 15
+ ret i32 %val1
+}
+
+; CHECK: bfe1
+define i32 @bfe1(i32 %a) {
+; CHECK: bfe.u32 %r{{[0-9]+}}, %r{{[0-9]+}}, 3, 3
+; CHECK-NOT: shr
+; CHECK-NOT: and
+ %val0 = ashr i32 %a, 3
+ %val1 = and i32 %val0, 7
+ ret i32 %val1
+}
+
+; CHECK: bfe2
+define i32 @bfe2(i32 %a) {
+; CHECK: bfe.u32 %r{{[0-9]+}}, %r{{[0-9]+}}, 5, 3
+; CHECK-NOT: shr
+; CHECK-NOT: and
+ %val0 = ashr i32 %a, 5
+ %val1 = and i32 %val0, 7
+ ret i32 %val1
+}