1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs=0 2> %t.err < %s | FileCheck %s
3 ; RUN: FileCheck -check-prefix=ERR %s < %t.err
4 ; FIXME: These tests cannot be tail called, and should be executed in a waterfall loop.
6 declare hidden void @void_func_i32_inreg(i32 inreg)
8 ; ERR: error: <unknown>:0:0: in function tail_call_i32_inreg_divergent void (i32): illegal VGPR to SGPR copy
9 ; ERR: error: <unknown>:0:0: in function indirect_tail_call_i32_inreg_divergent void (i32): illegal VGPR to SGPR copy
11 define void @tail_call_i32_inreg_divergent(i32 %vgpr) {
12 ; CHECK-LABEL: tail_call_i32_inreg_divergent:
14 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15 ; CHECK-NEXT: s_mov_b32 s16, s33
16 ; CHECK-NEXT: s_mov_b32 s33, s32
17 ; CHECK-NEXT: s_or_saveexec_b64 s[18:19], -1
18 ; CHECK-NEXT: buffer_store_dword v40, off, s[0:3], s33 ; 4-byte Folded Spill
19 ; CHECK-NEXT: s_mov_b64 exec, s[18:19]
20 ; CHECK-NEXT: v_writelane_b32 v40, s16, 2
21 ; CHECK-NEXT: s_addk_i32 s32, 0x400
22 ; CHECK-NEXT: v_writelane_b32 v40, s30, 0
23 ; CHECK-NEXT: v_writelane_b32 v40, s31, 1
24 ; CHECK-NEXT: s_getpc_b64 s[16:17]
25 ; CHECK-NEXT: s_add_u32 s16, s16, void_func_i32_inreg@rel32@lo+4
26 ; CHECK-NEXT: s_addc_u32 s17, s17, void_func_i32_inreg@rel32@hi+12
27 ; CHECK-NEXT: ; illegal copy v0 to s0
28 ; CHECK-NEXT: s_swappc_b64 s[30:31], s[16:17]
29 ; CHECK-NEXT: v_readlane_b32 s31, v40, 1
30 ; CHECK-NEXT: v_readlane_b32 s30, v40, 0
31 ; CHECK-NEXT: v_readlane_b32 s4, v40, 2
32 ; CHECK-NEXT: s_or_saveexec_b64 s[6:7], -1
33 ; CHECK-NEXT: buffer_load_dword v40, off, s[0:3], s33 ; 4-byte Folded Reload
34 ; CHECK-NEXT: s_mov_b64 exec, s[6:7]
35 ; CHECK-NEXT: s_addk_i32 s32, 0xfc00
36 ; CHECK-NEXT: s_mov_b32 s33, s4
37 ; CHECK-NEXT: s_waitcnt vmcnt(0)
38 ; CHECK-NEXT: s_setpc_b64 s[30:31]
39 tail call void @void_func_i32_inreg(i32 inreg %vgpr)
43 @constant = external hidden addrspace(4) constant ptr
45 define void @indirect_tail_call_i32_inreg_divergent(i32 %vgpr) {
46 ; CHECK-LABEL: indirect_tail_call_i32_inreg_divergent:
48 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
49 ; CHECK-NEXT: s_mov_b32 s16, s33
50 ; CHECK-NEXT: s_mov_b32 s33, s32
51 ; CHECK-NEXT: s_or_saveexec_b64 s[18:19], -1
52 ; CHECK-NEXT: buffer_store_dword v40, off, s[0:3], s33 ; 4-byte Folded Spill
53 ; CHECK-NEXT: s_mov_b64 exec, s[18:19]
54 ; CHECK-NEXT: s_addk_i32 s32, 0x400
55 ; CHECK-NEXT: v_writelane_b32 v40, s16, 2
56 ; CHECK-NEXT: s_getpc_b64 s[16:17]
57 ; CHECK-NEXT: s_add_u32 s16, s16, constant@rel32@lo+4
58 ; CHECK-NEXT: s_addc_u32 s17, s17, constant@rel32@hi+12
59 ; CHECK-NEXT: s_load_dwordx2 s[16:17], s[16:17], 0x0
60 ; CHECK-NEXT: v_writelane_b32 v40, s30, 0
61 ; CHECK-NEXT: v_writelane_b32 v40, s31, 1
62 ; CHECK-NEXT: ; illegal copy v0 to s0
63 ; CHECK-NEXT: s_waitcnt lgkmcnt(0)
64 ; CHECK-NEXT: s_swappc_b64 s[30:31], s[16:17]
65 ; CHECK-NEXT: v_readlane_b32 s31, v40, 1
66 ; CHECK-NEXT: v_readlane_b32 s30, v40, 0
67 ; CHECK-NEXT: v_readlane_b32 s4, v40, 2
68 ; CHECK-NEXT: s_or_saveexec_b64 s[6:7], -1
69 ; CHECK-NEXT: buffer_load_dword v40, off, s[0:3], s33 ; 4-byte Folded Reload
70 ; CHECK-NEXT: s_mov_b64 exec, s[6:7]
71 ; CHECK-NEXT: s_addk_i32 s32, 0xfc00
72 ; CHECK-NEXT: s_mov_b32 s33, s4
73 ; CHECK-NEXT: s_waitcnt vmcnt(0)
74 ; CHECK-NEXT: s_setpc_b64 s[30:31]
75 %fptr = load ptr, ptr addrspace(4) @constant, align 8
76 tail call void %fptr(i32 inreg %vgpr)