1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -O0 -mtriple=i386-linux-gnu -mattr=+sse2 -global-isel -stop-after=irtranslator < %s | FileCheck %s --check-prefix=X86
3 ; RUN: llc -O0 -mtriple=x86_64-linux-gnu -global-isel -stop-after=irtranslator < %s | FileCheck %s --check-prefix=X64
5 @a1_8bit = external global i8
6 @a7_8bit = external global i8
7 @a8_8bit = external global i8
8 %struct.all = type { i8, i16, i32, i8, i16, i32, i64, float, double }
10 define i8 @test_i8_args_8(i8 %arg1, i8 %arg2, i8 %arg3, i8 %arg4, i8 %arg5, i8 %arg6, i8 %arg7, i8 %arg8) {
11 ; X86-LABEL: name: test_i8_args_8
13 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
14 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s8) from %fixed-stack.7, align 16)
15 ; X86-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
16 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
17 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s8) from %fixed-stack.6, align 4)
18 ; X86-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD1]](s32)
19 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
20 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s8) from %fixed-stack.5, align 8)
21 ; X86-NEXT: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD2]](s32)
22 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
23 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s8) from %fixed-stack.4, align 4)
24 ; X86-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD3]](s32)
25 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
26 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s8) from %fixed-stack.3, align 16)
27 ; X86-NEXT: [[TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD4]](s32)
28 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
29 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s8) from %fixed-stack.2, align 4)
30 ; X86-NEXT: [[TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD5]](s32)
31 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
32 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s8) from %fixed-stack.1, align 8)
33 ; X86-NEXT: [[TRUNC6:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD6]](s32)
34 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
35 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s8) from %fixed-stack.0, align 4)
36 ; X86-NEXT: [[TRUNC7:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD7]](s32)
37 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_8bit
38 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_8bit
39 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_8bit
40 ; X86-NEXT: G_STORE [[TRUNC]](s8), [[GV]](p0) :: (store (s8) into @a1_8bit)
41 ; X86-NEXT: G_STORE [[TRUNC6]](s8), [[GV1]](p0) :: (store (s8) into @a7_8bit)
42 ; X86-NEXT: G_STORE [[TRUNC7]](s8), [[GV2]](p0) :: (store (s8) into @a8_8bit)
43 ; X86-NEXT: $al = COPY [[TRUNC]](s8)
44 ; X86-NEXT: RET 0, implicit $al
46 ; X64-LABEL: name: test_i8_args_8
48 ; X64-NEXT: liveins: $ecx, $edi, $edx, $esi, $r8d, $r9d
50 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
51 ; X64-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
52 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
53 ; X64-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
54 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
55 ; X64-NEXT: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s32)
56 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $ecx
57 ; X64-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[COPY3]](s32)
58 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $r8d
59 ; X64-NEXT: [[TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[COPY4]](s32)
60 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $r9d
61 ; X64-NEXT: [[TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s32)
62 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
63 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s8) from %fixed-stack.1, align 16)
64 ; X64-NEXT: [[TRUNC6:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
65 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
66 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s8) from %fixed-stack.0, align 8)
67 ; X64-NEXT: [[TRUNC7:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD1]](s32)
68 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_8bit
69 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_8bit
70 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_8bit
71 ; X64-NEXT: G_STORE [[TRUNC]](s8), [[GV]](p0) :: (store (s8) into @a1_8bit)
72 ; X64-NEXT: G_STORE [[TRUNC6]](s8), [[GV1]](p0) :: (store (s8) into @a7_8bit)
73 ; X64-NEXT: G_STORE [[TRUNC7]](s8), [[GV2]](p0) :: (store (s8) into @a8_8bit)
74 ; X64-NEXT: $al = COPY [[TRUNC]](s8)
75 ; X64-NEXT: RET 0, implicit $al
77 store i8 %arg1, ptr @a1_8bit
78 store i8 %arg7, ptr @a7_8bit
79 store i8 %arg8, ptr @a8_8bit
83 @a1_32bit = external global i32
84 @a7_32bit = external global i32
85 @a8_32bit = external global i32
87 define i32 @test_i32_args_8(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8) {
88 ; X86-LABEL: name: test_i32_args_8
90 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
91 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.7, align 16)
92 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
93 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.6)
94 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
95 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s32) from %fixed-stack.5, align 8)
96 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
97 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s32) from %fixed-stack.4)
98 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
99 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s32) from %fixed-stack.3, align 16)
100 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
101 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s32) from %fixed-stack.2)
102 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
103 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s32) from %fixed-stack.1, align 8)
104 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
105 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s32) from %fixed-stack.0)
106 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_32bit
107 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_32bit
108 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_32bit
109 ; X86-NEXT: G_STORE [[LOAD]](s32), [[GV]](p0) :: (store (s32) into @a1_32bit)
110 ; X86-NEXT: G_STORE [[LOAD6]](s32), [[GV1]](p0) :: (store (s32) into @a7_32bit)
111 ; X86-NEXT: G_STORE [[LOAD7]](s32), [[GV2]](p0) :: (store (s32) into @a8_32bit)
112 ; X86-NEXT: $eax = COPY [[LOAD]](s32)
113 ; X86-NEXT: RET 0, implicit $eax
115 ; X64-LABEL: name: test_i32_args_8
117 ; X64-NEXT: liveins: $ecx, $edi, $edx, $esi, $r8d, $r9d
119 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
120 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
121 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
122 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $ecx
123 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $r8d
124 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $r9d
125 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
126 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
127 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
128 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0, align 8)
129 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_32bit
130 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_32bit
131 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_32bit
132 ; X64-NEXT: G_STORE [[COPY]](s32), [[GV]](p0) :: (store (s32) into @a1_32bit)
133 ; X64-NEXT: G_STORE [[LOAD]](s32), [[GV1]](p0) :: (store (s32) into @a7_32bit)
134 ; X64-NEXT: G_STORE [[LOAD1]](s32), [[GV2]](p0) :: (store (s32) into @a8_32bit)
135 ; X64-NEXT: $eax = COPY [[COPY]](s32)
136 ; X64-NEXT: RET 0, implicit $eax
138 store i32 %arg1, ptr @a1_32bit
139 store i32 %arg7, ptr @a7_32bit
140 store i32 %arg8, ptr @a8_32bit
144 @a1_64bit = external global i64
145 @a7_64bit = external global i64
146 @a8_64bit = external global i64
148 ; ... a bunch more that we don't track ...
149 define i64 @test_i64_args_8(i64 %arg1, i64 %arg2, i64 %arg3, i64 %arg4, i64 %arg5, i64 %arg6, i64 %arg7, i64 %arg8) {
150 ; X86-LABEL: name: test_i64_args_8
152 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.15
153 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.15, align 16)
154 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.14
155 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.14)
156 ; X86-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD]](s32), [[LOAD1]](s32)
157 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.13
158 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s32) from %fixed-stack.13, align 8)
159 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.12
160 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s32) from %fixed-stack.12)
161 ; X86-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD2]](s32), [[LOAD3]](s32)
162 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.11
163 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s32) from %fixed-stack.11, align 16)
164 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.10
165 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s32) from %fixed-stack.10)
166 ; X86-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD4]](s32), [[LOAD5]](s32)
167 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.9
168 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s32) from %fixed-stack.9, align 8)
169 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.8
170 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s32) from %fixed-stack.8)
171 ; X86-NEXT: [[MV3:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD6]](s32), [[LOAD7]](s32)
172 ; X86-NEXT: [[FRAME_INDEX8:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
173 ; X86-NEXT: [[LOAD8:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX8]](p0) :: (invariant load (s32) from %fixed-stack.7, align 16)
174 ; X86-NEXT: [[FRAME_INDEX9:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
175 ; X86-NEXT: [[LOAD9:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX9]](p0) :: (invariant load (s32) from %fixed-stack.6)
176 ; X86-NEXT: [[MV4:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD8]](s32), [[LOAD9]](s32)
177 ; X86-NEXT: [[FRAME_INDEX10:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
178 ; X86-NEXT: [[LOAD10:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX10]](p0) :: (invariant load (s32) from %fixed-stack.5, align 8)
179 ; X86-NEXT: [[FRAME_INDEX11:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
180 ; X86-NEXT: [[LOAD11:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX11]](p0) :: (invariant load (s32) from %fixed-stack.4)
181 ; X86-NEXT: [[MV5:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD10]](s32), [[LOAD11]](s32)
182 ; X86-NEXT: [[FRAME_INDEX12:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
183 ; X86-NEXT: [[LOAD12:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX12]](p0) :: (invariant load (s32) from %fixed-stack.3, align 16)
184 ; X86-NEXT: [[FRAME_INDEX13:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
185 ; X86-NEXT: [[LOAD13:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX13]](p0) :: (invariant load (s32) from %fixed-stack.2)
186 ; X86-NEXT: [[MV6:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD12]](s32), [[LOAD13]](s32)
187 ; X86-NEXT: [[FRAME_INDEX14:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
188 ; X86-NEXT: [[LOAD14:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX14]](p0) :: (invariant load (s32) from %fixed-stack.1, align 8)
189 ; X86-NEXT: [[FRAME_INDEX15:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
190 ; X86-NEXT: [[LOAD15:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX15]](p0) :: (invariant load (s32) from %fixed-stack.0)
191 ; X86-NEXT: [[MV7:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD14]](s32), [[LOAD15]](s32)
192 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_64bit
193 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_64bit
194 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_64bit
195 ; X86-NEXT: G_STORE [[MV]](s64), [[GV]](p0) :: (store (s64) into @a1_64bit, align 4)
196 ; X86-NEXT: G_STORE [[MV6]](s64), [[GV1]](p0) :: (store (s64) into @a7_64bit, align 4)
197 ; X86-NEXT: G_STORE [[MV7]](s64), [[GV2]](p0) :: (store (s64) into @a8_64bit, align 4)
198 ; X86-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
199 ; X86-NEXT: $eax = COPY [[UV]](s32)
200 ; X86-NEXT: $edx = COPY [[UV1]](s32)
201 ; X86-NEXT: RET 0, implicit $eax, implicit $edx
203 ; X64-LABEL: name: test_i64_args_8
205 ; X64-NEXT: liveins: $rcx, $rdi, $rdx, $rsi, $r8, $r9
207 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
208 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
209 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $rdx
210 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $rcx
211 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $r8
212 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY $r9
213 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
214 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s64) from %fixed-stack.1, align 16)
215 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
216 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s64) from %fixed-stack.0)
217 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_64bit
218 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_64bit
219 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_64bit
220 ; X64-NEXT: G_STORE [[COPY]](s64), [[GV]](p0) :: (store (s64) into @a1_64bit)
221 ; X64-NEXT: G_STORE [[LOAD]](s64), [[GV1]](p0) :: (store (s64) into @a7_64bit)
222 ; X64-NEXT: G_STORE [[LOAD1]](s64), [[GV2]](p0) :: (store (s64) into @a8_64bit)
223 ; X64-NEXT: $rax = COPY [[COPY]](s64)
224 ; X64-NEXT: RET 0, implicit $rax
226 store i64 %arg1, ptr @a1_64bit
227 store i64 %arg7, ptr @a7_64bit
228 store i64 %arg8, ptr @a8_64bit
232 define float @test_float_args(float %arg1, float %arg2) {
233 ; X86-LABEL: name: test_float_args
234 ; X86: bb.1 (%ir-block.0):
235 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
236 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
237 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
238 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0)
239 ; X86-NEXT: $fp0 = COPY [[LOAD1]](s32)
240 ; X86-NEXT: RET 0, implicit $fp0
242 ; X64-LABEL: name: test_float_args
243 ; X64: bb.1 (%ir-block.0):
244 ; X64-NEXT: liveins: $xmm0, $xmm1
246 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $xmm0
247 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $xmm1
248 ; X64-NEXT: $xmm0 = COPY [[COPY1]](s32)
249 ; X64-NEXT: RET 0, implicit $xmm0
253 define double @test_double_args(double %arg1, double %arg2) {
254 ; X86-LABEL: name: test_double_args
255 ; X86: bb.1 (%ir-block.0):
256 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
257 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s64) from %fixed-stack.1, align 16)
258 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
259 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s64) from %fixed-stack.0)
260 ; X86-NEXT: $fp0 = COPY [[LOAD1]](s64)
261 ; X86-NEXT: RET 0, implicit $fp0
263 ; X64-LABEL: name: test_double_args
264 ; X64: bb.1 (%ir-block.0):
265 ; X64-NEXT: liveins: $xmm0, $xmm1
267 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $xmm0
268 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $xmm1
269 ; X64-NEXT: $xmm0 = COPY [[COPY1]](s64)
270 ; X64-NEXT: RET 0, implicit $xmm0
274 define <4 x i32> @test_v4i32_args(<4 x i32> %arg1, <4 x i32> %arg2) {
275 ; X86-LABEL: name: test_v4i32_args
276 ; X86: bb.1 (%ir-block.0):
277 ; X86-NEXT: liveins: $xmm0, $xmm1
279 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
280 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
281 ; X86-NEXT: $xmm0 = COPY [[COPY1]](<4 x s32>)
282 ; X86-NEXT: RET 0, implicit $xmm0
284 ; X64-LABEL: name: test_v4i32_args
285 ; X64: bb.1 (%ir-block.0):
286 ; X64-NEXT: liveins: $xmm0, $xmm1
288 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
289 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
290 ; X64-NEXT: $xmm0 = COPY [[COPY1]](<4 x s32>)
291 ; X64-NEXT: RET 0, implicit $xmm0
295 define <8 x i32> @test_v8i32_args(<8 x i32> %arg1) {
296 ; X86-LABEL: name: test_v8i32_args
297 ; X86: bb.1 (%ir-block.0):
298 ; X86-NEXT: liveins: $xmm0, $xmm1
300 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
301 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
302 ; X86-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
303 ; X86-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS]](<8 x s32>)
304 ; X86-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
305 ; X86-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
306 ; X86-NEXT: RET 0, implicit $xmm0, implicit $xmm1
308 ; X64-LABEL: name: test_v8i32_args
309 ; X64: bb.1 (%ir-block.0):
310 ; X64-NEXT: liveins: $xmm0, $xmm1
312 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
313 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
314 ; X64-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
315 ; X64-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS]](<8 x s32>)
316 ; X64-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
317 ; X64-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
318 ; X64-NEXT: RET 0, implicit $xmm0, implicit $xmm1
322 define void @test_void_return() {
323 ; X86-LABEL: name: test_void_return
327 ; X64-LABEL: name: test_void_return
334 define ptr @test_memop_i32(ptr %p1) {
335 ; X86-LABEL: name: test_memop_i32
336 ; X86: bb.1 (%ir-block.0):
337 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
338 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
339 ; X86-NEXT: $eax = COPY [[LOAD]](p0)
340 ; X86-NEXT: RET 0, implicit $eax
342 ; X64-LABEL: name: test_memop_i32
343 ; X64: bb.1 (%ir-block.0):
344 ; X64-NEXT: liveins: $rdi
346 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
347 ; X64-NEXT: $rax = COPY [[COPY]](p0)
348 ; X64-NEXT: RET 0, implicit $rax
352 declare void @trivial_callee()
353 define void @test_trivial_call() {
354 ; X86-LABEL: name: test_trivial_call
355 ; X86: bb.1 (%ir-block.0):
356 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
357 ; X86-NEXT: CALLpcrel32 @trivial_callee, csr_32, implicit $esp, implicit $ssp
358 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
361 ; X64-LABEL: name: test_trivial_call
362 ; X64: bb.1 (%ir-block.0):
363 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
364 ; X64-NEXT: CALL64pcrel32 @trivial_callee, csr_64, implicit $rsp, implicit $ssp
365 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
367 call void @trivial_callee()
371 declare void @simple_arg_callee(i32 %in0, i32 %in1)
372 define void @test_simple_arg(i32 %in0, i32 %in1) {
373 ; X86-LABEL: name: test_simple_arg
374 ; X86: bb.1 (%ir-block.0):
375 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
376 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
377 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
378 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0)
379 ; X86-NEXT: ADJCALLSTACKDOWN32 8, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
380 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
381 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
382 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
383 ; X86-NEXT: G_STORE [[LOAD1]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
384 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
385 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
386 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
387 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
388 ; X86-NEXT: CALLpcrel32 @simple_arg_callee, csr_32, implicit $esp, implicit $ssp
389 ; X86-NEXT: ADJCALLSTACKUP32 8, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
392 ; X64-LABEL: name: test_simple_arg
393 ; X64: bb.1 (%ir-block.0):
394 ; X64-NEXT: liveins: $edi, $esi
396 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
397 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
398 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
399 ; X64-NEXT: $edi = COPY [[COPY1]](s32)
400 ; X64-NEXT: $esi = COPY [[COPY]](s32)
401 ; X64-NEXT: CALL64pcrel32 @simple_arg_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi
402 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
404 call void @simple_arg_callee(i32 %in1, i32 %in0)
408 declare void @simple_arg8_callee(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8)
409 define void @test_simple_arg8_call(i32 %in0) {
410 ; X86-LABEL: name: test_simple_arg8_call
411 ; X86: bb.1 (%ir-block.0):
412 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
413 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.0, align 16)
414 ; X86-NEXT: ADJCALLSTACKDOWN32 32, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
415 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
416 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
417 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
418 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
419 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
420 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
421 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
422 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
423 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $esp
424 ; X86-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
425 ; X86-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C2]](s32)
426 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD2]](p0) :: (store (s32) into stack + 8, align 1)
427 ; X86-NEXT: [[COPY3:%[0-9]+]]:_(p0) = COPY $esp
428 ; X86-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
429 ; X86-NEXT: [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY3]], [[C3]](s32)
430 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD3]](p0) :: (store (s32) into stack + 12, align 1)
431 ; X86-NEXT: [[COPY4:%[0-9]+]]:_(p0) = COPY $esp
432 ; X86-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
433 ; X86-NEXT: [[PTR_ADD4:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY4]], [[C4]](s32)
434 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD4]](p0) :: (store (s32) into stack + 16, align 1)
435 ; X86-NEXT: [[COPY5:%[0-9]+]]:_(p0) = COPY $esp
436 ; X86-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 20
437 ; X86-NEXT: [[PTR_ADD5:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY5]], [[C5]](s32)
438 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD5]](p0) :: (store (s32) into stack + 20, align 1)
439 ; X86-NEXT: [[COPY6:%[0-9]+]]:_(p0) = COPY $esp
440 ; X86-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
441 ; X86-NEXT: [[PTR_ADD6:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY6]], [[C6]](s32)
442 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD6]](p0) :: (store (s32) into stack + 24, align 1)
443 ; X86-NEXT: [[COPY7:%[0-9]+]]:_(p0) = COPY $esp
444 ; X86-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 28
445 ; X86-NEXT: [[PTR_ADD7:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY7]], [[C7]](s32)
446 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD7]](p0) :: (store (s32) into stack + 28, align 1)
447 ; X86-NEXT: CALLpcrel32 @simple_arg8_callee, csr_32, implicit $esp, implicit $ssp
448 ; X86-NEXT: ADJCALLSTACKUP32 32, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
451 ; X64-LABEL: name: test_simple_arg8_call
452 ; X64: bb.1 (%ir-block.0):
453 ; X64-NEXT: liveins: $edi
455 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
456 ; X64-NEXT: ADJCALLSTACKDOWN64 16, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
457 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsp
458 ; X64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
459 ; X64-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C]](s64)
460 ; X64-NEXT: G_STORE [[COPY]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
461 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $rsp
462 ; X64-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
463 ; X64-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C1]](s64)
464 ; X64-NEXT: G_STORE [[COPY]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 8, align 1)
465 ; X64-NEXT: $edi = COPY [[COPY]](s32)
466 ; X64-NEXT: $esi = COPY [[COPY]](s32)
467 ; X64-NEXT: $edx = COPY [[COPY]](s32)
468 ; X64-NEXT: $ecx = COPY [[COPY]](s32)
469 ; X64-NEXT: $r8d = COPY [[COPY]](s32)
470 ; X64-NEXT: $r9d = COPY [[COPY]](s32)
471 ; X64-NEXT: CALL64pcrel32 @simple_arg8_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $edx, implicit $ecx, implicit $r8d, implicit $r9d
472 ; X64-NEXT: ADJCALLSTACKUP64 16, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
474 call void @simple_arg8_callee(i32 %in0, i32 %in0, i32 %in0, i32 %in0,i32 %in0, i32 %in0, i32 %in0, i32 %in0)
478 declare i32 @simple_return_callee(i32 %in0)
479 define i32 @test_simple_return_callee() {
480 ; X86-LABEL: name: test_simple_return_callee
481 ; X86: bb.1 (%ir-block.0):
482 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
483 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
484 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
485 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
486 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
487 ; X86-NEXT: G_STORE [[C]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
488 ; X86-NEXT: CALLpcrel32 @simple_return_callee, csr_32, implicit $esp, implicit $ssp, implicit-def $eax
489 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $eax
490 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
491 ; X86-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[COPY1]]
492 ; X86-NEXT: $eax = COPY [[ADD]](s32)
493 ; X86-NEXT: RET 0, implicit $eax
495 ; X64-LABEL: name: test_simple_return_callee
496 ; X64: bb.1 (%ir-block.0):
497 ; X64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
498 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
499 ; X64-NEXT: $edi = COPY [[C]](s32)
500 ; X64-NEXT: CALL64pcrel32 @simple_return_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $eax
501 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $eax
502 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
503 ; X64-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
504 ; X64-NEXT: $eax = COPY [[ADD]](s32)
505 ; X64-NEXT: RET 0, implicit $eax
506 %call = call i32 @simple_return_callee(i32 5)
507 %r = add i32 %call, %call
511 declare <8 x i32> @split_return_callee(<8 x i32> %in0)
512 define <8 x i32> @test_split_return_callee(<8 x i32> %arg1, <8 x i32> %arg2) {
513 ; X86-LABEL: name: test_split_return_callee
514 ; X86: bb.1 (%ir-block.0):
515 ; X86-NEXT: liveins: $xmm0, $xmm1, $xmm2
517 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
518 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
519 ; X86-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
520 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s32>) = COPY $xmm2
521 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
522 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (<4 x s32>) from %fixed-stack.0)
523 ; X86-NEXT: [[CONCAT_VECTORS1:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY2]](<4 x s32>), [[LOAD]](<4 x s32>)
524 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
525 ; X86-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS1]](<8 x s32>)
526 ; X86-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
527 ; X86-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
528 ; X86-NEXT: CALLpcrel32 @split_return_callee, csr_32, implicit $esp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $xmm0, implicit-def $xmm1
529 ; X86-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
530 ; X86-NEXT: [[COPY4:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
531 ; X86-NEXT: [[CONCAT_VECTORS2:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY3]](<4 x s32>), [[COPY4]](<4 x s32>)
532 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
533 ; X86-NEXT: [[ADD:%[0-9]+]]:_(<8 x s32>) = G_ADD [[CONCAT_VECTORS]], [[CONCAT_VECTORS2]]
534 ; X86-NEXT: [[UV2:%[0-9]+]]:_(<4 x s32>), [[UV3:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[ADD]](<8 x s32>)
535 ; X86-NEXT: $xmm0 = COPY [[UV2]](<4 x s32>)
536 ; X86-NEXT: $xmm1 = COPY [[UV3]](<4 x s32>)
537 ; X86-NEXT: RET 0, implicit $xmm0, implicit $xmm1
539 ; X64-LABEL: name: test_split_return_callee
540 ; X64: bb.1 (%ir-block.0):
541 ; X64-NEXT: liveins: $xmm0, $xmm1, $xmm2, $xmm3
543 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
544 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
545 ; X64-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
546 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s32>) = COPY $xmm2
547 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s32>) = COPY $xmm3
548 ; X64-NEXT: [[CONCAT_VECTORS1:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY2]](<4 x s32>), [[COPY3]](<4 x s32>)
549 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
550 ; X64-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS1]](<8 x s32>)
551 ; X64-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
552 ; X64-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
553 ; X64-NEXT: CALL64pcrel32 @split_return_callee, csr_64, implicit $rsp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $xmm0, implicit-def $xmm1
554 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
555 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
556 ; X64-NEXT: [[CONCAT_VECTORS2:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY4]](<4 x s32>), [[COPY5]](<4 x s32>)
557 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
558 ; X64-NEXT: [[ADD:%[0-9]+]]:_(<8 x s32>) = G_ADD [[CONCAT_VECTORS]], [[CONCAT_VECTORS2]]
559 ; X64-NEXT: [[UV2:%[0-9]+]]:_(<4 x s32>), [[UV3:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[ADD]](<8 x s32>)
560 ; X64-NEXT: $xmm0 = COPY [[UV2]](<4 x s32>)
561 ; X64-NEXT: $xmm1 = COPY [[UV3]](<4 x s32>)
562 ; X64-NEXT: RET 0, implicit $xmm0, implicit $xmm1
563 %call = call <8 x i32> @split_return_callee(<8 x i32> %arg2)
564 %r = add <8 x i32> %arg1, %call
568 define void @test_indirect_call(ptr %func) {
569 ; X86-LABEL: name: test_indirect_call
570 ; X86: bb.1 (%ir-block.0):
571 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
572 ; X86-NEXT: [[LOAD:%[0-9]+]]:gr32(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
573 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
574 ; X86-NEXT: CALL32r [[LOAD]](p0), csr_32, implicit $esp, implicit $ssp
575 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
578 ; X64-LABEL: name: test_indirect_call
579 ; X64: bb.1 (%ir-block.0):
580 ; X64-NEXT: liveins: $rdi
582 ; X64-NEXT: [[COPY:%[0-9]+]]:gr64(p0) = COPY $rdi
583 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
584 ; X64-NEXT: CALL64r [[COPY]](p0), csr_64, implicit $rsp, implicit $ssp
585 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
592 declare void @take_char(i8)
593 define void @test_abi_exts_call(ptr %addr) {
594 ; X86-LABEL: name: test_abi_exts_call
595 ; X86: bb.1 (%ir-block.0):
596 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
597 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
598 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[LOAD]](p0) :: (load (s8) from %ir.addr)
599 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
600 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
601 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
602 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
603 ; X86-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD1]](s8)
604 ; X86-NEXT: G_STORE [[ANYEXT]](s32), [[PTR_ADD]](p0) :: (store (s8) into stack)
605 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
606 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
607 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
608 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
609 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C]](s32)
610 ; X86-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[LOAD1]](s8)
611 ; X86-NEXT: G_STORE [[SEXT]](s32), [[PTR_ADD1]](p0) :: (store (s8) into stack)
612 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
613 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
614 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
615 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $esp
616 ; X86-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C]](s32)
617 ; X86-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD1]](s8)
618 ; X86-NEXT: G_STORE [[ZEXT]](s32), [[PTR_ADD2]](p0) :: (store (s8) into stack)
619 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
620 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
623 ; X64-LABEL: name: test_abi_exts_call
624 ; X64: bb.1 (%ir-block.0):
625 ; X64-NEXT: liveins: $rdi
627 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
628 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.addr)
629 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
630 ; X64-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD]](s8)
631 ; X64-NEXT: $edi = COPY [[ANYEXT]](s32)
632 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
633 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
634 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
635 ; X64-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[LOAD]](s8)
636 ; X64-NEXT: $edi = COPY [[SEXT]](s32)
637 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
638 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
639 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
640 ; X64-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD]](s8)
641 ; X64-NEXT: $edi = COPY [[ZEXT]](s32)
642 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
643 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
645 %val = load i8, ptr %addr
646 call void @take_char(i8 %val)
647 call void @take_char(i8 signext %val)
648 call void @take_char(i8 zeroext %val)
652 declare void @variadic_callee(ptr, ...)
653 define void @test_variadic_call_1(ptr %addr_ptr, ptr %val_ptr) {
654 ; X86-LABEL: name: test_variadic_call_1
655 ; X86: bb.1 (%ir-block.0):
656 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
657 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.1, align 16)
658 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
659 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (p0) from %fixed-stack.0)
660 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(p0) = G_LOAD [[LOAD]](p0) :: (load (p0) from %ir.addr_ptr)
661 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[LOAD1]](p0) :: (load (s32) from %ir.val_ptr)
662 ; X86-NEXT: ADJCALLSTACKDOWN32 8, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
663 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
664 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
665 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
666 ; X86-NEXT: G_STORE [[LOAD2]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
667 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
668 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
669 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
670 ; X86-NEXT: G_STORE [[LOAD3]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
671 ; X86-NEXT: CALLpcrel32 @variadic_callee, csr_32, implicit $esp, implicit $ssp
672 ; X86-NEXT: ADJCALLSTACKUP32 8, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
675 ; X64-LABEL: name: test_variadic_call_1
676 ; X64: bb.1 (%ir-block.0):
677 ; X64-NEXT: liveins: $rdi, $rsi
679 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
680 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
681 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load (p0) from %ir.addr_ptr)
682 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[COPY1]](p0) :: (load (s32) from %ir.val_ptr)
683 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
684 ; X64-NEXT: $rdi = COPY [[LOAD]](p0)
685 ; X64-NEXT: $esi = COPY [[LOAD1]](s32)
686 ; X64-NEXT: $al = MOV8ri 0
687 ; X64-NEXT: CALL64pcrel32 @variadic_callee, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $esi, implicit $al
688 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
690 %addr = load ptr, ptr %addr_ptr
691 %val = load i32, ptr %val_ptr
692 call void (ptr, ...) @variadic_callee(ptr %addr, i32 %val)
696 define void @test_variadic_call_2(ptr %addr_ptr, ptr %val_ptr) {
697 ; X86-LABEL: name: test_variadic_call_2
698 ; X86: bb.1 (%ir-block.0):
699 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
700 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.1, align 16)
701 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
702 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (p0) from %fixed-stack.0)
703 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(p0) = G_LOAD [[LOAD]](p0) :: (load (p0) from %ir.addr_ptr)
704 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s64) = G_LOAD [[LOAD1]](p0) :: (load (s64) from %ir.val_ptr, align 4)
705 ; X86-NEXT: ADJCALLSTACKDOWN32 12, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
706 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
707 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
708 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
709 ; X86-NEXT: G_STORE [[LOAD2]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
710 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
711 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
712 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
713 ; X86-NEXT: G_STORE [[LOAD3]](s64), [[PTR_ADD1]](p0) :: (store (s64) into stack + 4, align 1)
714 ; X86-NEXT: CALLpcrel32 @variadic_callee, csr_32, implicit $esp, implicit $ssp
715 ; X86-NEXT: ADJCALLSTACKUP32 12, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
718 ; X64-LABEL: name: test_variadic_call_2
719 ; X64: bb.1 (%ir-block.0):
720 ; X64-NEXT: liveins: $rdi, $rsi
722 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
723 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
724 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load (p0) from %ir.addr_ptr)
725 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[COPY1]](p0) :: (load (s64) from %ir.val_ptr)
726 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
727 ; X64-NEXT: $rdi = COPY [[LOAD]](p0)
728 ; X64-NEXT: $xmm0 = COPY [[LOAD1]](s64)
729 ; X64-NEXT: $al = MOV8ri 1
730 ; X64-NEXT: CALL64pcrel32 @variadic_callee, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $xmm0, implicit $al
731 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
733 %addr = load ptr, ptr %addr_ptr
734 %val = load double, ptr %val_ptr
735 call void (ptr, ...) @variadic_callee(ptr %addr, double %val)
739 ; Return value is in memory unless subtarget is AVX or higher.
740 define <32 x float> @test_return_v32f32() {
741 ; X86-LABEL: name: test_return_v32f32
742 ; X86: bb.1 (%ir-block.0):
743 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
744 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.0, align 16)
745 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
746 ; X86-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<32 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
747 ; X86-NEXT: G_STORE [[BUILD_VECTOR]](<32 x s32>), [[LOAD]](p0) :: (store (<32 x s32>))
748 ; X86-NEXT: $eax = COPY [[LOAD]](p0)
749 ; X86-NEXT: RET 0, $eax
751 ; X64-LABEL: name: test_return_v32f32
752 ; X64: bb.1 (%ir-block.0):
753 ; X64-NEXT: liveins: $rdi
755 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
756 ; X64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
757 ; X64-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<32 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
758 ; X64-NEXT: G_STORE [[BUILD_VECTOR]](<32 x s32>), [[COPY]](p0) :: (store (<32 x s32>))
759 ; X64-NEXT: $rax = COPY [[COPY]](p0)
760 ; X64-NEXT: RET 0, $rax
761 ret <32 x float> zeroinitializer
764 define float @test_call_v32f32() {
765 ; X86-LABEL: name: test_call_v32f32
766 ; X86: bb.1 (%ir-block.0):
767 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
768 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
769 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
770 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
771 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
772 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
773 ; X86-NEXT: G_STORE [[FRAME_INDEX]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
774 ; X86-NEXT: CALLpcrel32 @test_return_v32f32, csr_32, implicit $esp, implicit $ssp
775 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
776 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(<32 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (load (<32 x s32>) from %stack.0)
777 ; X86-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[LOAD]](<32 x s32>), [[C]](s32)
778 ; X86-NEXT: $fp0 = COPY [[EVEC]](s32)
779 ; X86-NEXT: RET 0, implicit $fp0
781 ; X64-LABEL: name: test_call_v32f32
782 ; X64: bb.1 (%ir-block.0):
783 ; X64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
784 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
785 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
786 ; X64-NEXT: $rdi = COPY [[FRAME_INDEX]](p0)
787 ; X64-NEXT: CALL64pcrel32 @test_return_v32f32, csr_64, implicit $rsp, implicit $ssp, implicit $rdi
788 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
789 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(<32 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (load (<32 x s32>) from %stack.0)
790 ; X64-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[LOAD]](<32 x s32>), [[C]](s64)
791 ; X64-NEXT: $xmm0 = COPY [[EVEC]](s32)
792 ; X64-NEXT: RET 0, implicit $xmm0
793 %vect = call <32 x float> @test_return_v32f32()
794 %elt = extractelement <32 x float> %vect, i32 7
798 define void @test_sret(ptr sret(%struct.all) align 8 %result) #0 {
799 ; X86-LABEL: name: test_sret
801 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
802 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
803 ; X86-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 104
804 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY [[LOAD]](p0)
805 ; X86-NEXT: G_STORE [[C]](s8), [[COPY]](p0) :: (store (s8) into %ir.c, align 8)
806 ; X86-NEXT: $eax = COPY [[LOAD]](p0)
807 ; X86-NEXT: RET 0, $eax
809 ; X64-LABEL: name: test_sret
811 ; X64-NEXT: liveins: $rdi
813 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
814 ; X64-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 104
815 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
816 ; X64-NEXT: G_STORE [[C]](s8), [[COPY1]](p0) :: (store (s8) into %ir.c, align 8)
817 ; X64-NEXT: $rax = COPY [[COPY]](p0)
818 ; X64-NEXT: RET 0, $rax
820 %c = getelementptr inbounds %struct.all, ptr %result, i32 0, i32 0
821 store i8 104, ptr %c, align 8