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*' -mtriple=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)
22 ; CHECK-NEXT: liveins: $sgpr2_sgpr3
24 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p4) = COPY $sgpr2_sgpr3
26 ; CHECK-NEXT: bb.1 (%ir-block.0):
27 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $sgpr8_sgpr9_sgpr10_sgpr11_sgpr12
28 %sgpr = call <4 x i32> asm sideeffect "; def $0", "={s[8:12]}" ()
29 call void asm sideeffect "; use $0", "s"(<4 x i32> %sgpr) #0
33 ; FIXME: This is crashing in the DAG
34 ; define amdgpu_kernel void @return_type_is_too_small_vector() {
35 ; %sgpr = call <4 x i32> asm sideeffect "; def $0", "={s[8:10]}" ()
36 ; call void asm sideeffect "; use $0", "s"(<4 x i32> %sgpr) #0
40 define i64 @return_type_is_too_big_scalar() {
41 ; CHECK-LABEL: name: return_type_is_too_big_scalar
43 ; CHECK-NEXT: successors: %bb.1(0x80000000)
45 ; CHECK-NEXT: bb.1 (%ir-block.0):
46 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8
47 %reg = call i64 asm sideeffect "; def $0", "={v8}" ()
51 define i32 @return_type_is_too_small_scalar() {
52 ; CHECK-LABEL: name: return_type_is_too_small_scalar
53 ; CHECK: bb.1 (%ir-block.0):
54 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8_vgpr9
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr8_vgpr9
56 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
57 ; CHECK-NEXT: $vgpr0 = COPY [[TRUNC]](s32)
58 ; CHECK-NEXT: SI_RETURN implicit $vgpr0
59 %reg = call i32 asm sideeffect "; def $0", "={v[8:9]}" ()
63 define ptr addrspace(1) @return_type_is_too_big_pointer() {
64 ; CHECK-LABEL: name: return_type_is_too_big_pointer
66 ; 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)
79 ; CHECK-NEXT: bb.1 (%ir-block.0):
80 ; CHECK-NEXT: INLINEASM &"; def $0", 1 /* sideeffect attdialect */, 10 /* regdef */, implicit-def $vgpr8_vgpr9
81 %reg = call ptr addrspace(3) asm sideeffect "; def $0", "={v[8:9]}" ()
82 ret ptr addrspace(3) %reg
85 define void @use_vector_too_small(<8 x i32> %arg) {
86 ; CHECK-LABEL: name: use_vector_too_small
87 ; CHECK: bb.1 (%ir-block.0):
88 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
90 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
91 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
92 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
93 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
94 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
95 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
96 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
97 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
98 ; 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)
99 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7 = COPY [[BUILD_VECTOR]](<8 x s32>)
100 ; CHECK-NEXT: INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 9 /* reguse */, $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7
101 ; CHECK-NEXT: SI_RETURN
102 call void asm sideeffect "; use $0", "{v[0:7]}"(<8 x i32> %arg)
106 define void @use_vector_too_big(<8 x i32> %arg) {
107 ; CHECK-LABEL: name: use_vector_too_big
109 ; CHECK-NEXT: successors: %bb.1(0x80000000)
110 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
112 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
113 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
114 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
115 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
116 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
117 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
118 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
119 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
120 ; 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)
122 ; CHECK-NEXT: bb.1 (%ir-block.0):
123 call void asm sideeffect "; use $0", "{v[0:9]}"(<8 x i32> %arg)
127 define void @use_scalar_too_small(i64 %arg) {
128 ; CHECK-LABEL: name: use_scalar_too_small
130 ; CHECK-NEXT: successors: %bb.1(0x80000000)
131 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
134 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
135 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
137 ; CHECK-NEXT: bb.1 (%ir-block.0):
138 call void asm sideeffect "; use $0", "{v0}"(i64 %arg)
142 define void @use_scalar_too_big(i32 %arg) {
143 ; CHECK-LABEL: name: use_scalar_too_big
144 ; CHECK: bb.1 (%ir-block.0):
145 ; CHECK-NEXT: liveins: $vgpr0
147 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
148 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
149 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ANYEXT]](s64)
150 ; CHECK-NEXT: INLINEASM &"; use $0", 1 /* sideeffect attdialect */, 9 /* reguse */, $vgpr0_vgpr1
151 ; CHECK-NEXT: SI_RETURN
152 call void asm sideeffect "; use $0", "{v[0:1]}"(i32 %arg)
156 define void @use_pointer_too_small(ptr addrspace(1) %arg) {
157 ; CHECK-LABEL: name: use_pointer_too_small
159 ; CHECK-NEXT: successors: %bb.1(0x80000000)
160 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
162 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
163 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
164 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
166 ; CHECK-NEXT: bb.1 (%ir-block.0):
167 call void asm sideeffect "; use $0", "{v0}"(ptr addrspace(1) %arg)
171 define void @use_pointer_too_big(ptr addrspace(3) %arg) {
172 ; CHECK-LABEL: name: use_pointer_too_big
174 ; CHECK-NEXT: successors: %bb.1(0x80000000)
175 ; CHECK-NEXT: liveins: $vgpr0
177 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
179 ; CHECK-NEXT: bb.1 (%ir-block.0):
180 call void asm sideeffect "; use $0", "{v[0:1]}"(ptr addrspace(3) %arg)