1# RUN: llc -amdgpu-global-isel-new-legality -march=amdgcn -mcpu=hawaii -run-pass=instruction-select -verify-machineinstrs  -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7 %s
2# RUN: llc -amdgpu-global-isel-new-legality -march=amdgcn -mcpu=hawaii -mattr=+flat-for-global -run-pass=instruction-select -verify-machineinstrs  -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX7-FLAT %s
3# RUN: llc -amdgpu-global-isel-new-legality -march=amdgcn -mcpu=fiji -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX8 %s
4# RUN: llc -amdgpu-global-isel-new-legality -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX9 %s
5# RUN: llc -amdgpu-global-isel-new-legality -march=amdgcn -mcpu=gfx1010 -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=0 -o - %s | FileCheck -check-prefix=GFX10 %s
6
7---
8
9name: load_global_v3s32
10legalized:       true
11regBankSelected: true
12tracksRegLiveness: true
13
14body: |
15  bb.0:
16    liveins:  $vgpr0_vgpr1
17
18    ; GFX7-LABEL: name: load_global_v3s32
19    ; GFX7: liveins: $vgpr0_vgpr1
20    ; GFX7: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
21    ; GFX7: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 0
22    ; GFX7: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 61440
23    ; GFX7: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[S_MOV_B32_]], %subreg.sub0, [[S_MOV_B32_1]], %subreg.sub1
24    ; GFX7: [[S_MOV_B64_:%[0-9]+]]:sreg_64 = S_MOV_B64 0
25    ; GFX7: [[REG_SEQUENCE1:%[0-9]+]]:sgpr_128 = REG_SEQUENCE [[S_MOV_B64_]], %subreg.sub0_sub1, [[REG_SEQUENCE]], %subreg.sub2_sub3
26    ; GFX7: [[BUFFER_LOAD_DWORDX3_ADDR64_:%[0-9]+]]:vreg_96 = BUFFER_LOAD_DWORDX3_ADDR64 [[COPY]], [[REG_SEQUENCE1]], 0, 0, 0, 0, 0, 0, 0, implicit $exec :: (load 12, align 4, addrspace 1)
27    ; GFX7: $vgpr0_vgpr1_vgpr2 = COPY [[BUFFER_LOAD_DWORDX3_ADDR64_]]
28    ; GFX7-FLAT-LABEL: name: load_global_v3s32
29    ; GFX7-FLAT: liveins: $vgpr0_vgpr1
30    ; GFX7-FLAT: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
31    ; GFX7-FLAT: [[FLAT_LOAD_DWORDX3_:%[0-9]+]]:vreg_96 = FLAT_LOAD_DWORDX3 [[COPY]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 12, align 4, addrspace 1)
32    ; GFX7-FLAT: $vgpr0_vgpr1_vgpr2 = COPY [[FLAT_LOAD_DWORDX3_]]
33    ; GFX8-LABEL: name: load_global_v3s32
34    ; GFX8: liveins: $vgpr0_vgpr1
35    ; GFX8: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
36    ; GFX8: [[FLAT_LOAD_DWORDX3_:%[0-9]+]]:vreg_96 = FLAT_LOAD_DWORDX3 [[COPY]], 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 12, align 4, addrspace 1)
37    ; GFX8: $vgpr0_vgpr1_vgpr2 = COPY [[FLAT_LOAD_DWORDX3_]]
38    ; GFX9-LABEL: name: load_global_v3s32
39    ; GFX9: liveins: $vgpr0_vgpr1
40    ; GFX9: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
41    ; GFX9: [[GLOBAL_LOAD_DWORDX3_:%[0-9]+]]:vreg_96 = GLOBAL_LOAD_DWORDX3 [[COPY]], 0, 0, 0, 0, implicit $exec :: (load 12, align 4, addrspace 1)
42    ; GFX9: $vgpr0_vgpr1_vgpr2 = COPY [[GLOBAL_LOAD_DWORDX3_]]
43    ; GFX10-LABEL: name: load_global_v3s32
44    ; GFX10: liveins: $vgpr0_vgpr1
45    ; GFX10: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
46    ; GFX10: [[GLOBAL_LOAD_DWORDX3_:%[0-9]+]]:vreg_96 = GLOBAL_LOAD_DWORDX3 [[COPY]], 0, 0, 0, 0, implicit $exec :: (load 12, align 4, addrspace 1)
47    ; GFX10: $vgpr0_vgpr1_vgpr2 = COPY [[GLOBAL_LOAD_DWORDX3_]]
48    %0:vgpr(p1) = COPY $vgpr0_vgpr1
49    %1:vgpr(<3 x  s32>) = G_LOAD %0 :: (load 12, align 4, addrspace 1)
50    $vgpr0_vgpr1_vgpr2 = COPY %1
51
52...
53
54---
55
56name: load_global_s96
57legalized:       true
58regBankSelected: true
59tracksRegLiveness: true
60
61body: |
62  bb.0:
63    liveins:  $vgpr0_vgpr1
64
65    ; GFX7-LABEL: name: load_global_s96
66    ; GFX7: liveins: $vgpr0_vgpr1
67    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
68    ; GFX7: [[LOAD:%[0-9]+]]:vreg_96(s96) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
69    ; GFX7: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](s96)
70    ; GFX7-FLAT-LABEL: name: load_global_s96
71    ; GFX7-FLAT: liveins: $vgpr0_vgpr1
72    ; GFX7-FLAT: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
73    ; GFX7-FLAT: [[LOAD:%[0-9]+]]:vreg_96(s96) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
74    ; GFX7-FLAT: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](s96)
75    ; GFX8-LABEL: name: load_global_s96
76    ; GFX8: liveins: $vgpr0_vgpr1
77    ; GFX8: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
78    ; GFX8: [[LOAD:%[0-9]+]]:vreg_96(s96) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
79    ; GFX8: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](s96)
80    ; GFX9-LABEL: name: load_global_s96
81    ; GFX9: liveins: $vgpr0_vgpr1
82    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
83    ; GFX9: [[LOAD:%[0-9]+]]:vreg_96(s96) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
84    ; GFX9: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](s96)
85    ; GFX10-LABEL: name: load_global_s96
86    ; GFX10: liveins: $vgpr0_vgpr1
87    ; GFX10: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
88    ; GFX10: [[LOAD:%[0-9]+]]:vreg_96(s96) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
89    ; GFX10: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](s96)
90    %0:vgpr(p1) = COPY $vgpr0_vgpr1
91    %1:vgpr(s96) = G_LOAD %0 :: (load 12, align 4, addrspace 1)
92    $vgpr0_vgpr1_vgpr2 = COPY %1
93
94...
95
96---
97
98name: load_global_v6s16
99legalized:       true
100regBankSelected: true
101tracksRegLiveness: true
102
103body: |
104  bb.0:
105    liveins:  $vgpr0_vgpr1
106
107    ; GFX7-LABEL: name: load_global_v6s16
108    ; GFX7: liveins: $vgpr0_vgpr1
109    ; GFX7: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
110    ; GFX7: [[LOAD:%[0-9]+]]:vreg_96(<6 x s16>) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
111    ; GFX7: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](<6 x s16>)
112    ; GFX7-FLAT-LABEL: name: load_global_v6s16
113    ; GFX7-FLAT: liveins: $vgpr0_vgpr1
114    ; GFX7-FLAT: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
115    ; GFX7-FLAT: [[LOAD:%[0-9]+]]:vreg_96(<6 x s16>) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
116    ; GFX7-FLAT: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](<6 x s16>)
117    ; GFX8-LABEL: name: load_global_v6s16
118    ; GFX8: liveins: $vgpr0_vgpr1
119    ; GFX8: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
120    ; GFX8: [[LOAD:%[0-9]+]]:vreg_96(<6 x s16>) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
121    ; GFX8: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](<6 x s16>)
122    ; GFX9-LABEL: name: load_global_v6s16
123    ; GFX9: liveins: $vgpr0_vgpr1
124    ; GFX9: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
125    ; GFX9: [[LOAD:%[0-9]+]]:vreg_96(<6 x s16>) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
126    ; GFX9: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](<6 x s16>)
127    ; GFX10-LABEL: name: load_global_v6s16
128    ; GFX10: liveins: $vgpr0_vgpr1
129    ; GFX10: [[COPY:%[0-9]+]]:vgpr(p1) = COPY $vgpr0_vgpr1
130    ; GFX10: [[LOAD:%[0-9]+]]:vreg_96(<6 x s16>) = G_LOAD [[COPY]](p1) :: (load 12, align 4, addrspace 1)
131    ; GFX10: $vgpr0_vgpr1_vgpr2 = COPY [[LOAD]](<6 x s16>)
132    %0:vgpr(p1) = COPY $vgpr0_vgpr1
133    %1:vgpr(<6 x  s16>) = G_LOAD %0 :: (load 12, align 4, addrspace 1)
134    $vgpr0_vgpr1_vgpr2 = COPY %1
135
136...
137
138