diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-02 18:30:13 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-02 18:30:13 +0000 |
| commit | a303c417bbdb53703c2c17398b08486bde78f1f6 (patch) | |
| tree | 98366d6b93d863cefdc53f16c66c0c5ae7fb2261 /test/CodeGen/AMDGPU | |
| parent | 12f3ca4cdb95b193af905a00e722a4dcb40b3de3 (diff) | |
Notes
Diffstat (limited to 'test/CodeGen/AMDGPU')
| -rw-r--r-- | test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll | 4 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/inline-asm.ll | 14 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll | 80 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/zext-lid.ll | 39 |
4 files changed, 116 insertions, 21 deletions
diff --git a/test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll b/test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll index e2620ce353c6..f7461b925ca1 100644 --- a/test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll +++ b/test/CodeGen/AMDGPU/annotate-kernel-features-hsa.ll @@ -221,10 +221,10 @@ define amdgpu_kernel void @use_flat_to_constant_addrspacecast(i32 addrspace(4)* ret void } -attributes #0 = { nounwind readnone } +attributes #0 = { nounwind readnone speculatable } attributes #1 = { nounwind } -; HSA: attributes #0 = { nounwind readnone } +; HSA: attributes #0 = { nounwind readnone speculatable } ; HSA: attributes #1 = { nounwind } ; HSA: attributes #2 = { nounwind "amdgpu-work-group-id-y" } ; HSA: attributes #3 = { nounwind "amdgpu-work-group-id-z" } diff --git a/test/CodeGen/AMDGPU/inline-asm.ll b/test/CodeGen/AMDGPU/inline-asm.ll index 0d7e07b9a624..636b45db698d 100644 --- a/test/CodeGen/AMDGPU/inline-asm.ll +++ b/test/CodeGen/AMDGPU/inline-asm.ll @@ -232,3 +232,17 @@ entry: call void asm sideeffect "; use $0 $1 ", "{VGPR0}, {VGPR1}"(i1 %val0, i1 %val1) ret void } + +; CHECK-LABEL: {{^}}muliple_def_phys_vgpr: +; CHECK: ; def v0 +; CHECK: v_mov_b32_e32 v1, v0 +; CHECK: ; def v0 +; CHECK: v_lshlrev_b32_e32 v{{[0-9]+}}, v0, v1 +define amdgpu_kernel void @muliple_def_phys_vgpr() { +entry: + %def0 = call i32 asm sideeffect "; def $0 ", "={VGPR0}"() + %def1 = call i32 asm sideeffect "; def $0 ", "={VGPR0}"() + %add = shl i32 %def0, %def1 + store i32 %add, i32 addrspace(1)* undef + ret void +} diff --git a/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll b/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll new file mode 100644 index 000000000000..617f1f19e360 --- /dev/null +++ b/test/CodeGen/AMDGPU/llvm.amdgcn.init.exec.ll @@ -0,0 +1,80 @@ +;RUN: llc < %s -march=amdgcn -mcpu=gfx900 -verify-machineinstrs | FileCheck %s --check-prefix=GCN + +; GCN-LABEL: {{^}}full_mask: +; GCN: s_mov_b64 exec, -1 +; GCN: v_add_f32_e32 v0, +define amdgpu_ps float @full_mask(float %a, float %b) { +main_body: + %s = fadd float %a, %b + call void @llvm.amdgcn.init.exec(i64 -1) + ret float %s +} + +; GCN-LABEL: {{^}}partial_mask: +; GCN: s_mov_b64 exec, 0x1e240 +; GCN: v_add_f32_e32 v0, +define amdgpu_ps float @partial_mask(float %a, float %b) { +main_body: + %s = fadd float %a, %b + call void @llvm.amdgcn.init.exec(i64 123456) + ret float %s +} + +; GCN-LABEL: {{^}}input_s3off8: +; GCN: s_bfe_u32 s0, s3, 0x70008 +; GCN: s_bfm_b64 exec, s0, 0 +; GCN: s_cmp_eq_u32 s0, 64 +; GCN: s_cmov_b64 exec, -1 +; GCN: v_add_f32_e32 v0, +define amdgpu_ps float @input_s3off8(i32 inreg, i32 inreg, i32 inreg, i32 inreg %count, float %a, float %b) { +main_body: + %s = fadd float %a, %b + call void @llvm.amdgcn.init.exec.from.input(i32 %count, i32 8) + ret float %s +} + +; GCN-LABEL: {{^}}input_s0off19: +; GCN: s_bfe_u32 s0, s0, 0x70013 +; GCN: s_bfm_b64 exec, s0, 0 +; GCN: s_cmp_eq_u32 s0, 64 +; GCN: s_cmov_b64 exec, -1 +; GCN: v_add_f32_e32 v0, +define amdgpu_ps float @input_s0off19(i32 inreg %count, float %a, float %b) { +main_body: + %s = fadd float %a, %b + call void @llvm.amdgcn.init.exec.from.input(i32 %count, i32 19) + ret float %s +} + +; GCN-LABEL: {{^}}reuse_input: +; GCN: s_bfe_u32 s1, s0, 0x70013 +; GCN: s_bfm_b64 exec, s1, 0 +; GCN: s_cmp_eq_u32 s1, 64 +; GCN: s_cmov_b64 exec, -1 +; GCN: v_add_i32_e32 v0, vcc, s0, v0 +define amdgpu_ps float @reuse_input(i32 inreg %count, i32 %a) { +main_body: + call void @llvm.amdgcn.init.exec.from.input(i32 %count, i32 19) + %s = add i32 %a, %count + %f = sitofp i32 %s to float + ret float %f +} + +; GCN-LABEL: {{^}}reuse_input2: +; GCN: s_bfe_u32 s1, s0, 0x70013 +; GCN: s_bfm_b64 exec, s1, 0 +; GCN: s_cmp_eq_u32 s1, 64 +; GCN: s_cmov_b64 exec, -1 +; GCN: v_add_i32_e32 v0, vcc, s0, v0 +define amdgpu_ps float @reuse_input2(i32 inreg %count, i32 %a) { +main_body: + %s = add i32 %a, %count + %f = sitofp i32 %s to float + call void @llvm.amdgcn.init.exec.from.input(i32 %count, i32 19) + ret float %f +} + +declare void @llvm.amdgcn.init.exec(i64) #1 +declare void @llvm.amdgcn.init.exec.from.input(i32, i32) #1 + +attributes #1 = { convergent } diff --git a/test/CodeGen/AMDGPU/zext-lid.ll b/test/CodeGen/AMDGPU/zext-lid.ll index 8eeff53ff99f..066f29277270 100644 --- a/test/CodeGen/AMDGPU/zext-lid.ll +++ b/test/CodeGen/AMDGPU/zext-lid.ll @@ -4,19 +4,19 @@ ; CHECK-NOT: and_b32 ; OPT-LABEL: @zext_grp_size_128 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.x() #2, !range !0 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.y() #2, !range !0 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.z() #2, !range !0 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.x(), !range !0 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.y(), !range !0 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.z(), !range !0 define amdgpu_kernel void @zext_grp_size_128(i32 addrspace(1)* nocapture %arg) #0 { bb: - %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() #2 + %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() %tmp1 = and i32 %tmp, 127 store i32 %tmp1, i32 addrspace(1)* %arg, align 4 - %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() #2 + %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() %tmp3 = and i32 %tmp2, 127 %tmp4 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 1 store i32 %tmp3, i32 addrspace(1)* %tmp4, align 4 - %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() #2 + %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() %tmp6 = and i32 %tmp5, 127 %tmp7 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 2 store i32 %tmp6, i32 addrspace(1)* %tmp7, align 4 @@ -24,19 +24,19 @@ bb: } ; OPT-LABEL: @zext_grp_size_32x4x1 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.x() #2, !range !2 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.y() #2, !range !3 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.z() #2, !range !4 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.x(), !range !2 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.y(), !range !3 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.z(), !range !4 define amdgpu_kernel void @zext_grp_size_32x4x1(i32 addrspace(1)* nocapture %arg) #0 !reqd_work_group_size !0 { bb: - %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() #2 + %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() %tmp1 = and i32 %tmp, 31 store i32 %tmp1, i32 addrspace(1)* %arg, align 4 - %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() #2 + %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() %tmp3 = and i32 %tmp2, 3 %tmp4 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 1 store i32 %tmp3, i32 addrspace(1)* %tmp4, align 4 - %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() #2 + %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() %tmp6 = and i32 %tmp5, 1 %tmp7 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 2 store i32 %tmp6, i32 addrspace(1)* %tmp7, align 4 @@ -44,19 +44,19 @@ bb: } ; OPT-LABEL: @zext_grp_size_512 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.x() #2, !range !5 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.y() #2, !range !5 -; OPT: tail call i32 @llvm.amdgcn.workitem.id.z() #2, !range !5 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.x(), !range !5 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.y(), !range !5 +; OPT: tail call i32 @llvm.amdgcn.workitem.id.z(), !range !5 define amdgpu_kernel void @zext_grp_size_512(i32 addrspace(1)* nocapture %arg) #1 { bb: - %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() #2 + %tmp = tail call i32 @llvm.amdgcn.workitem.id.x() %tmp1 = and i32 %tmp, 65535 store i32 %tmp1, i32 addrspace(1)* %arg, align 4 - %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() #2 + %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.y() %tmp3 = and i32 %tmp2, 65535 %tmp4 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 1 store i32 %tmp3, i32 addrspace(1)* %tmp4, align 4 - %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() #2 + %tmp5 = tail call i32 @llvm.amdgcn.workitem.id.z() %tmp6 = and i32 %tmp5, 65535 %tmp7 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 2 store i32 %tmp6, i32 addrspace(1)* %tmp7, align 4 @@ -71,7 +71,8 @@ declare i32 @llvm.amdgcn.workitem.id.z() #2 attributes #0 = { nounwind "amdgpu-flat-work-group-size"="64,128" } attributes #1 = { nounwind "amdgpu-flat-work-group-size"="512,512" } -attributes #2 = { nounwind readnone } +attributes #2 = { nounwind readnone speculatable } +attributes #3 = { nounwind readnone } !0 = !{i32 32, i32 4, i32 1} |
