brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · babcd0d Raw
84 lines · plain
1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck --check-prefix=GCN %s2; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck --check-prefix=GCN %s3 4; Test with zero frame5; GCN-LABEL: {{^}}func16; GCN: v_mov_b32_e32 v0, s307; GCN: v_mov_b32_e32 v1, s318; GCN: s_setpc_b64 s[30:31]9define ptr @func1() nounwind {10entry:11  %0 = tail call ptr @llvm.returnaddress(i32 0)12  ret ptr %013}14 15; Test with non-zero frame16; GCN-LABEL: {{^}}func217; GCN: v_mov_b32_e32 v0, 018; GCN: v_mov_b32_e32 v1, 019; GCN: s_setpc_b64 s[30:31]20define ptr @func2() nounwind {21entry:22  %0 = tail call ptr @llvm.returnaddress(i32 1)23  ret ptr %024}25 26; Test with amdgpu_kernel27; GCN-LABEL: {{^}}func328; GCN: v_mov_b32_e32 v0, 029; GCN: v_mov_b32_e32 v1, {{v0|0}}30define amdgpu_kernel void @func3(ptr %out) nounwind {31entry:32  %tmp = tail call ptr @llvm.returnaddress(i32 0)33  store ptr %tmp, ptr %out, align 434  ret void35}36 37; Test with use outside the entry-block38; GCN-LABEL: {{^}}func439; GCN: v_mov_b32_e32 v0, 040; GCN: v_mov_b32_e32 v1, {{v0|0}}41define amdgpu_kernel void @func4(ptr %out, i32 %val) nounwind {42entry:43  %cmp = icmp ne i32 %val, 044  br i1 %cmp, label %store, label %exit45 46store:47  %tmp = tail call ptr @llvm.returnaddress(i32 1)48  store ptr %tmp, ptr %out, align 449  ret void50 51exit:52  ret void53}54 55; Test ending in unreachable56; GCN-LABEL: {{^}}func557; GCN: v_mov_b32_e32 v0, 058define void @func5() nounwind {59entry:60  %tmp = tail call ptr @llvm.returnaddress(i32 2)61  store volatile i32 0, ptr addrspace(3) poison, align 462  unreachable63}64 65declare void @callee()66 67; GCN-LABEL: {{^}}multi_use:68; GCN-DAG: v_mov_b32_e32 v[[LO:4[0-9]+]], s3069; GCN-DAG: v_mov_b32_e32 v[[HI:4[0-9]+]], s3170; GCN: global_store_dwordx2 v{{\[[0-9]+:[0-9]+\]}}, v[[[LO]]:[[HI]]]71; GCN: s_swappc_b6472; GCN: global_store_dwordx2 v{{\[[0-9]+:[0-9]+\]}}, v[[[LO]]:[[HI]]]73define void @multi_use() nounwind {74entry:75  %ret0 = tail call ptr @llvm.returnaddress(i32 0)76  store volatile ptr %ret0, ptr addrspace(1) poison77  call void @callee()78  %ret1 = tail call ptr @llvm.returnaddress(i32 0)79  store volatile ptr %ret1, ptr addrspace(1) poison80  ret void81}82 83declare ptr @llvm.returnaddress(i32) nounwind readnone84