summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/alignbit-pat.ll
diff options
context:
space:
mode:
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2017-06-28 02:52:39 +0000
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2017-06-28 02:52:39 +0000
commitd445455643900416388b5819ebbdfc39329ab8cc (patch)
tree8c2c87369ff90e34789b8db8390ad732a6fee292 /llvm/test/CodeGen/AMDGPU/alignbit-pat.ll
parenteb40733bf07e523ff898cbad942c9dbbc5beaca2 (diff)
downloadbcm5719-llvm-d445455643900416388b5819ebbdfc39329ab8cc.tar.gz
bcm5719-llvm-d445455643900416388b5819ebbdfc39329ab8cc.zip
[AMDGPU] Add pattern for v_alignbit_b32 with immediate
If immediate in shift is less than 32 we can use alignbit too. Differential Revision: https://reviews.llvm.org/D34729 llvm-svn: 306500
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/alignbit-pat.ll')
-rw-r--r--llvm/test/CodeGen/AMDGPU/alignbit-pat.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/alignbit-pat.ll b/llvm/test/CodeGen/AMDGPU/alignbit-pat.ll
index 5176f47f977..ff5c8960fad 100644
--- a/llvm/test/CodeGen/AMDGPU/alignbit-pat.ll
+++ b/llvm/test/CodeGen/AMDGPU/alignbit-pat.ll
@@ -68,6 +68,33 @@ bb:
ret void
}
+; GCN-LABEL: {{^}}alignbit_shr_pat_const30:
+; GCN: load_dwordx2 v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]{{\]}}
+; GCN: v_alignbit_b32 v{{[0-9]+}}, v[[HI]], v[[LO]], 30
+
+define amdgpu_kernel void @alignbit_shr_pat_const30(i64 addrspace(1)* nocapture readonly %arg, i32 addrspace(1)* nocapture %arg1) {
+bb:
+ %tmp = load i64, i64 addrspace(1)* %arg, align 8
+ %tmp5 = lshr i64 %tmp, 30
+ %tmp6 = trunc i64 %tmp5 to i32
+ store i32 %tmp6, i32 addrspace(1)* %arg1, align 4
+ ret void
+}
+
+; GCN-LABEL: {{^}}alignbit_shr_pat_wrong_const33:
+; Negative test, shift amount more than 31
+; GCN: v_lshrrev_b32_e32 v{{[0-9]+}}, 1, v{{[0-9]+}}
+; GCN-NOT: v_alignbit_b32
+
+define amdgpu_kernel void @alignbit_shr_pat_wrong_const33(i64 addrspace(1)* nocapture readonly %arg, i32 addrspace(1)* nocapture %arg1) {
+bb:
+ %tmp = load i64, i64 addrspace(1)* %arg, align 8
+ %tmp5 = lshr i64 %tmp, 33
+ %tmp6 = trunc i64 %tmp5 to i32
+ store i32 %tmp6, i32 addrspace(1)* %arg1, align 4
+ ret void
+}
+
declare i32 @llvm.amdgcn.workitem.id.x() #0
attributes #0 = { nounwind readnone speculatable }
OpenPOWER on IntegriCloud