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
9 define i8 @test_i8_args_8(i8 %arg1, i8 %arg2, i8 %arg3, i8 %arg4, i8 %arg5, i8 %arg6, i8 %arg7, i8 %arg8) {
10 ; X86-LABEL: name: test_i8_args_8
12 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
13 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s8) from %fixed-stack.7, align 16)
14 ; X86-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
15 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
16 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s8) from %fixed-stack.6, align 4)
17 ; X86-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD1]](s32)
18 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
19 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s8) from %fixed-stack.5, align 8)
20 ; X86-NEXT: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD2]](s32)
21 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
22 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s8) from %fixed-stack.4, align 4)
23 ; X86-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD3]](s32)
24 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
25 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s8) from %fixed-stack.3, align 16)
26 ; X86-NEXT: [[TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD4]](s32)
27 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
28 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s8) from %fixed-stack.2, align 4)
29 ; X86-NEXT: [[TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD5]](s32)
30 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
31 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s8) from %fixed-stack.1, align 8)
32 ; X86-NEXT: [[TRUNC6:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD6]](s32)
33 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
34 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s8) from %fixed-stack.0, align 4)
35 ; X86-NEXT: [[TRUNC7:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD7]](s32)
36 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_8bit
37 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_8bit
38 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_8bit
39 ; X86-NEXT: G_STORE [[TRUNC]](s8), [[GV]](p0) :: (store (s8) into @a1_8bit)
40 ; X86-NEXT: G_STORE [[TRUNC6]](s8), [[GV1]](p0) :: (store (s8) into @a7_8bit)
41 ; X86-NEXT: G_STORE [[TRUNC7]](s8), [[GV2]](p0) :: (store (s8) into @a8_8bit)
42 ; X86-NEXT: $al = COPY [[TRUNC]](s8)
43 ; X86-NEXT: RET 0, implicit $al
44 ; X64-LABEL: name: test_i8_args_8
46 ; X64-NEXT: liveins: $ecx, $edi, $edx, $esi, $r8d, $r9d
48 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
49 ; X64-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
50 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
51 ; X64-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
52 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
53 ; X64-NEXT: [[TRUNC2:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s32)
54 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $ecx
55 ; X64-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[COPY3]](s32)
56 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $r8d
57 ; X64-NEXT: [[TRUNC4:%[0-9]+]]:_(s8) = G_TRUNC [[COPY4]](s32)
58 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $r9d
59 ; X64-NEXT: [[TRUNC5:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s32)
60 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
61 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s8) from %fixed-stack.1, align 16)
62 ; X64-NEXT: [[TRUNC6:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
63 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
64 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s8) from %fixed-stack.0, align 8)
65 ; X64-NEXT: [[TRUNC7:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD1]](s32)
66 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_8bit
67 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_8bit
68 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_8bit
69 ; X64-NEXT: G_STORE [[TRUNC]](s8), [[GV]](p0) :: (store (s8) into @a1_8bit)
70 ; X64-NEXT: G_STORE [[TRUNC6]](s8), [[GV1]](p0) :: (store (s8) into @a7_8bit)
71 ; X64-NEXT: G_STORE [[TRUNC7]](s8), [[GV2]](p0) :: (store (s8) into @a8_8bit)
72 ; X64-NEXT: $al = COPY [[TRUNC]](s8)
73 ; X64-NEXT: RET 0, implicit $al
75 store i8 %arg1, ptr @a1_8bit
76 store i8 %arg7, ptr @a7_8bit
77 store i8 %arg8, ptr @a8_8bit
81 @a1_32bit = external global i32
82 @a7_32bit = external global i32
83 @a8_32bit = external global i32
85 define i32 @test_i32_args_8(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8) {
86 ; X86-LABEL: name: test_i32_args_8
88 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
89 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.7, align 16)
90 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
91 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.6)
92 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
93 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s32) from %fixed-stack.5, align 8)
94 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
95 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s32) from %fixed-stack.4)
96 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
97 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s32) from %fixed-stack.3, align 16)
98 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
99 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s32) from %fixed-stack.2)
100 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
101 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s32) from %fixed-stack.1, align 8)
102 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
103 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s32) from %fixed-stack.0)
104 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_32bit
105 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_32bit
106 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_32bit
107 ; X86-NEXT: G_STORE [[LOAD]](s32), [[GV]](p0) :: (store (s32) into @a1_32bit)
108 ; X86-NEXT: G_STORE [[LOAD6]](s32), [[GV1]](p0) :: (store (s32) into @a7_32bit)
109 ; X86-NEXT: G_STORE [[LOAD7]](s32), [[GV2]](p0) :: (store (s32) into @a8_32bit)
110 ; X86-NEXT: $eax = COPY [[LOAD]](s32)
111 ; X86-NEXT: RET 0, implicit $eax
112 ; X64-LABEL: name: test_i32_args_8
114 ; X64-NEXT: liveins: $ecx, $edi, $edx, $esi, $r8d, $r9d
116 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
117 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
118 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
119 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $ecx
120 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $r8d
121 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $r9d
122 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
123 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
124 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
125 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0, align 8)
126 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_32bit
127 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_32bit
128 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_32bit
129 ; X64-NEXT: G_STORE [[COPY]](s32), [[GV]](p0) :: (store (s32) into @a1_32bit)
130 ; X64-NEXT: G_STORE [[LOAD]](s32), [[GV1]](p0) :: (store (s32) into @a7_32bit)
131 ; X64-NEXT: G_STORE [[LOAD1]](s32), [[GV2]](p0) :: (store (s32) into @a8_32bit)
132 ; X64-NEXT: $eax = COPY [[COPY]](s32)
133 ; X64-NEXT: RET 0, implicit $eax
135 store i32 %arg1, ptr @a1_32bit
136 store i32 %arg7, ptr @a7_32bit
137 store i32 %arg8, ptr @a8_32bit
141 @a1_64bit = external global i64
142 @a7_64bit = external global i64
143 @a8_64bit = external global i64
145 ; ... a bunch more that we don't track ...
146 define i64 @test_i64_args_8(i64 %arg1, i64 %arg2, i64 %arg3, i64 %arg4, i64 %arg5, i64 %arg6, i64 %arg7, i64 %arg8) {
147 ; X86-LABEL: name: test_i64_args_8
149 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.15
150 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.15, align 16)
151 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.14
152 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.14)
153 ; X86-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD]](s32), [[LOAD1]](s32)
154 ; X86-NEXT: [[FRAME_INDEX2:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.13
155 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX2]](p0) :: (invariant load (s32) from %fixed-stack.13, align 8)
156 ; X86-NEXT: [[FRAME_INDEX3:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.12
157 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX3]](p0) :: (invariant load (s32) from %fixed-stack.12)
158 ; X86-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD2]](s32), [[LOAD3]](s32)
159 ; X86-NEXT: [[FRAME_INDEX4:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.11
160 ; X86-NEXT: [[LOAD4:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX4]](p0) :: (invariant load (s32) from %fixed-stack.11, align 16)
161 ; X86-NEXT: [[FRAME_INDEX5:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.10
162 ; X86-NEXT: [[LOAD5:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX5]](p0) :: (invariant load (s32) from %fixed-stack.10)
163 ; X86-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD4]](s32), [[LOAD5]](s32)
164 ; X86-NEXT: [[FRAME_INDEX6:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.9
165 ; X86-NEXT: [[LOAD6:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX6]](p0) :: (invariant load (s32) from %fixed-stack.9, align 8)
166 ; X86-NEXT: [[FRAME_INDEX7:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.8
167 ; X86-NEXT: [[LOAD7:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX7]](p0) :: (invariant load (s32) from %fixed-stack.8)
168 ; X86-NEXT: [[MV3:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD6]](s32), [[LOAD7]](s32)
169 ; X86-NEXT: [[FRAME_INDEX8:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.7
170 ; X86-NEXT: [[LOAD8:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX8]](p0) :: (invariant load (s32) from %fixed-stack.7, align 16)
171 ; X86-NEXT: [[FRAME_INDEX9:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.6
172 ; X86-NEXT: [[LOAD9:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX9]](p0) :: (invariant load (s32) from %fixed-stack.6)
173 ; X86-NEXT: [[MV4:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD8]](s32), [[LOAD9]](s32)
174 ; X86-NEXT: [[FRAME_INDEX10:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.5
175 ; X86-NEXT: [[LOAD10:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX10]](p0) :: (invariant load (s32) from %fixed-stack.5, align 8)
176 ; X86-NEXT: [[FRAME_INDEX11:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.4
177 ; X86-NEXT: [[LOAD11:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX11]](p0) :: (invariant load (s32) from %fixed-stack.4)
178 ; X86-NEXT: [[MV5:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD10]](s32), [[LOAD11]](s32)
179 ; X86-NEXT: [[FRAME_INDEX12:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.3
180 ; X86-NEXT: [[LOAD12:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX12]](p0) :: (invariant load (s32) from %fixed-stack.3, align 16)
181 ; X86-NEXT: [[FRAME_INDEX13:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.2
182 ; X86-NEXT: [[LOAD13:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX13]](p0) :: (invariant load (s32) from %fixed-stack.2)
183 ; X86-NEXT: [[MV6:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD12]](s32), [[LOAD13]](s32)
184 ; X86-NEXT: [[FRAME_INDEX14:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
185 ; X86-NEXT: [[LOAD14:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX14]](p0) :: (invariant load (s32) from %fixed-stack.1, align 8)
186 ; X86-NEXT: [[FRAME_INDEX15:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
187 ; X86-NEXT: [[LOAD15:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX15]](p0) :: (invariant load (s32) from %fixed-stack.0)
188 ; X86-NEXT: [[MV7:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD14]](s32), [[LOAD15]](s32)
189 ; X86-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_64bit
190 ; X86-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_64bit
191 ; X86-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_64bit
192 ; X86-NEXT: G_STORE [[MV]](s64), [[GV]](p0) :: (store (s64) into @a1_64bit, align 4)
193 ; X86-NEXT: G_STORE [[MV6]](s64), [[GV1]](p0) :: (store (s64) into @a7_64bit, align 4)
194 ; X86-NEXT: G_STORE [[MV7]](s64), [[GV2]](p0) :: (store (s64) into @a8_64bit, align 4)
195 ; X86-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
196 ; X86-NEXT: $eax = COPY [[UV]](s32)
197 ; X86-NEXT: $edx = COPY [[UV1]](s32)
198 ; X86-NEXT: RET 0, implicit $eax, implicit $edx
199 ; X64-LABEL: name: test_i64_args_8
201 ; X64-NEXT: liveins: $rcx, $rdi, $rdx, $rsi, $r8, $r9
203 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
204 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
205 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $rdx
206 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $rcx
207 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $r8
208 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY $r9
209 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
210 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s64) from %fixed-stack.1, align 16)
211 ; X64-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
212 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s64) from %fixed-stack.0)
213 ; X64-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a1_64bit
214 ; X64-NEXT: [[GV1:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a7_64bit
215 ; X64-NEXT: [[GV2:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @a8_64bit
216 ; X64-NEXT: G_STORE [[COPY]](s64), [[GV]](p0) :: (store (s64) into @a1_64bit)
217 ; X64-NEXT: G_STORE [[LOAD]](s64), [[GV1]](p0) :: (store (s64) into @a7_64bit)
218 ; X64-NEXT: G_STORE [[LOAD1]](s64), [[GV2]](p0) :: (store (s64) into @a8_64bit)
219 ; X64-NEXT: $rax = COPY [[COPY]](s64)
220 ; X64-NEXT: RET 0, implicit $rax
222 store i64 %arg1, ptr @a1_64bit
223 store i64 %arg7, ptr @a7_64bit
224 store i64 %arg8, ptr @a8_64bit
228 define float @test_float_args(float %arg1, float %arg2) {
229 ; X86-LABEL: name: test_float_args
230 ; X86: bb.1 (%ir-block.0):
231 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
232 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
233 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
234 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0)
235 ; X86-NEXT: $fp0 = COPY [[LOAD1]](s32)
236 ; X86-NEXT: RET 0, implicit $fp0
237 ; X64-LABEL: name: test_float_args
238 ; X64: bb.1 (%ir-block.0):
239 ; X64-NEXT: liveins: $xmm0, $xmm1
241 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $xmm0
242 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $xmm1
243 ; X64-NEXT: $xmm0 = COPY [[COPY1]](s32)
244 ; X64-NEXT: RET 0, implicit $xmm0
248 define double @test_double_args(double %arg1, double %arg2) {
249 ; X86-LABEL: name: test_double_args
250 ; X86: bb.1 (%ir-block.0):
251 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
252 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s64) from %fixed-stack.1, align 16)
253 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
254 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s64) from %fixed-stack.0)
255 ; X86-NEXT: $fp0 = COPY [[LOAD1]](s64)
256 ; X86-NEXT: RET 0, implicit $fp0
257 ; X64-LABEL: name: test_double_args
258 ; X64: bb.1 (%ir-block.0):
259 ; X64-NEXT: liveins: $xmm0, $xmm1
261 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $xmm0
262 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $xmm1
263 ; X64-NEXT: $xmm0 = COPY [[COPY1]](s64)
264 ; X64-NEXT: RET 0, implicit $xmm0
268 define <4 x i32> @test_v4i32_args(<4 x i32> %arg1, <4 x i32> %arg2) {
269 ; X86-LABEL: name: test_v4i32_args
270 ; X86: bb.1 (%ir-block.0):
271 ; X86-NEXT: liveins: $xmm0, $xmm1
273 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
274 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
275 ; X86-NEXT: $xmm0 = COPY [[COPY1]](<4 x s32>)
276 ; X86-NEXT: RET 0, implicit $xmm0
277 ; X64-LABEL: name: test_v4i32_args
278 ; X64: bb.1 (%ir-block.0):
279 ; X64-NEXT: liveins: $xmm0, $xmm1
281 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
282 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
283 ; X64-NEXT: $xmm0 = COPY [[COPY1]](<4 x s32>)
284 ; X64-NEXT: RET 0, implicit $xmm0
288 define <8 x i32> @test_v8i32_args(<8 x i32> %arg1) {
289 ; X86-LABEL: name: test_v8i32_args
290 ; X86: bb.1 (%ir-block.0):
291 ; X86-NEXT: liveins: $xmm0, $xmm1
293 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
294 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
295 ; X86-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
296 ; X86-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS]](<8 x s32>)
297 ; X86-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
298 ; X86-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
299 ; X86-NEXT: RET 0, implicit $xmm0, implicit $xmm1
300 ; X64-LABEL: name: test_v8i32_args
301 ; X64: bb.1 (%ir-block.0):
302 ; X64-NEXT: liveins: $xmm0, $xmm1
304 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
305 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
306 ; X64-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
307 ; X64-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS]](<8 x s32>)
308 ; X64-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
309 ; X64-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
310 ; X64-NEXT: RET 0, implicit $xmm0, implicit $xmm1
314 define void @test_void_return() {
315 ; X86-LABEL: name: test_void_return
318 ; X64-LABEL: name: test_void_return
325 define ptr @test_memop_i32(ptr %p1) {
326 ; X86-LABEL: name: test_memop_i32
327 ; X86: bb.1 (%ir-block.0):
328 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
329 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
330 ; X86-NEXT: $eax = COPY [[LOAD]](p0)
331 ; X86-NEXT: RET 0, implicit $eax
332 ; X64-LABEL: name: test_memop_i32
333 ; X64: bb.1 (%ir-block.0):
334 ; X64-NEXT: liveins: $rdi
336 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
337 ; X64-NEXT: $rax = COPY [[COPY]](p0)
338 ; X64-NEXT: RET 0, implicit $rax
342 declare void @trivial_callee()
343 define void @test_trivial_call() {
344 ; X86-LABEL: name: test_trivial_call
345 ; X86: bb.1 (%ir-block.0):
346 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
347 ; X86-NEXT: CALLpcrel32 @trivial_callee, csr_32, implicit $esp, implicit $ssp
348 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
350 ; X64-LABEL: name: test_trivial_call
351 ; X64: bb.1 (%ir-block.0):
352 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
353 ; X64-NEXT: CALL64pcrel32 @trivial_callee, csr_64, implicit $rsp, implicit $ssp
354 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
356 call void @trivial_callee()
360 declare void @simple_arg_callee(i32 %in0, i32 %in1)
361 define void @test_simple_arg(i32 %in0, i32 %in1) {
362 ; X86-LABEL: name: test_simple_arg
363 ; X86: bb.1 (%ir-block.0):
364 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
365 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.1, align 16)
366 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
367 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (s32) from %fixed-stack.0)
368 ; X86-NEXT: ADJCALLSTACKDOWN32 8, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
369 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
370 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
371 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
372 ; X86-NEXT: G_STORE [[LOAD1]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
373 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
374 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
375 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
376 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
377 ; X86-NEXT: CALLpcrel32 @simple_arg_callee, csr_32, implicit $esp, implicit $ssp
378 ; X86-NEXT: ADJCALLSTACKUP32 8, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
380 ; X64-LABEL: name: test_simple_arg
381 ; X64: bb.1 (%ir-block.0):
382 ; X64-NEXT: liveins: $edi, $esi
384 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
385 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
386 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
387 ; X64-NEXT: $edi = COPY [[COPY1]](s32)
388 ; X64-NEXT: $esi = COPY [[COPY]](s32)
389 ; X64-NEXT: CALL64pcrel32 @simple_arg_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi
390 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
392 call void @simple_arg_callee(i32 %in1, i32 %in0)
396 declare void @simple_arg8_callee(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8)
397 define void @test_simple_arg8_call(i32 %in0) {
398 ; X86-LABEL: name: test_simple_arg8_call
399 ; X86: bb.1 (%ir-block.0):
400 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
401 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.0, align 16)
402 ; X86-NEXT: ADJCALLSTACKDOWN32 32, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
403 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
404 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
405 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
406 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
407 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
408 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
409 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
410 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
411 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $esp
412 ; X86-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
413 ; X86-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C2]](s32)
414 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD2]](p0) :: (store (s32) into stack + 8, align 1)
415 ; X86-NEXT: [[COPY3:%[0-9]+]]:_(p0) = COPY $esp
416 ; X86-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
417 ; X86-NEXT: [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY3]], [[C3]](s32)
418 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD3]](p0) :: (store (s32) into stack + 12, align 1)
419 ; X86-NEXT: [[COPY4:%[0-9]+]]:_(p0) = COPY $esp
420 ; X86-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
421 ; X86-NEXT: [[PTR_ADD4:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY4]], [[C4]](s32)
422 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD4]](p0) :: (store (s32) into stack + 16, align 1)
423 ; X86-NEXT: [[COPY5:%[0-9]+]]:_(p0) = COPY $esp
424 ; X86-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 20
425 ; X86-NEXT: [[PTR_ADD5:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY5]], [[C5]](s32)
426 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD5]](p0) :: (store (s32) into stack + 20, align 1)
427 ; X86-NEXT: [[COPY6:%[0-9]+]]:_(p0) = COPY $esp
428 ; X86-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
429 ; X86-NEXT: [[PTR_ADD6:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY6]], [[C6]](s32)
430 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD6]](p0) :: (store (s32) into stack + 24, align 1)
431 ; X86-NEXT: [[COPY7:%[0-9]+]]:_(p0) = COPY $esp
432 ; X86-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 28
433 ; X86-NEXT: [[PTR_ADD7:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY7]], [[C7]](s32)
434 ; X86-NEXT: G_STORE [[LOAD]](s32), [[PTR_ADD7]](p0) :: (store (s32) into stack + 28, align 1)
435 ; X86-NEXT: CALLpcrel32 @simple_arg8_callee, csr_32, implicit $esp, implicit $ssp
436 ; X86-NEXT: ADJCALLSTACKUP32 32, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
438 ; X64-LABEL: name: test_simple_arg8_call
439 ; X64: bb.1 (%ir-block.0):
440 ; X64-NEXT: liveins: $edi
442 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
443 ; X64-NEXT: ADJCALLSTACKDOWN64 16, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
444 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsp
445 ; X64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
446 ; X64-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C]](s64)
447 ; X64-NEXT: G_STORE [[COPY]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
448 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $rsp
449 ; X64-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
450 ; X64-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C1]](s64)
451 ; X64-NEXT: G_STORE [[COPY]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 8, align 1)
452 ; X64-NEXT: $edi = COPY [[COPY]](s32)
453 ; X64-NEXT: $esi = COPY [[COPY]](s32)
454 ; X64-NEXT: $edx = COPY [[COPY]](s32)
455 ; X64-NEXT: $ecx = COPY [[COPY]](s32)
456 ; X64-NEXT: $r8d = COPY [[COPY]](s32)
457 ; X64-NEXT: $r9d = COPY [[COPY]](s32)
458 ; X64-NEXT: CALL64pcrel32 @simple_arg8_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $edx, implicit $ecx, implicit $r8d, implicit $r9d
459 ; X64-NEXT: ADJCALLSTACKUP64 16, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
461 call void @simple_arg8_callee(i32 %in0, i32 %in0, i32 %in0, i32 %in0,i32 %in0, i32 %in0, i32 %in0, i32 %in0)
465 declare i32 @simple_return_callee(i32 %in0)
466 define i32 @test_simple_return_callee() {
467 ; X86-LABEL: name: test_simple_return_callee
468 ; X86: bb.1 (%ir-block.0):
469 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
470 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
471 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
472 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
473 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
474 ; X86-NEXT: G_STORE [[C]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 1)
475 ; X86-NEXT: CALLpcrel32 @simple_return_callee, csr_32, implicit $esp, implicit $ssp, implicit-def $eax
476 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $eax
477 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
478 ; X86-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[COPY1]]
479 ; X86-NEXT: $eax = COPY [[ADD]](s32)
480 ; X86-NEXT: RET 0, implicit $eax
481 ; X64-LABEL: name: test_simple_return_callee
482 ; X64: bb.1 (%ir-block.0):
483 ; X64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
484 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
485 ; X64-NEXT: $edi = COPY [[C]](s32)
486 ; X64-NEXT: CALL64pcrel32 @simple_return_callee, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $eax
487 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $eax
488 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
489 ; X64-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
490 ; X64-NEXT: $eax = COPY [[ADD]](s32)
491 ; X64-NEXT: RET 0, implicit $eax
492 %call = call i32 @simple_return_callee(i32 5)
493 %r = add i32 %call, %call
497 declare <8 x i32> @split_return_callee(<8 x i32> %in0)
498 define <8 x i32> @test_split_return_callee(<8 x i32> %arg1, <8 x i32> %arg2) {
499 ; X86-LABEL: name: test_split_return_callee
500 ; X86: bb.1 (%ir-block.0):
501 ; X86-NEXT: liveins: $xmm0, $xmm1, $xmm2
503 ; X86-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
504 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
505 ; X86-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
506 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s32>) = COPY $xmm2
507 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
508 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (<4 x s32>) from %fixed-stack.0)
509 ; X86-NEXT: [[CONCAT_VECTORS1:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY2]](<4 x s32>), [[LOAD]](<4 x s32>)
510 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
511 ; X86-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS1]](<8 x s32>)
512 ; X86-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
513 ; X86-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
514 ; X86-NEXT: CALLpcrel32 @split_return_callee, csr_32, implicit $esp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $xmm0, implicit-def $xmm1
515 ; X86-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
516 ; X86-NEXT: [[COPY4:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
517 ; X86-NEXT: [[CONCAT_VECTORS2:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY3]](<4 x s32>), [[COPY4]](<4 x s32>)
518 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
519 ; X86-NEXT: [[ADD:%[0-9]+]]:_(<8 x s32>) = G_ADD [[CONCAT_VECTORS]], [[CONCAT_VECTORS2]]
520 ; X86-NEXT: [[UV2:%[0-9]+]]:_(<4 x s32>), [[UV3:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[ADD]](<8 x s32>)
521 ; X86-NEXT: $xmm0 = COPY [[UV2]](<4 x s32>)
522 ; X86-NEXT: $xmm1 = COPY [[UV3]](<4 x s32>)
523 ; X86-NEXT: RET 0, implicit $xmm0, implicit $xmm1
524 ; X64-LABEL: name: test_split_return_callee
525 ; X64: bb.1 (%ir-block.0):
526 ; X64-NEXT: liveins: $xmm0, $xmm1, $xmm2, $xmm3
528 ; X64-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
529 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
530 ; X64-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
531 ; X64-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s32>) = COPY $xmm2
532 ; X64-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s32>) = COPY $xmm3
533 ; X64-NEXT: [[CONCAT_VECTORS1:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY2]](<4 x s32>), [[COPY3]](<4 x s32>)
534 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
535 ; X64-NEXT: [[UV:%[0-9]+]]:_(<4 x s32>), [[UV1:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[CONCAT_VECTORS1]](<8 x s32>)
536 ; X64-NEXT: $xmm0 = COPY [[UV]](<4 x s32>)
537 ; X64-NEXT: $xmm1 = COPY [[UV1]](<4 x s32>)
538 ; X64-NEXT: CALL64pcrel32 @split_return_callee, csr_64, implicit $rsp, implicit $ssp, implicit $xmm0, implicit $xmm1, implicit-def $xmm0, implicit-def $xmm1
539 ; X64-NEXT: [[COPY4:%[0-9]+]]:_(<4 x s32>) = COPY $xmm0
540 ; X64-NEXT: [[COPY5:%[0-9]+]]:_(<4 x s32>) = COPY $xmm1
541 ; X64-NEXT: [[CONCAT_VECTORS2:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY4]](<4 x s32>), [[COPY5]](<4 x s32>)
542 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
543 ; X64-NEXT: [[ADD:%[0-9]+]]:_(<8 x s32>) = G_ADD [[CONCAT_VECTORS]], [[CONCAT_VECTORS2]]
544 ; X64-NEXT: [[UV2:%[0-9]+]]:_(<4 x s32>), [[UV3:%[0-9]+]]:_(<4 x s32>) = G_UNMERGE_VALUES [[ADD]](<8 x s32>)
545 ; X64-NEXT: $xmm0 = COPY [[UV2]](<4 x s32>)
546 ; X64-NEXT: $xmm1 = COPY [[UV3]](<4 x s32>)
547 ; X64-NEXT: RET 0, implicit $xmm0, implicit $xmm1
548 %call = call <8 x i32> @split_return_callee(<8 x i32> %arg2)
549 %r = add <8 x i32> %arg1, %call
553 define void @test_indirect_call(ptr %func) {
554 ; X86-LABEL: name: test_indirect_call
555 ; X86: bb.1 (%ir-block.0):
556 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
557 ; X86-NEXT: [[LOAD:%[0-9]+]]:gr32(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
558 ; X86-NEXT: ADJCALLSTACKDOWN32 0, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
559 ; X86-NEXT: CALL32r [[LOAD]](p0), csr_32, implicit $esp, implicit $ssp
560 ; X86-NEXT: ADJCALLSTACKUP32 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
562 ; X64-LABEL: name: test_indirect_call
563 ; X64: bb.1 (%ir-block.0):
564 ; X64-NEXT: liveins: $rdi
566 ; X64-NEXT: [[COPY:%[0-9]+]]:gr64(p0) = COPY $rdi
567 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
568 ; X64-NEXT: CALL64r [[COPY]](p0), csr_64, implicit $rsp, implicit $ssp
569 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
576 declare void @take_char(i8)
577 define void @test_abi_exts_call(ptr %addr) {
578 ; X86-LABEL: name: test_abi_exts_call
579 ; X86: bb.1 (%ir-block.0):
580 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
581 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.0, align 16)
582 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[LOAD]](p0) :: (load (s8) from %ir.addr)
583 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
584 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
585 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
586 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
587 ; X86-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD1]](s8)
588 ; X86-NEXT: G_STORE [[ANYEXT]](s32), [[PTR_ADD]](p0) :: (store (s8) into stack)
589 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
590 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
591 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
592 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
593 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C]](s32)
594 ; X86-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[LOAD1]](s8)
595 ; X86-NEXT: G_STORE [[SEXT]](s32), [[PTR_ADD1]](p0) :: (store (s8) into stack)
596 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
597 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
598 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
599 ; X86-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $esp
600 ; X86-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C]](s32)
601 ; X86-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD1]](s8)
602 ; X86-NEXT: G_STORE [[ZEXT]](s32), [[PTR_ADD2]](p0) :: (store (s8) into stack)
603 ; X86-NEXT: CALLpcrel32 @take_char, csr_32, implicit $esp, implicit $ssp
604 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
606 ; X64-LABEL: name: test_abi_exts_call
607 ; X64: bb.1 (%ir-block.0):
608 ; X64-NEXT: liveins: $rdi
610 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
611 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.addr)
612 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
613 ; X64-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD]](s8)
614 ; X64-NEXT: $edi = COPY [[ANYEXT]](s32)
615 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
616 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
617 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
618 ; X64-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[LOAD]](s8)
619 ; X64-NEXT: $edi = COPY [[SEXT]](s32)
620 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
621 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
622 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
623 ; X64-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD]](s8)
624 ; X64-NEXT: $edi = COPY [[ZEXT]](s32)
625 ; X64-NEXT: CALL64pcrel32 @take_char, csr_64, implicit $rsp, implicit $ssp, implicit $edi
626 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
628 %val = load i8, ptr %addr
629 call void @take_char(i8 %val)
630 call void @take_char(i8 signext %val)
631 call void @take_char(i8 zeroext %val)
635 declare void @variadic_callee(ptr, ...)
636 define void @test_variadic_call_1(ptr %addr_ptr, ptr %val_ptr) {
637 ; X86-LABEL: name: test_variadic_call_1
638 ; X86: bb.1 (%ir-block.0):
639 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
640 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.1, align 16)
641 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
642 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (p0) from %fixed-stack.0)
643 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(p0) = G_LOAD [[LOAD]](p0) :: (load (p0) from %ir.addr_ptr)
644 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s32) = G_LOAD [[LOAD1]](p0) :: (load (s32) from %ir.val_ptr)
645 ; X86-NEXT: ADJCALLSTACKDOWN32 8, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
646 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
647 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
648 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
649 ; X86-NEXT: G_STORE [[LOAD2]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
650 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
651 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
652 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
653 ; X86-NEXT: G_STORE [[LOAD3]](s32), [[PTR_ADD1]](p0) :: (store (s32) into stack + 4, align 1)
654 ; X86-NEXT: CALLpcrel32 @variadic_callee, csr_32, implicit $esp, implicit $ssp
655 ; X86-NEXT: ADJCALLSTACKUP32 8, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
657 ; X64-LABEL: name: test_variadic_call_1
658 ; X64: bb.1 (%ir-block.0):
659 ; X64-NEXT: liveins: $rdi, $rsi
661 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
662 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
663 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load (p0) from %ir.addr_ptr)
664 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[COPY1]](p0) :: (load (s32) from %ir.val_ptr)
665 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
666 ; X64-NEXT: $rdi = COPY [[LOAD]](p0)
667 ; X64-NEXT: $esi = COPY [[LOAD1]](s32)
668 ; X64-NEXT: $al = MOV8ri 0
669 ; X64-NEXT: CALL64pcrel32 @variadic_callee, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $esi, implicit $al
670 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
672 %addr = load ptr, ptr %addr_ptr
673 %val = load i32, ptr %val_ptr
674 call void (ptr, ...) @variadic_callee(ptr %addr, i32 %val)
678 define void @test_variadic_call_2(ptr %addr_ptr, ptr %val_ptr) {
679 ; X86-LABEL: name: test_variadic_call_2
680 ; X86: bb.1 (%ir-block.0):
681 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
682 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (p0) from %fixed-stack.1, align 16)
683 ; X86-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
684 ; X86-NEXT: [[LOAD1:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX1]](p0) :: (invariant load (p0) from %fixed-stack.0)
685 ; X86-NEXT: [[LOAD2:%[0-9]+]]:_(p0) = G_LOAD [[LOAD]](p0) :: (load (p0) from %ir.addr_ptr)
686 ; X86-NEXT: [[LOAD3:%[0-9]+]]:_(s64) = G_LOAD [[LOAD1]](p0) :: (load (s64) from %ir.val_ptr, align 4)
687 ; X86-NEXT: ADJCALLSTACKDOWN32 12, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
688 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
689 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
690 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s32)
691 ; X86-NEXT: G_STORE [[LOAD2]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
692 ; X86-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $esp
693 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
694 ; X86-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
695 ; X86-NEXT: G_STORE [[LOAD3]](s64), [[PTR_ADD1]](p0) :: (store (s64) into stack + 4, align 1)
696 ; X86-NEXT: CALLpcrel32 @variadic_callee, csr_32, implicit $esp, implicit $ssp
697 ; X86-NEXT: ADJCALLSTACKUP32 12, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
699 ; X64-LABEL: name: test_variadic_call_2
700 ; X64: bb.1 (%ir-block.0):
701 ; X64-NEXT: liveins: $rdi, $rsi
703 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
704 ; X64-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
705 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load (p0) from %ir.addr_ptr)
706 ; X64-NEXT: [[LOAD1:%[0-9]+]]:_(s64) = G_LOAD [[COPY1]](p0) :: (load (s64) from %ir.val_ptr)
707 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
708 ; X64-NEXT: $rdi = COPY [[LOAD]](p0)
709 ; X64-NEXT: $xmm0 = COPY [[LOAD1]](s64)
710 ; X64-NEXT: $al = MOV8ri 1
711 ; X64-NEXT: CALL64pcrel32 @variadic_callee, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $xmm0, implicit $al
712 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
714 %addr = load ptr, ptr %addr_ptr
715 %val = load double, ptr %val_ptr
716 call void (ptr, ...) @variadic_callee(ptr %addr, double %val)
720 ; Return value is in memory unless subtarget is AVX or higher.
721 define <32 x float> @test_return_v32f32() {
722 ; X86-LABEL: name: test_return_v32f32
723 ; X86: bb.1 (%ir-block.0):
724 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
725 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load (s32) from %fixed-stack.0, align 16)
726 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
727 ; 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)
728 ; X86-NEXT: G_STORE [[BUILD_VECTOR]](<32 x s32>), [[LOAD]](p0) :: (store (<32 x s32>))
729 ; X86-NEXT: $eax = COPY [[LOAD]](p0)
731 ; X64-LABEL: name: test_return_v32f32
732 ; X64: bb.1 (%ir-block.0):
733 ; X64-NEXT: liveins: $rdi
735 ; X64-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
736 ; X64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
737 ; 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)
738 ; X64-NEXT: G_STORE [[BUILD_VECTOR]](<32 x s32>), [[COPY]](p0) :: (store (<32 x s32>))
739 ; X64-NEXT: $rax = COPY [[COPY]](p0)
741 ret <32 x float> zeroinitializer
744 define float @test_call_v32f32() {
745 ; X86-LABEL: name: test_call_v32f32
746 ; X86: bb.1 (%ir-block.0):
747 ; X86-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
748 ; X86-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
749 ; X86-NEXT: ADJCALLSTACKDOWN32 4, 0, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
750 ; X86-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $esp
751 ; X86-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
752 ; X86-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C1]](s32)
753 ; X86-NEXT: G_STORE [[FRAME_INDEX]](p0), [[PTR_ADD]](p0) :: (store (p0) into stack, align 1)
754 ; X86-NEXT: CALLpcrel32 @test_return_v32f32, csr_32, implicit $esp, implicit $ssp
755 ; X86-NEXT: ADJCALLSTACKUP32 4, 0, implicit-def $esp, implicit-def $eflags, implicit-def $ssp, implicit $esp, implicit $ssp
756 ; X86-NEXT: [[LOAD:%[0-9]+]]:_(<32 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (load (<32 x s32>) from %stack.0)
757 ; X86-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[LOAD]](<32 x s32>), [[C]](s32)
758 ; X86-NEXT: $fp0 = COPY [[EVEC]](s32)
759 ; X86-NEXT: RET 0, implicit $fp0
760 ; X64-LABEL: name: test_call_v32f32
761 ; X64: bb.1 (%ir-block.0):
762 ; X64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 7
763 ; X64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
764 ; X64-NEXT: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
765 ; X64-NEXT: $rdi = COPY [[FRAME_INDEX]](p0)
766 ; X64-NEXT: CALL64pcrel32 @test_return_v32f32, csr_64, implicit $rsp, implicit $ssp, implicit $rdi
767 ; X64-NEXT: ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp
768 ; X64-NEXT: [[LOAD:%[0-9]+]]:_(<32 x s32>) = G_LOAD [[FRAME_INDEX]](p0) :: (load (<32 x s32>) from %stack.0)
769 ; X64-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[LOAD]](<32 x s32>), [[C]](s64)
770 ; X64-NEXT: $xmm0 = COPY [[EVEC]](s32)
771 ; X64-NEXT: RET 0, implicit $xmm0
772 %vect = call <32 x float> @test_return_v32f32()
773 %elt = extractelement <32 x float> %vect, i32 7