Matt Arsenault | d664315 | 2017-08-24 07:55:15 +0000 | [diff] [blame^] | 1 | ; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -enable-ipra -amdgpu-sroa=0 < %s | FileCheck -check-prefix=GCN %s |
Matt Arsenault | b94972c | 2017-08-05 07:50:18 +0000 | [diff] [blame] | 2 | |
| 3 | ; Kernels are not called, so there is no call preserved mask. |
| 4 | ; GCN-LABEL: {{^}}kernel: |
| 5 | ; GCN: flat_store_dword |
| 6 | define amdgpu_kernel void @kernel(i32 addrspace(1)* %out) #0 { |
| 7 | entry: |
| 8 | store i32 0, i32 addrspace(1)* %out |
| 9 | ret void |
| 10 | } |
| 11 | |
Matt Arsenault | d664315 | 2017-08-24 07:55:15 +0000 | [diff] [blame^] | 12 | ; GCN-LABEL: {{^}}func: |
| 13 | ; GCN: ; NumVgprs: 8 |
| 14 | define void @func() #1 { |
| 15 | call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}"() #0 |
| 16 | ret void |
| 17 | } |
| 18 | |
| 19 | ; GCN-LABEL: {{^}}kernel_call: |
| 20 | ; GCN-NOT: buffer_store |
| 21 | ; GCN-NOT: buffer_load |
| 22 | ; GCN-NOT: readlane |
| 23 | ; GCN-NOT: writelane |
| 24 | ; GCN: flat_load_dword v8 |
| 25 | ; GCN: s_swappc_b64 |
| 26 | ; GCN-NOT: buffer_store |
| 27 | ; GCN-NOT: buffer_load |
| 28 | ; GCN-NOT: readlane |
| 29 | ; GCN-NOT: writelane |
| 30 | ; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v8 |
| 31 | |
| 32 | ; GCN: ; NumSgprs: 37 |
| 33 | ; GCN: ; NumVgprs: 9 |
| 34 | define amdgpu_kernel void @kernel_call() #0 { |
| 35 | %vgpr = load volatile i32, i32 addrspace(1)* undef |
| 36 | tail call void @func() |
| 37 | store volatile i32 %vgpr, i32 addrspace(1)* undef |
| 38 | ret void |
| 39 | } |
| 40 | |
| 41 | ; GCN-LABEL: {{^}}func_regular_call: |
| 42 | ; GCN-NOT: buffer_store |
| 43 | ; GCN-NOT: buffer_load |
| 44 | ; GCN-NOT: readlane |
| 45 | ; GCN-NOT: writelane |
| 46 | ; GCN: flat_load_dword v8 |
| 47 | ; GCN: s_swappc_b64 |
| 48 | ; GCN-NOT: buffer_store |
| 49 | ; GCN-NOT: buffer_load |
| 50 | ; GCN-NOT: readlane |
| 51 | ; GCN-NOT: writelane |
| 52 | ; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v8 |
| 53 | |
| 54 | ; GCN: ; NumSgprs: 32 |
| 55 | ; GCN: ; NumVgprs: 9 |
| 56 | define void @func_regular_call() #1 { |
| 57 | %vgpr = load volatile i32, i32 addrspace(1)* undef |
| 58 | tail call void @func() |
| 59 | store volatile i32 %vgpr, i32 addrspace(1)* undef |
| 60 | ret void |
| 61 | } |
| 62 | |
| 63 | ; GCN-LABEL: {{^}}func_tail_call: |
| 64 | ; GCN: s_waitcnt |
| 65 | ; GCN-NEXT: s_getpc_b64 s[6:7] |
| 66 | ; GCN-NEXT: s_add_u32 s6, |
| 67 | ; GCN-NEXT: s_addc_u32 s7, |
| 68 | ; GCN-NEXT: s_setpc_b64 s[6:7] |
| 69 | |
| 70 | ; GCN: ; NumSgprs: 32 |
| 71 | ; GCN: ; NumVgprs: 8 |
| 72 | define void @func_tail_call() #1 { |
| 73 | tail call void @func() |
| 74 | ret void |
| 75 | } |
| 76 | |
| 77 | ; GCN-LABEL: {{^}}func_call_tail_call: |
| 78 | ; GCN: flat_load_dword v8 |
| 79 | ; GCN: s_swappc_b64 |
| 80 | ; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v8 |
| 81 | ; GCN: s_setpc_b64 |
| 82 | |
| 83 | ; GCN: ; NumSgprs: 32 |
| 84 | ; GCN: ; NumVgprs: 9 |
| 85 | define void @func_call_tail_call() #1 { |
| 86 | %vgpr = load volatile i32, i32 addrspace(1)* undef |
| 87 | tail call void @func() |
| 88 | store volatile i32 %vgpr, i32 addrspace(1)* undef |
| 89 | tail call void @func() |
| 90 | ret void |
| 91 | } |
| 92 | |
Matt Arsenault | b94972c | 2017-08-05 07:50:18 +0000 | [diff] [blame] | 93 | attributes #0 = { nounwind } |
Matt Arsenault | d664315 | 2017-08-24 07:55:15 +0000 | [diff] [blame^] | 94 | attributes #1 = { nounwind noinline } |