diff options
author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-06-21 23:46:22 +0000 |
---|---|---|
committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-06-21 23:46:22 +0000 |
commit | 3ed38c601a7cfa7759766f321b8c03bc255a4fdd (patch) | |
tree | aad2b000f5eb3e7518c6a863e3a52dca243c053f /llvm/test/CodeGen | |
parent | 72208a822615d458220858a6264a62e64635fcc9 (diff) | |
download | bcm5719-llvm-3ed38c601a7cfa7759766f321b8c03bc255a4fdd.tar.gz bcm5719-llvm-3ed38c601a7cfa7759766f321b8c03bc255a4fdd.zip |
[AMDGPU] Add FP_CLASS to the add/setcc combine
This is one of the nodes which also compile as v_cmp_*.
Differential Revision: https://reviews.llvm.org/D34485
llvm-svn: 305970
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/AMDGPU/combine-cond-add-sub.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/combine-cond-add-sub.ll b/llvm/test/CodeGen/AMDGPU/combine-cond-add-sub.ll index 6026a047d88..187fb24dfb6 100644 --- a/llvm/test/CodeGen/AMDGPU/combine-cond-add-sub.ll +++ b/llvm/test/CodeGen/AMDGPU/combine-cond-add-sub.ll @@ -116,6 +116,42 @@ bb: ret void } +; GCN-LABEL: {{^}}zext_flclass: +; GCN: v_cmp_class_f32_e{{32|64}} [[CC:[^,]+]], +; GCN: v_addc_u32_e{{32|64}} v{{[0-9]+}}, {{[^,]+}}, 0, v{{[0-9]+}}, [[CC]] +; GCN-NOT: v_cndmask + +define amdgpu_kernel void @zext_flclass(i32 addrspace(1)* nocapture %arg, float %x) { +bb: + %id = tail call i32 @llvm.amdgcn.workitem.id.x() + %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %id + %v = load i32, i32 addrspace(1)* %gep, align 4 + %cmp = tail call zeroext i1 @llvm.amdgcn.class.f32(float %x, i32 608) + %ext = zext i1 %cmp to i32 + %add = add i32 %v, %ext + store i32 %add, i32 addrspace(1)* %gep, align 4 + ret void +} + +; GCN-LABEL: {{^}}sext_flclass: +; GCN: v_cmp_class_f32_e{{32|64}} [[CC:[^,]+]], +; GCN: v_subb_u32_e{{32|64}} v{{[0-9]+}}, {{[^,]+}}, v{{[0-9]+}}, 0, [[CC]] +; GCN-NOT: v_cndmask + +define amdgpu_kernel void @sext_flclass(i32 addrspace(1)* nocapture %arg, float %x) { +bb: + %id = tail call i32 @llvm.amdgcn.workitem.id.x() + %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %id + %v = load i32, i32 addrspace(1)* %gep, align 4 + %cmp = tail call zeroext i1 @llvm.amdgcn.class.f32(float %x, i32 608) + %ext = sext i1 %cmp to i32 + %add = add i32 %v, %ext + store i32 %add, i32 addrspace(1)* %gep, align 4 + ret void +} + +declare i1 @llvm.amdgcn.class.f32(float, i32) #0 + declare i32 @llvm.amdgcn.workitem.id.x() #0 declare i32 @llvm.amdgcn.workitem.id.y() #0 |