1 /*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "globals.h"
18 #include "managed_register_x86_64.h"
19 #include "gtest/gtest.h"
20
21 namespace art {
22 namespace x86_64 {
23
TEST(X86_64ManagedRegister,NoRegister)24 TEST(X86_64ManagedRegister, NoRegister) {
25 X86_64ManagedRegister reg = ManagedRegister::NoRegister().AsX86();
26 EXPECT_TRUE(reg.IsNoRegister());
27 EXPECT_TRUE(!reg.Overlaps(reg));
28 }
29
TEST(X86_64ManagedRegister,CpuRegister)30 TEST(X86_64ManagedRegister, CpuRegister) {
31 X86_64ManagedRegister reg = X86_64ManagedRegister::FromCpuRegister(RAX);
32 EXPECT_TRUE(!reg.IsNoRegister());
33 EXPECT_TRUE(reg.IsCpuRegister());
34 EXPECT_TRUE(!reg.IsXmmRegister());
35 EXPECT_TRUE(!reg.IsX87Register());
36 EXPECT_TRUE(!reg.IsRegisterPair());
37 EXPECT_EQ(RAX, reg.AsCpuRegister());
38
39 reg = X86_64ManagedRegister::FromCpuRegister(RBX);
40 EXPECT_TRUE(!reg.IsNoRegister());
41 EXPECT_TRUE(reg.IsCpuRegister());
42 EXPECT_TRUE(!reg.IsXmmRegister());
43 EXPECT_TRUE(!reg.IsX87Register());
44 EXPECT_TRUE(!reg.IsRegisterPair());
45 EXPECT_EQ(RBX, reg.AsCpuRegister());
46
47 reg = X86_64ManagedRegister::FromCpuRegister(RCX);
48 EXPECT_TRUE(!reg.IsNoRegister());
49 EXPECT_TRUE(reg.IsCpuRegister());
50 EXPECT_TRUE(!reg.IsXmmRegister());
51 EXPECT_TRUE(!reg.IsX87Register());
52 EXPECT_TRUE(!reg.IsRegisterPair());
53 EXPECT_EQ(RCX, reg.AsCpuRegister());
54
55 reg = X86_64ManagedRegister::FromCpuRegister(RDI);
56 EXPECT_TRUE(!reg.IsNoRegister());
57 EXPECT_TRUE(reg.IsCpuRegister());
58 EXPECT_TRUE(!reg.IsXmmRegister());
59 EXPECT_TRUE(!reg.IsX87Register());
60 EXPECT_TRUE(!reg.IsRegisterPair());
61 EXPECT_EQ(RDI, reg.AsCpuRegister());
62 }
63
TEST(X86_64ManagedRegister,XmmRegister)64 TEST(X86_64ManagedRegister, XmmRegister) {
65 X86_64ManagedRegister reg = X86_64ManagedRegister::FromXmmRegister(XMM0);
66 EXPECT_TRUE(!reg.IsNoRegister());
67 EXPECT_TRUE(!reg.IsCpuRegister());
68 EXPECT_TRUE(reg.IsXmmRegister());
69 EXPECT_TRUE(!reg.IsX87Register());
70 EXPECT_TRUE(!reg.IsRegisterPair());
71 EXPECT_EQ(XMM0, reg.AsXmmRegister());
72
73 reg = X86_64ManagedRegister::FromXmmRegister(XMM1);
74 EXPECT_TRUE(!reg.IsNoRegister());
75 EXPECT_TRUE(!reg.IsCpuRegister());
76 EXPECT_TRUE(reg.IsXmmRegister());
77 EXPECT_TRUE(!reg.IsX87Register());
78 EXPECT_TRUE(!reg.IsRegisterPair());
79 EXPECT_EQ(XMM1, reg.AsXmmRegister());
80
81 reg = X86_64ManagedRegister::FromXmmRegister(XMM7);
82 EXPECT_TRUE(!reg.IsNoRegister());
83 EXPECT_TRUE(!reg.IsCpuRegister());
84 EXPECT_TRUE(reg.IsXmmRegister());
85 EXPECT_TRUE(!reg.IsX87Register());
86 EXPECT_TRUE(!reg.IsRegisterPair());
87 EXPECT_EQ(XMM7, reg.AsXmmRegister());
88 }
89
TEST(X86_64ManagedRegister,X87Register)90 TEST(X86_64ManagedRegister, X87Register) {
91 X86_64ManagedRegister reg = X86_64ManagedRegister::FromX87Register(ST0);
92 EXPECT_TRUE(!reg.IsNoRegister());
93 EXPECT_TRUE(!reg.IsCpuRegister());
94 EXPECT_TRUE(!reg.IsXmmRegister());
95 EXPECT_TRUE(reg.IsX87Register());
96 EXPECT_TRUE(!reg.IsRegisterPair());
97 EXPECT_EQ(ST0, reg.AsX87Register());
98
99 reg = X86_64ManagedRegister::FromX87Register(ST1);
100 EXPECT_TRUE(!reg.IsNoRegister());
101 EXPECT_TRUE(!reg.IsCpuRegister());
102 EXPECT_TRUE(!reg.IsXmmRegister());
103 EXPECT_TRUE(reg.IsX87Register());
104 EXPECT_TRUE(!reg.IsRegisterPair());
105 EXPECT_EQ(ST1, reg.AsX87Register());
106
107 reg = X86_64ManagedRegister::FromX87Register(ST7);
108 EXPECT_TRUE(!reg.IsNoRegister());
109 EXPECT_TRUE(!reg.IsCpuRegister());
110 EXPECT_TRUE(!reg.IsXmmRegister());
111 EXPECT_TRUE(reg.IsX87Register());
112 EXPECT_TRUE(!reg.IsRegisterPair());
113 EXPECT_EQ(ST7, reg.AsX87Register());
114 }
115
TEST(X86_64ManagedRegister,RegisterPair)116 TEST(X86_64ManagedRegister, RegisterPair) {
117 X86_64ManagedRegister reg = X86_64ManagedRegister::FromRegisterPair(EAX_EDX);
118 EXPECT_TRUE(!reg.IsNoRegister());
119 EXPECT_TRUE(!reg.IsCpuRegister());
120 EXPECT_TRUE(!reg.IsXmmRegister());
121 EXPECT_TRUE(!reg.IsX87Register());
122 EXPECT_TRUE(reg.IsRegisterPair());
123 EXPECT_EQ(RAX, reg.AsRegisterPairLow());
124 EXPECT_EQ(RDX, reg.AsRegisterPairHigh());
125
126 reg = X86_64ManagedRegister::FromRegisterPair(EAX_ECX);
127 EXPECT_TRUE(!reg.IsNoRegister());
128 EXPECT_TRUE(!reg.IsCpuRegister());
129 EXPECT_TRUE(!reg.IsXmmRegister());
130 EXPECT_TRUE(!reg.IsX87Register());
131 EXPECT_TRUE(reg.IsRegisterPair());
132 EXPECT_EQ(RAX, reg.AsRegisterPairLow());
133 EXPECT_EQ(RCX, reg.AsRegisterPairHigh());
134
135 reg = X86_64ManagedRegister::FromRegisterPair(EAX_EBX);
136 EXPECT_TRUE(!reg.IsNoRegister());
137 EXPECT_TRUE(!reg.IsCpuRegister());
138 EXPECT_TRUE(!reg.IsXmmRegister());
139 EXPECT_TRUE(!reg.IsX87Register());
140 EXPECT_TRUE(reg.IsRegisterPair());
141 EXPECT_EQ(RAX, reg.AsRegisterPairLow());
142 EXPECT_EQ(RBX, reg.AsRegisterPairHigh());
143
144 reg = X86_64ManagedRegister::FromRegisterPair(EAX_EDI);
145 EXPECT_TRUE(!reg.IsNoRegister());
146 EXPECT_TRUE(!reg.IsCpuRegister());
147 EXPECT_TRUE(!reg.IsXmmRegister());
148 EXPECT_TRUE(!reg.IsX87Register());
149 EXPECT_TRUE(reg.IsRegisterPair());
150 EXPECT_EQ(RAX, reg.AsRegisterPairLow());
151 EXPECT_EQ(RDI, reg.AsRegisterPairHigh());
152
153 reg = X86_64ManagedRegister::FromRegisterPair(EDX_ECX);
154 EXPECT_TRUE(!reg.IsNoRegister());
155 EXPECT_TRUE(!reg.IsCpuRegister());
156 EXPECT_TRUE(!reg.IsXmmRegister());
157 EXPECT_TRUE(!reg.IsX87Register());
158 EXPECT_TRUE(reg.IsRegisterPair());
159 EXPECT_EQ(RDX, reg.AsRegisterPairLow());
160 EXPECT_EQ(RCX, reg.AsRegisterPairHigh());
161
162 reg = X86_64ManagedRegister::FromRegisterPair(EDX_EBX);
163 EXPECT_TRUE(!reg.IsNoRegister());
164 EXPECT_TRUE(!reg.IsCpuRegister());
165 EXPECT_TRUE(!reg.IsXmmRegister());
166 EXPECT_TRUE(!reg.IsX87Register());
167 EXPECT_TRUE(reg.IsRegisterPair());
168 EXPECT_EQ(RDX, reg.AsRegisterPairLow());
169 EXPECT_EQ(RBX, reg.AsRegisterPairHigh());
170
171 reg = X86_64ManagedRegister::FromRegisterPair(EDX_EDI);
172 EXPECT_TRUE(!reg.IsNoRegister());
173 EXPECT_TRUE(!reg.IsCpuRegister());
174 EXPECT_TRUE(!reg.IsXmmRegister());
175 EXPECT_TRUE(!reg.IsX87Register());
176 EXPECT_TRUE(reg.IsRegisterPair());
177 EXPECT_EQ(RDX, reg.AsRegisterPairLow());
178 EXPECT_EQ(RDI, reg.AsRegisterPairHigh());
179
180 reg = X86_64ManagedRegister::FromRegisterPair(ECX_EBX);
181 EXPECT_TRUE(!reg.IsNoRegister());
182 EXPECT_TRUE(!reg.IsCpuRegister());
183 EXPECT_TRUE(!reg.IsXmmRegister());
184 EXPECT_TRUE(!reg.IsX87Register());
185 EXPECT_TRUE(reg.IsRegisterPair());
186 EXPECT_EQ(RCX, reg.AsRegisterPairLow());
187 EXPECT_EQ(RBX, reg.AsRegisterPairHigh());
188
189 reg = X86_64ManagedRegister::FromRegisterPair(ECX_EDI);
190 EXPECT_TRUE(!reg.IsNoRegister());
191 EXPECT_TRUE(!reg.IsCpuRegister());
192 EXPECT_TRUE(!reg.IsXmmRegister());
193 EXPECT_TRUE(!reg.IsX87Register());
194 EXPECT_TRUE(reg.IsRegisterPair());
195 EXPECT_EQ(RCX, reg.AsRegisterPairLow());
196 EXPECT_EQ(RDI, reg.AsRegisterPairHigh());
197
198 reg = X86_64ManagedRegister::FromRegisterPair(EBX_EDI);
199 EXPECT_TRUE(!reg.IsNoRegister());
200 EXPECT_TRUE(!reg.IsCpuRegister());
201 EXPECT_TRUE(!reg.IsXmmRegister());
202 EXPECT_TRUE(!reg.IsX87Register());
203 EXPECT_TRUE(reg.IsRegisterPair());
204 EXPECT_EQ(RBX, reg.AsRegisterPairLow());
205 EXPECT_EQ(RDI, reg.AsRegisterPairHigh());
206 }
207
TEST(X86_64ManagedRegister,Equals)208 TEST(X86_64ManagedRegister, Equals) {
209 X86_64ManagedRegister reg_eax = X86_64ManagedRegister::FromCpuRegister(RAX);
210 EXPECT_TRUE(reg_eax.Equals(X86_64ManagedRegister::FromCpuRegister(RAX)));
211 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromCpuRegister(RBX)));
212 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromCpuRegister(RDI)));
213 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromXmmRegister(XMM0)));
214 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromXmmRegister(XMM7)));
215 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromX87Register(ST0)));
216 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromX87Register(ST7)));
217 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
218 EXPECT_TRUE(!reg_eax.Equals(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
219
220 X86_64ManagedRegister reg_xmm0 = X86_64ManagedRegister::FromXmmRegister(XMM0);
221 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromCpuRegister(RAX)));
222 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromCpuRegister(RBX)));
223 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromCpuRegister(RDI)));
224 EXPECT_TRUE(reg_xmm0.Equals(X86_64ManagedRegister::FromXmmRegister(XMM0)));
225 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromXmmRegister(XMM7)));
226 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromX87Register(ST0)));
227 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromX87Register(ST7)));
228 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
229 EXPECT_TRUE(!reg_xmm0.Equals(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
230
231 X86_64ManagedRegister reg_st0 = X86_64ManagedRegister::FromX87Register(ST0);
232 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromCpuRegister(RAX)));
233 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromCpuRegister(RBX)));
234 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromCpuRegister(RDI)));
235 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromXmmRegister(XMM0)));
236 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromXmmRegister(XMM7)));
237 EXPECT_TRUE(reg_st0.Equals(X86_64ManagedRegister::FromX87Register(ST0)));
238 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromX87Register(ST7)));
239 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
240 EXPECT_TRUE(!reg_st0.Equals(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
241
242 X86_64ManagedRegister reg_pair = X86_64ManagedRegister::FromRegisterPair(EAX_EDX);
243 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromCpuRegister(RAX)));
244 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromCpuRegister(RBX)));
245 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromCpuRegister(RDI)));
246 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromXmmRegister(XMM0)));
247 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromXmmRegister(XMM7)));
248 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromX87Register(ST0)));
249 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromX87Register(ST7)));
250 EXPECT_TRUE(reg_pair.Equals(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
251 EXPECT_TRUE(!reg_pair.Equals(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
252 }
253
TEST(X86_64ManagedRegister,Overlaps)254 TEST(X86_64ManagedRegister, Overlaps) {
255 X86_64ManagedRegister reg = X86_64ManagedRegister::FromCpuRegister(RAX);
256 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
257 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
258 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
259 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
260 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
261 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
262 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
263 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
264 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
265
266 reg = X86_64ManagedRegister::FromCpuRegister(RDX);
267 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
268 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
269 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
270 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
271 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
272 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
273 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
274 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
275 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
276
277 reg = X86_64ManagedRegister::FromCpuRegister(RDI);
278 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
279 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
280 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
281 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
282 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
283 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
284 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
285 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
286 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
287
288 reg = X86_64ManagedRegister::FromCpuRegister(RBX);
289 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
290 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
291 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
292 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
293 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
294 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
295 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
296 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
297 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
298
299 reg = X86_64ManagedRegister::FromXmmRegister(XMM0);
300 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
301 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
302 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
303 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
304 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
305 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
306 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
307 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
308 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
309
310 reg = X86_64ManagedRegister::FromX87Register(ST0);
311 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
312 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
313 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
314 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
315 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
316 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
317 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
318 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
319 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
320
321 reg = X86_64ManagedRegister::FromRegisterPair(EAX_EDX);
322 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
323 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
324 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
325 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
326 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
327 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
328 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
329 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
330 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EDX_ECX)));
331 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
332
333 reg = X86_64ManagedRegister::FromRegisterPair(EBX_EDI);
334 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
335 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
336 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
337 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
338 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
339 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
340 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
341 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
342 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
343 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EDX_EBX)));
344
345 reg = X86_64ManagedRegister::FromRegisterPair(EDX_ECX);
346 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RAX)));
347 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RBX)));
348 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromCpuRegister(RDI)));
349 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM0)));
350 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromXmmRegister(XMM7)));
351 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST0)));
352 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromX87Register(ST7)));
353 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EAX_EDX)));
354 EXPECT_TRUE(!reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EBX_EDI)));
355 EXPECT_TRUE(reg.Overlaps(X86_64ManagedRegister::FromRegisterPair(EDX_EBX)));
356 }
357
358 } // namespace x86_64
359 } // namespace art
360