1 ; RUN: llc < %s -mtriple=amdgcn -mcpu=kaveri -verify-machineinstrs | FileCheck -check-prefix=CI -check-prefix=GCN %s
2 ; RUN: llc < %s -mtriple=amdgcn -mcpu=fiji -mattr=-xnack -verify-machineinstrs | FileCheck -check-prefix=VI-NOXNACK -check-prefix=GCN %s
4 ; RUN: llc < %s -mtriple=amdgcn -mcpu=carrizo -mattr=-xnack -verify-machineinstrs | FileCheck -check-prefixes=VI-NOXNACK,GCN %s
5 ; RUN: llc < %s -mtriple=amdgcn -mcpu=stoney -mattr=-xnack -verify-machineinstrs | FileCheck -check-prefixes=VI-NOXNACK,GCN %s
7 ; RUN: llc < %s -mtriple=amdgcn -mcpu=carrizo -mattr=+xnack -verify-machineinstrs | FileCheck -check-prefix=VI-XNACK -check-prefix=GCN %s
8 ; RUN: llc < %s -mtriple=amdgcn -mcpu=stoney -mattr=+xnack -verify-machineinstrs | FileCheck -check-prefix=VI-XNACK -check-prefix=GCN %s
10 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs | FileCheck -check-prefixes=GCN %s
11 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=carrizo -mattr=-xnack -verify-machineinstrs | FileCheck -check-prefixes=VI-NOXNACK,HSA-VI-NOXNACK,GCN %s
12 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=carrizo -mattr=+xnack -verify-machineinstrs | FileCheck -check-prefixes=VI-XNACK,HSA-VI-XNACK,GCN %s
14 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx900 -mattr=+architected-flat-scratch -verify-machineinstrs | FileCheck -check-prefixes=GCN %s
15 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx900 -mattr=+architected-flat-scratch,-xnack -verify-machineinstrs | FileCheck -check-prefixes=HSA-VI-NOXNACK,GFX9-ARCH-FLAT,GCN %s
16 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx900 -mattr=+architected-flat-scratch,+xnack -verify-machineinstrs | FileCheck -check-prefixes=HSA-VI-XNACK,GFX9-ARCH-FLAT,GCN %s
18 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx1010 -mattr=+architected-flat-scratch -verify-machineinstrs | FileCheck -check-prefixes=GCN %s
19 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx1010 -mattr=+architected-flat-scratch,-xnack -verify-machineinstrs | FileCheck -check-prefixes=HSA-VI-NOXNACK,GFX10-ARCH-FLAT,GCN %s
20 ; RUN: llc < %s -mtriple=amdgcn -mtriple=amdgcn--amdhsa -mcpu=gfx1010 -mattr=+architected-flat-scratch,+xnack -verify-machineinstrs | FileCheck -check-prefixes=HSA-VI-XNACK,GFX10-ARCH-FLAT,GCN %s
22 ; GCN-LABEL: {{^}}no_vcc_no_flat:
24 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
25 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
26 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
29 ; VI-NOXNACK: ; NumSgprs: 8
30 ; VI-XNACK: ; NumSgprs: 12
31 ; GFX9-ARCH-FLAT: ; NumSgprs: 14
32 ; GFX10-ARCH-FLAT: ; NumSgprs: 8
33 define amdgpu_kernel void @no_vcc_no_flat() {
35 call void asm sideeffect "", "~{s7}"()
39 ; GCN-LABEL: {{^}}vcc_no_flat:
41 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
42 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
43 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
46 ; VI-NOXNACK: ; NumSgprs: 10
47 ; VI-XNACK: ; NumSgprs: 12
48 ; GFX9-ARCH-FLAT: ; NumSgprs: 14
49 ; GFX10-ARCH-FLAT: ; NumSgprs: 10
50 define amdgpu_kernel void @vcc_no_flat() {
52 call void asm sideeffect "", "~{s7},~{vcc}"()
56 ; GCN-LABEL: {{^}}no_vcc_flat:
58 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
59 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
60 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
63 ; VI-NOXNACK: ; NumSgprs: 14
64 ; VI-XNACK: ; NumSgprs: 14
65 ; GFX9-ARCH-FLAT: ; NumSgprs: 14
66 ; GFX10-ARCH-FLAT: ; NumSgprs: 8
67 define amdgpu_kernel void @no_vcc_flat() {
69 call void asm sideeffect "", "~{s7},~{flat_scratch}"()
73 ; GCN-LABEL: {{^}}vcc_flat:
75 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
76 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
77 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
80 ; VI-NOXNACK: ; NumSgprs: 14
81 ; VI-XNACK: ; NumSgprs: 14
82 ; GFX9-ARCH-FLAT: ; NumSgprs: 14
83 ; GFX10-ARCH-FLAT: ; NumSgprs: 10
84 define amdgpu_kernel void @vcc_flat() {
86 call void asm sideeffect "", "~{s7},~{vcc},~{flat_scratch}"()
90 ; Make sure used SGPR count for flat_scr is correct when there is no
91 ; scratch usage and implicit flat uses.
93 ; GCN-LABEL: {{^}}use_flat_scr:
95 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
96 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
97 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
100 ; VI-NOXNACK: NumSgprs: 6
101 ; VI-XNACK: NumSgprs: 6
102 ; GFX9-ARCH-FLAT: ; NumSgprs: 6
103 ; GFX10-ARCH-FLAT: ; NumSgprs: 0
104 define amdgpu_kernel void @use_flat_scr() #0 {
106 call void asm sideeffect "; clobber ", "~{flat_scratch}"()
110 ; GCN-LABEL: {{^}}use_flat_scr_lo:
112 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
113 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
114 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
117 ; VI-NOXNACK: NumSgprs: 6
118 ; VI-XNACK: NumSgprs: 6
119 ; GFX9-ARCH-FLAT: ; NumSgprs: 6
120 ; GFX10-ARCH-FLAT: ; NumSgprs: 0
121 define amdgpu_kernel void @use_flat_scr_lo() #0 {
123 call void asm sideeffect "; clobber ", "~{flat_scratch_lo}"()
127 ; GCN-LABEL: {{^}}use_flat_scr_hi:
129 ; NOT-HSA-CI: .amdhsa_reserve_xnack_mask
130 ; HSA-VI-NOXNACK: .amdhsa_reserve_xnack_mask 0
131 ; HSA-VI-XNACK: .amdhsa_reserve_xnack_mask 1
134 ; VI-NOXNACK: NumSgprs: 6
135 ; VI-XNACK: NumSgprs: 6
136 ; GFX9-ARCH-FLAT: ; NumSgprs: 6
137 ; GFX10-ARCH-FLAT: ; NumSgprs: 0
138 define amdgpu_kernel void @use_flat_scr_hi() #0 {
140 call void asm sideeffect "; clobber ", "~{flat_scratch_hi}"()
144 attributes #0 = { nounwind }
146 !llvm.module.flags = !{!0}
147 !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}