1# RUN: llc -march=amdgcn -mcpu=gfx802 -start-before postrapseudos -asm-verbose=0 -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
2# RUN: llc -march=amdgcn -mcpu=gfx900 -start-before postrapseudos -asm-verbose=0 -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
3# RUN: llc -march=amdgcn -mcpu=gfx1010 -start-before postrapseudos -asm-verbose=0 -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GCN,GFX10 %s
4
5# GCN-LABEL: {{^}}lo_to_lo:
6# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
7name: lo_to_lo
8tracksRegLiveness: true
9body:             |
10  bb.0:
11    $vgpr0 = IMPLICIT_DEF
12    $vgpr1_lo16 = COPY $vgpr0_lo16
13    S_ENDPGM 0
14...
15
16# GCN-LABEL: {{^}}lo_to_hi:
17# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
18name: lo_to_hi
19tracksRegLiveness: true
20body:             |
21  bb.0:
22    $vgpr0 = IMPLICIT_DEF
23    $vgpr1_hi16 = COPY killed $vgpr0_lo16
24    S_ENDPGM 0
25...
26
27# GCN-LABEL: {{^}}hi_to_lo:
28# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
29name: hi_to_lo
30tracksRegLiveness: true
31body:             |
32  bb.0:
33    $vgpr0 = IMPLICIT_DEF
34    $vgpr1_lo16 = COPY $vgpr0_hi16
35    S_ENDPGM 0
36...
37
38# GCN-LABEL: {{^}}hi_to_hi:
39# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
40name: hi_to_hi
41tracksRegLiveness: true
42body:             |
43  bb.0:
44    $vgpr0 = IMPLICIT_DEF
45    $vgpr1_hi16 = COPY $vgpr0_hi16
46    S_ENDPGM 0
47...
48
49# GCN-LABEL: {{^}}lo_to_lo_samereg:
50# GCN:        s_waitcnt
51# GFX10-NEXT: s_waitcnt_vscnt
52# GCN-NEXT:   s_endpgm
53name: lo_to_lo_samereg
54tracksRegLiveness: true
55body:             |
56  bb.0:
57    $vgpr0 = IMPLICIT_DEF
58    $vgpr0_lo16 = COPY $vgpr0_lo16
59    S_ENDPGM 0
60...
61
62# GCN-LABEL: {{^}}lo_to_hi_samereg:
63# GCN: v_mov_b32_sdwa v0, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
64name: lo_to_hi_samereg
65tracksRegLiveness: true
66body:             |
67  bb.0:
68    $vgpr0 = IMPLICIT_DEF
69    $vgpr0_hi16 = COPY $vgpr0_lo16
70    S_ENDPGM 0
71...
72
73# GCN-LABEL: {{^}}hi_to_lo_samereg:
74# GCN: v_mov_b32_sdwa v0, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
75name: hi_to_lo_samereg
76tracksRegLiveness: true
77body:             |
78  bb.0:
79    $vgpr0 = IMPLICIT_DEF
80    $vgpr0_lo16 = COPY killed $vgpr0_hi16
81    S_ENDPGM 0
82...
83
84# GCN-LABEL: {{^}}hi_to_hi_samereg:
85# GCN:      s_waitcnt
86# GFX10-NEXT: s_waitcnt_vscnt
87# GCN-NEXT: s_endpgm
88name: hi_to_hi_samereg
89tracksRegLiveness: true
90body:             |
91  bb.0:
92    $vgpr0 = IMPLICIT_DEF
93    $vgpr0_hi16 = COPY killed $vgpr0_hi16
94    S_ENDPGM 0
95...
96
97# GCN-LABEL: {{^}}lo_to_lo_def_livein:
98# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
99name: lo_to_lo_def_livein
100tracksRegLiveness: true
101body:             |
102  bb.0:
103    liveins: $vgpr0
104
105    $vgpr1 = IMPLICIT_DEF
106    $vgpr1_lo16 = COPY $vgpr0_lo16
107    S_ENDPGM 0
108...
109
110# GCN-LABEL: {{^}}lo_to_hi_def_livein:
111# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
112name: lo_to_hi_def_livein
113tracksRegLiveness: true
114body:             |
115  bb.0:
116    liveins: $vgpr0
117
118    $vgpr1 = IMPLICIT_DEF
119    $vgpr1_hi16 = COPY $vgpr0_lo16
120    S_ENDPGM 0
121...
122
123# GCN-LABEL: {{^}}hi_to_lo_def_livein:
124# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
125name: hi_to_lo_def_livein
126tracksRegLiveness: true
127body:             |
128  bb.0:
129    liveins: $vgpr0
130
131    $vgpr1 = IMPLICIT_DEF
132    $vgpr1_lo16 = COPY killed $vgpr0_hi16
133    S_ENDPGM 0
134...
135
136# GCN-LABEL: {{^}}hi_to_hi_def_livein:
137# GCN: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
138name: hi_to_hi_def_livein
139tracksRegLiveness: true
140body:             |
141  bb.0:
142    liveins: $vgpr0
143
144    $vgpr1 = IMPLICIT_DEF
145    $vgpr1_hi16 = COPY $vgpr0_hi16
146    S_ENDPGM 0
147...
148
149# TODO: This can be coalesced into a VGPR_32 copy
150# GCN-LABEL: {{^}}lo_to_lo_hi_to_hi:
151# GCN:      v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
152# GCN-NEXT: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
153# GCN-NEXT: v_mov_b32_e32 v2, v1
154# GCN-NEXT: s_endpgm
155name: lo_to_lo_hi_to_hi
156tracksRegLiveness: true
157body:             |
158  bb.0:
159    $vgpr0 = IMPLICIT_DEF
160    $vgpr1_lo16 = COPY $vgpr0_lo16
161    $vgpr1_hi16 = COPY $vgpr0_hi16
162    $vgpr2 = COPY killed $vgpr1
163    S_ENDPGM 0
164...
165
166# GCN-LABEL: {{^}}lo_to_hi_hi_to_lo:
167# GCN:      v_mov_b32_sdwa v1, v0 dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:WORD_1
168# GCN-NEXT: v_mov_b32_sdwa v1, v0 dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:WORD_0
169# GCN-NEXT: v_mov_b32_e32 v2, v1
170# GCN-NEXT: s_endpgm
171name: lo_to_hi_hi_to_lo
172tracksRegLiveness: true
173body:             |
174  bb.0:
175    $vgpr0 = IMPLICIT_DEF
176    $vgpr1_lo16 = COPY $vgpr0_hi16
177    $vgpr1_hi16 = COPY $vgpr0_lo16
178    $vgpr2 = COPY killed $vgpr1
179    S_ENDPGM 0
180...
181
182# NB: copy of undef just killed instead of expansion
183# GCN-LABEL: {{^}}lo_to_lo_undef:
184# GCN:        s_waitcnt
185# GFX10-NEXT: s_waitcnt_vscnt
186# GCN-NEXT:   v_mov_b32_e32 v2, v1
187# GCN-NEXT:   s_endpgm
188name: lo_to_lo_undef
189tracksRegLiveness: true
190body:             |
191  bb.0:
192    $vgpr1_lo16 = COPY undef $vgpr0_lo16
193    $vgpr2 = COPY killed $vgpr1
194    S_ENDPGM 0
195...
196
197# GCN-LABEL: {{^}}lo_to_lo_sgpr_to_sgpr:
198# GCN: s_mov_b32 s1, s0
199name: lo_to_lo_sgpr_to_sgpr
200tracksRegLiveness: true
201body:             |
202  bb.0:
203    $sgpr0 = IMPLICIT_DEF
204    $sgpr1_lo16 = COPY $sgpr0_lo16
205    S_ENDPGM 0
206...
207