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