1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s
4 # Post-legalizer should not generate illegal extending loads
6 name: sextload_from_inreg
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: sextload_from_inreg
13 ; CHECK: liveins: $vgpr0_vgpr1
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
16 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p1) :: (load (s64), addrspace 1)
17 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[LOAD]], 8
18 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[SEXT_INREG]](s64)
19 %0:_(p1) = COPY $vgpr0_vgpr1
20 %1:_(s64) = G_LOAD %0 :: (load (s64), align 8, addrspace 1)
21 %2:_(s64) = G_SEXT_INREG %1, 8
22 $vgpr0_vgpr1 = COPY %2
25 # Legal to fold into sextload
27 name: sext_inreg_8_sextload_s32
28 tracksRegLiveness: true
33 ; CHECK-LABEL: name: sext_inreg_8_sextload_s32
34 ; CHECK: liveins: $vgpr0_vgpr1
36 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
37 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), align 4, addrspace 1)
38 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
39 %0:_(p1) = COPY $vgpr0_vgpr1
40 %1:_(s32) = G_LOAD %0 :: (load (s32), align 4, addrspace 1)
41 %2:_(s32) = G_SEXT_INREG %1, 8
46 name: sext_inreg_7_sextload_s32
47 tracksRegLiveness: true
52 ; CHECK-LABEL: name: sext_inreg_7_sextload_s32
53 ; CHECK: liveins: $vgpr0_vgpr1
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
56 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s32), addrspace 1)
57 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[LOAD]], 7
58 ; CHECK-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
59 %0:_(p1) = COPY $vgpr0_vgpr1
60 %1:_(s32) = G_LOAD %0 :: (load (s32), align 4, addrspace 1)
61 %2:_(s32) = G_SEXT_INREG %1, 7
66 name: sext_inreg_9_sextload_s32
67 tracksRegLiveness: true
72 ; CHECK-LABEL: name: sext_inreg_9_sextload_s32
73 ; CHECK: liveins: $vgpr0_vgpr1
75 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
76 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s32), addrspace 1)
77 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[LOAD]], 9
78 ; CHECK-NEXT: $vgpr0 = COPY [[SEXT_INREG]](s32)
79 %0:_(p1) = COPY $vgpr0_vgpr1
80 %1:_(s32) = G_LOAD %0 :: (load (s32), align 4, addrspace 1)
81 %2:_(s32) = G_SEXT_INREG %1, 9
85 # Legal to fold into sextload
87 name: sext_inreg_16_sextload_s32
88 tracksRegLiveness: true
93 ; CHECK-LABEL: name: sext_inreg_16_sextload_s32
94 ; CHECK: liveins: $vgpr0_vgpr1
96 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
97 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s16), align 4, addrspace 1)
98 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
99 %0:_(p1) = COPY $vgpr0_vgpr1
100 %1:_(s32) = G_LOAD %0 :: (load (s32), align 4, addrspace 1)
101 %2:_(s32) = G_SEXT_INREG %1, 16
106 name: sext_inreg_8_sextload_s8
107 tracksRegLiveness: true
111 liveins: $vgpr0_vgpr1
112 ; CHECK-LABEL: name: sext_inreg_8_sextload_s8
113 ; CHECK: liveins: $vgpr0_vgpr1
115 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
116 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s8), addrspace 1)
117 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
118 %0:_(p1) = COPY $vgpr0_vgpr1
119 %1:_(s32) = G_LOAD %0 :: (load (s8), align 1, addrspace 1)
120 %2:_(s32) = G_SEXT_INREG %1, 8
125 name: sext_inreg_8_sextload_s8_volatile
126 tracksRegLiveness: true
130 liveins: $vgpr0_vgpr1
131 ; CHECK-LABEL: name: sext_inreg_8_sextload_s8_volatile
132 ; CHECK: liveins: $vgpr0_vgpr1
134 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
135 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (volatile load (s8), addrspace 1)
136 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (volatile load (s8), addrspace 1)
137 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
138 %0:_(p1) = COPY $vgpr0_vgpr1
139 %1:_(s32) = G_LOAD %0 :: (volatile load (s8), align 1, addrspace 1)
140 %2:_(s32) = G_SEXT_INREG %1, 8
145 name: sext_inreg_16_sextload_s16
146 tracksRegLiveness: true
150 liveins: $vgpr0_vgpr1
151 ; CHECK-LABEL: name: sext_inreg_16_sextload_s16
152 ; CHECK: liveins: $vgpr0_vgpr1
154 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
155 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load (s16), addrspace 1)
156 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
157 %0:_(p1) = COPY $vgpr0_vgpr1
158 %1:_(s32) = G_LOAD %0 :: (load (s16), align 2, addrspace 1)
159 %2:_(s32) = G_SEXT_INREG %1, 16
164 name: sext_inreg_16_sextload_s16_volatile
165 tracksRegLiveness: true
169 liveins: $vgpr0_vgpr1
170 ; CHECK-LABEL: name: sext_inreg_16_sextload_s16_volatile
171 ; CHECK: liveins: $vgpr0_vgpr1
173 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
174 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (volatile load (s16), addrspace 1)
175 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (volatile load (s16), addrspace 1)
176 ; CHECK-NEXT: $vgpr0 = COPY [[SEXTLOAD]](s32)
177 %0:_(p1) = COPY $vgpr0_vgpr1
178 %1:_(s32) = G_LOAD %0 :: (volatile load (s16), align 2, addrspace 1)
179 %2:_(s32) = G_SEXT_INREG %1, 16