1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -global-isel -global-isel-abort=2 -pass-remarks-missed='gisel*' -march=amdgcn -mcpu=fiji -stop-after=irtranslator -verify-machineinstrs %s -o - 2>%t | FileCheck %s
3 ; RUN: FileCheck -check-prefix=ERR %s < %t
5 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' %sgpr = call <4 x i32> asm sideeffect "; def $0", "={s[8:12]}"()' (in function: return_type_is_too_big_vector)
6 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' %reg = call i64 asm sideeffect "; def $0", "={v8}"()' (in function: return_type_is_too_big_scalar)
7 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' %reg = call ptr addrspace(1) asm sideeffect "; def $0", "={v8}"()' (in function: return_type_is_too_big_pointer)
8 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' %reg = call ptr addrspace(3) asm sideeffect "; def $0", "={v[8:9]}"()' (in function: return_type_is_too_small_pointer)
9 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' call void asm sideeffect "; use $0", "{v[0:9]}"(<8 x i32> %arg)' (in function: use_vector_too_big)
10 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' call void asm sideeffect "; use $0", "{v0}"(i64 %arg)' (in function: use_scalar_too_small)
11 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' call void asm sideeffect "; use $0", "{v0}"(ptr addrspace(1) %arg)' (in function: use_pointer_too_small)
12 ; ERR: remark: <unknown>:0:0: unable to translate instruction: call: ' call void asm sideeffect "; use $0", "{v[0:1]}"(ptr addrspace(3) %arg)' (in function: use_pointer_too_big)
15 ; This asm is broken because it's using a 5 element wide physical
16 ; register for a 4 element wide value. Make sure we don't crash, and
17 ; take the IR type as truth.
18 define amdgpu_kernel void @return_type_is_too_big_vector() {
19 ; CHECK-LABEL: name: return_type_is_too_big_vector
21 ; CHECK-NEXT: successors: %bb.1(0x80000000)
24 ; CHECK-NEXT: bb.1 (%ir-block.0):
25 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11_sgpr12
26 %sgpr = call <4 x i32> asm sideeffect "; def $0", "={s[8:12]}" ()
27 call void asm sideeffect "; use $0", "s"(<4 x i32> %sgpr) #0
31 ; FIXME: This is crashing in the DAG
32 ; define amdgpu_kernel void @return_type_is_too_small_vector() {
33 ; %sgpr = call <4 x i32> asm sideeffect "; def $0", "={s[8:10]}" ()
34 ; call void asm sideeffect "; use $0", "s"(<4 x i32> %sgpr) #0
38 define i64 @return_type_is_too_big_scalar() {
39 ; CHECK-LABEL: name: return_type_is_too_big_scalar
41 ; CHECK-NEXT: successors: %bb.1(0x80000000)
44 ; CHECK-NEXT: bb.1 (%ir-block.0):
45 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8
46 %reg = call i64 asm sideeffect "; def $0", "={v8}" ()
50 define i32 @return_type_is_too_small_scalar() {
51 ; CHECK-LABEL: name: return_type_is_too_small_scalar
52 ; CHECK: bb.1 (%ir-block.0):
53 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8_vgpr9
54 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr8_vgpr9
55 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
56 ; CHECK-NEXT: $vgpr0 = COPY [[TRUNC]](s32)
57 ; CHECK-NEXT: SI_RETURN implicit $vgpr0
58 %reg = call i32 asm sideeffect "; def $0", "={v[8:9]}" ()
62 define ptr addrspace(1) @return_type_is_too_big_pointer() {
63 ; CHECK-LABEL: name: return_type_is_too_big_pointer
65 ; CHECK-NEXT: successors: %bb.1(0x80000000)
68 ; CHECK-NEXT: bb.1 (%ir-block.0):
69 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8
70 %reg = call ptr addrspace(1) asm sideeffect "; def $0", "={v8}" ()
71 ret ptr addrspace(1) %reg
74 define ptr addrspace(3) @return_type_is_too_small_pointer() {
75 ; CHECK-LABEL: name: return_type_is_too_small_pointer
77 ; CHECK-NEXT: successors: %bb.1(0x80000000)
80 ; CHECK-NEXT: bb.1 (%ir-block.0):
81 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8_vgpr9
82 %reg = call ptr addrspace(3) asm sideeffect "; def $0", "={v[8:9]}" ()
83 ret ptr addrspace(3) %reg
86 define void @use_vector_too_small(<8 x i32> %arg) {
87 ; CHECK-LABEL: name: use_vector_too_small
88 ; CHECK: bb.1 (%ir-block.0):
89 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
91 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
92 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
93 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
94 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
95 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
96 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
97 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
98 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
99 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<8 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32), [[COPY4]](s32), [[COPY5]](s32), [[COPY6]](s32), [[COPY7]](s32)
100 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7 = COPY [[BUILD_VECTOR]](<8 x s32>)
101 ; CHECK-NEXT: INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 9 /* reguse */, $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
102 ; CHECK-NEXT: SI_RETURN
103 call void asm sideeffect "; use $0", "{v[0:7]}"(<8 x i32> %arg)
107 define void @use_vector_too_big(<8 x i32> %arg) {
108 ; CHECK-LABEL: name: use_vector_too_big
110 ; CHECK-NEXT: successors: %bb.1(0x80000000)
111 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
113 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
114 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
115 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
116 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
117 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
118 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
119 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
120 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
121 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<8 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32), [[COPY4]](s32), [[COPY5]](s32), [[COPY6]](s32), [[COPY7]](s32)
123 ; CHECK-NEXT: bb.1 (%ir-block.0):
124 call void asm sideeffect "; use $0", "{v[0:9]}"(<8 x i32> %arg)
128 define void @use_scalar_too_small(i64 %arg) {
129 ; CHECK-LABEL: name: use_scalar_too_small
131 ; CHECK-NEXT: successors: %bb.1(0x80000000)
132 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
134 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
135 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
136 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
138 ; CHECK-NEXT: bb.1 (%ir-block.0):
139 call void asm sideeffect "; use $0", "{v0}"(i64 %arg)
143 define void @use_scalar_too_big(i32 %arg) {
144 ; CHECK-LABEL: name: use_scalar_too_big
145 ; CHECK: bb.1 (%ir-block.0):
146 ; CHECK-NEXT: liveins: $vgpr0
148 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
149 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
150 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ANYEXT]](s64)
151 ; CHECK-NEXT: INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 9 /* reguse */, $vgpr0_vgpr1
152 ; CHECK-NEXT: SI_RETURN
153 call void asm sideeffect "; use $0", "{v[0:1]}"(i32 %arg)
157 define void @use_pointer_too_small(ptr addrspace(1) %arg) {
158 ; CHECK-LABEL: name: use_pointer_too_small
160 ; CHECK-NEXT: successors: %bb.1(0x80000000)
161 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
163 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
164 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
165 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
167 ; CHECK-NEXT: bb.1 (%ir-block.0):
168 call void asm sideeffect "; use $0", "{v0}"(ptr addrspace(1) %arg)
172 define void @use_pointer_too_big(ptr addrspace(3) %arg) {
173 ; CHECK-LABEL: name: use_pointer_too_big
175 ; CHECK-NEXT: successors: %bb.1(0x80000000)
176 ; CHECK-NEXT: liveins: $vgpr0
178 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
180 ; CHECK-NEXT: bb.1 (%ir-block.0):
181 call void asm sideeffect "; use $0", "{v[0:1]}"(ptr addrspace(3) %arg)