1 ; RUN: llc -mtriple=m68k -global-isel -stop-after=irtranslator < %s | FileCheck %s
4 ; CHECK: name: noArgRetVoid
6 define void @noArgRetVoid() {
10 %struct.A = type { i8, float, i32, i32, i32 }
12 define void @test_arg_lowering1(i8 %x, i8 %y) {
13 ; CHECK-LABEL: name: test_arg_lowering1
14 ; CHECK: bb.1 (%ir-block.0):
15 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
16 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
17 ; CHECK: [[G_TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD1]](s32)
18 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
19 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
20 ; CHECK: [[G_TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD2]](s32)
25 define void @test_arg_lowering2(i16 %x, i16 %y) {
26 ; CHECK-LABEL: name: test_arg_lowering2
27 ; CHECK: bb.1 (%ir-block.0):
28 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
29 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
30 ; CHECK: [[G_TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[G_LOAD1]](s32)
31 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
32 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
33 ; CHECK: [[G_TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[G_LOAD2]](s32)
38 define void @test_arg_lowering3(i32 %x, i32 %y) {
39 ; CHECK-LABEL: name: test_arg_lowering3
40 ; CHECK: bb.1 (%ir-block.0):
41 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
42 ; CHECK: {{%.*}} G_LOAD [[G_F_I1]](p0)
43 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
44 ; CHECK: {{%.*}} G_LOAD [[G_F_I2]](p0)
49 define void @test_arg_lowering_vector(<5 x i8> %x) {
50 ; CHECK-LABEL: name: test_arg_lowering_vector
51 ; CHECK: bb.1 (%ir-block.0):
52 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
53 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
54 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
55 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
56 ; CHECK: [[G_F_I3:%[0-9]+]]:_(p0) = G_FRAME_INDEX
57 ; CHECK: [[G_LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I3]](p0)
58 ; CHECK: [[G_F_I4:%[0-9]+]]:_(p0) = G_FRAME_INDEX
59 ; CHECK: [[G_LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I4]](p0)
60 ; CHECK: [[G_F_I5:%[0-9]+]]:_(p0) = G_FRAME_INDEX
61 ; CHECK: [[G_LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I5]](p0)
62 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<5 x s32>) = G_BUILD_VECTOR [[G_LOAD1]](s32), [[G_LOAD2]](s32), [[G_LOAD3]](s32), [[G_LOAD4]](s32), [[G_LOAD5]](s32)
63 ; CHECK: [[G_TRUNC:%[0-9]+]]:_(<5 x s8>) = G_TRUNC [[BUILD_VECTOR]](<5 x s32>)
68 define void @test_arg_lowering_array([5 x i8] %x) {
69 ; CHECK-LABEL: name: test_arg_lowering_array
70 ; CHECK: bb.1 (%ir-block.0):
71 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
72 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
73 ; CHECK: [[G_TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD1]](s32)
74 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
75 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
76 ; CHECK: [[G_TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD2]](s32)
77 ; CHECK: [[G_F_I3:%[0-9]+]]:_(p0) = G_FRAME_INDEX
78 ; CHECK: [[G_LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I3]](p0)
79 ; CHECK: [[G_TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD3]](s32)
80 ; CHECK: [[G_F_I4:%[0-9]+]]:_(p0) = G_FRAME_INDEX
81 ; CHECK: [[G_LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I4]](p0)
82 ; CHECK: [[G_TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD4]](s32)
83 ; CHECK: [[G_F_I5:%[0-9]+]]:_(p0) = G_FRAME_INDEX
84 ; CHECK: [[G_LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I5]](p0)
85 ; CHECK: [[G_TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD5]](s32)
90 define void @test_arg_lowering_double(double %x) {
91 ; CHECK-LABEL: name: test_arg_lowering_double
92 ; CHECK: bb.1 (%ir-block.0):
93 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
94 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
95 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
96 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
97 ; CHECK: [[G_MERGE_VAL:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[G_LOAD1]](s32), [[G_LOAD2]](s32)
102 define void @test_arg_lowering_float(float %x) {
103 ; CHECK-LABEL: name: test_arg_lowering_float
104 ; CHECK: bb.1 (%ir-block.0):
105 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
106 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
111 define void @test_arg_lowering_multiple(i1 %a, i8 %b, i16 %c, i32 %d, i64 %e, i128 %f){
112 ; CHECK-LABEL: name: test_arg_lowering_multiple
113 ; CHECK: bb.1 (%ir-block.0):
114 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
115 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
116 ; CHECK: [[G_TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[G_LOAD1]](s32)
117 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
118 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
119 ; CHECK: [[G_TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD2]](s32)
120 ; CHECK: [[G_F_I3:%[0-9]+]]:_(p0) = G_FRAME_INDEX
121 ; CHECK: [[G_LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I3]](p0)
122 ; CHECK: [[G_TRUNC3:%[0-9]+]]:_(s16) = G_TRUNC [[G_LOAD3]](s32)
123 ; CHECK: [[G_F_I4:%[0-9]+]]:_(p0) = G_FRAME_INDEX
124 ; CHECK: [[G_LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I4]](p0)
125 ; CHECK: [[G_F_I5:%[0-9]+]]:_(p0) = G_FRAME_INDEX
126 ; CHECK: [[G_LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I5]](p0)
127 ; CHECK: [[G_F_I6:%[0-9]+]]:_(p0) = G_FRAME_INDEX
128 ; CHECK: [[G_LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I6]](p0)
129 ; CHECK: [[G_MERGE_VAL:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[G_LOAD5]](s32), [[G_LOAD6]](s32)
130 ; CHECK: [[G_F_I7:%[0-9]+]]:_(p0) = G_FRAME_INDEX
131 ; CHECK: [[G_LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I7]](p0)
132 ; CHECK: [[G_F_I8:%[0-9]+]]:_(p0) = G_FRAME_INDEX
133 ; CHECK: [[G_LOAD8:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I8]](p0)
134 ; CHECK: [[G_F_I9:%[0-9]+]]:_(p0) = G_FRAME_INDEX
135 ; CHECK: [[G_LOAD9:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I9]](p0)
136 ; CHECK: [[G_F_I10:%[0-9]+]]:_(p0) = G_FRAME_INDEX
137 ; CHECK: [[G_LOAD10:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I10]](p0)
138 ; CHECK: [[G_MERGE_VAL:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[G_LOAD7]](s32), [[G_LOAD8]](s32), [[G_LOAD9]](s32), [[G_LOAD10]](s32)
143 define void @test_arg_lowering_ptr(ptr %x) {
144 ; CHECK-LABEL: name: test_arg_lowering_ptr
145 ; CHECK: bb.1 (%ir-block.0):
146 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
147 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[G_F_I1]](p0)
152 define void @test_arg_lowering_float_ptr(ptr %x) {
153 ; CHECK-LABEL: name: test_arg_lowering_float_ptr
154 ; CHECK: bb.1 (%ir-block.0):
155 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
156 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[G_F_I1]](p0)
161 define void @test_arg_lowering_struct(%struct.A %a) #0 {
162 ; CHECK-LABEL: name: test_arg_lowering_struct
163 ; CHECK: bb.1 (%ir-block.0):
164 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
165 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
166 ; CHECK: [[G_TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD1]](s32)
167 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
168 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
169 ; CHECK: [[G_F_I3:%[0-9]+]]:_(p0) = G_FRAME_INDEX
170 ; CHECK: [[G_LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I3]](p0)
171 ; CHECK: [[G_F_I4:%[0-9]+]]:_(p0) = G_FRAME_INDEX
172 ; CHECK: [[G_LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I4]](p0)
173 ; CHECK: [[G_F_I5:%[0-9]+]]:_(p0) = G_FRAME_INDEX
174 ; CHECK: [[G_LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I5]](p0)
179 define i8 @test_ret1(i8 %a) {
180 ; CHECK-LABEL: name: test_ret1
181 ; CHECK: bb.1 (%ir-block.0):
182 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
183 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
184 ; CHECK: [[G_TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[G_LOAD1]](s32)
185 ; CHECK: $bd0 = COPY [[G_TRUNC1]](s8)
186 ; CHECK: RTS implicit $bd0
190 define i32 @test_ret2(i32 %a) {
191 ; CHECK-LABEL: name: test_ret2
192 ; CHECK: bb.1 (%ir-block.0):
193 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
194 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
195 ; CHECK: $d0 = COPY [[G_LOAD1]](s32)
196 ; CHECK: RTS implicit $d0
200 define i64 @test_ret3(i64 %a) {
201 ; CHECK-LABEL: name: test_ret3
202 ; CHECK: bb.1 (%ir-block.0):
203 ; CHECK: [[G_F_I1:%[0-9]+]]:_(p0) = G_FRAME_INDEX
204 ; CHECK: [[G_LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I1]](p0)
205 ; CHECK: [[G_F_I2:%[0-9]+]]:_(p0) = G_FRAME_INDEX
206 ; CHECK: [[G_LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[G_F_I2]](p0)
207 ; CHECK: [[G_MERGE_VAL:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[G_LOAD1]](s32), [[G_LOAD2]](s32)
208 ; CHECK: [[G_UNMERGE_VAL1:%[0-9]+]]:_(s32), [[G_UNMERGE_VAL2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[G_MERGE_VAL]](s64)
209 ; CHECK: $d1 = COPY [[G_UNMERGE_VAL1]](s32)
210 ; CHECK: $d0 = COPY [[G_UNMERGE_VAL2]](s32)
211 ; CHECK: RTS implicit $d1, implicit $d0