1/*
2 * Copyright (C) 2011 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.h"
19#include "gtest/gtest.h"
20
21namespace art {
22namespace x86 {
23
24TEST(X86ManagedRegister, NoRegister) {
25  X86ManagedRegister reg = ManagedRegister::NoRegister().AsX86();
26  EXPECT_TRUE(reg.IsNoRegister());
27  EXPECT_TRUE(!reg.Overlaps(reg));
28}
29
30TEST(X86ManagedRegister, CpuRegister) {
31  X86ManagedRegister reg = X86ManagedRegister::FromCpuRegister(EAX);
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(EAX, reg.AsCpuRegister());
38
39  reg = X86ManagedRegister::FromCpuRegister(EBX);
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(EBX, reg.AsCpuRegister());
46
47  reg = X86ManagedRegister::FromCpuRegister(ECX);
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(ECX, reg.AsCpuRegister());
54
55  reg = X86ManagedRegister::FromCpuRegister(EDI);
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(EDI, reg.AsCpuRegister());
62}
63
64TEST(X86ManagedRegister, XmmRegister) {
65  X86ManagedRegister reg = X86ManagedRegister::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 = X86ManagedRegister::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 = X86ManagedRegister::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
90TEST(X86ManagedRegister, X87Register) {
91  X86ManagedRegister reg = X86ManagedRegister::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 = X86ManagedRegister::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 = X86ManagedRegister::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
116TEST(X86ManagedRegister, RegisterPair) {
117  X86ManagedRegister reg = X86ManagedRegister::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(EAX, reg.AsRegisterPairLow());
124  EXPECT_EQ(EDX, reg.AsRegisterPairHigh());
125
126  reg = X86ManagedRegister::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(EAX, reg.AsRegisterPairLow());
133  EXPECT_EQ(ECX, reg.AsRegisterPairHigh());
134
135  reg = X86ManagedRegister::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(EAX, reg.AsRegisterPairLow());
142  EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
143
144  reg = X86ManagedRegister::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(EAX, reg.AsRegisterPairLow());
151  EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
152
153  reg = X86ManagedRegister::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(EDX, reg.AsRegisterPairLow());
160  EXPECT_EQ(ECX, reg.AsRegisterPairHigh());
161
162  reg = X86ManagedRegister::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(EDX, reg.AsRegisterPairLow());
169  EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
170
171  reg = X86ManagedRegister::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(EDX, reg.AsRegisterPairLow());
178  EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
179
180  reg = X86ManagedRegister::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(ECX, reg.AsRegisterPairLow());
187  EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
188
189  reg = X86ManagedRegister::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(ECX, reg.AsRegisterPairLow());
196  EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
197
198  reg = X86ManagedRegister::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(EBX, reg.AsRegisterPairLow());
205  EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
206}
207
208TEST(X86ManagedRegister, Equals) {
209  X86ManagedRegister reg_eax = X86ManagedRegister::FromCpuRegister(EAX);
210  EXPECT_TRUE(reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
211  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
212  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
213  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
214  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
215  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromX87Register(ST0)));
216  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromX87Register(ST7)));
217  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
218  EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
219
220  X86ManagedRegister reg_xmm0 = X86ManagedRegister::FromXmmRegister(XMM0);
221  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
222  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
223  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
224  EXPECT_TRUE(reg_xmm0.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
225  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
226  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromX87Register(ST0)));
227  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromX87Register(ST7)));
228  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
229  EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
230
231  X86ManagedRegister reg_st0 = X86ManagedRegister::FromX87Register(ST0);
232  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
233  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
234  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
235  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
236  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
237  EXPECT_TRUE(reg_st0.Equals(X86ManagedRegister::FromX87Register(ST0)));
238  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromX87Register(ST7)));
239  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
240  EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
241
242  X86ManagedRegister reg_pair = X86ManagedRegister::FromRegisterPair(EAX_EDX);
243  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
244  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
245  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
246  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
247  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
248  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromX87Register(ST0)));
249  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromX87Register(ST7)));
250  EXPECT_TRUE(reg_pair.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
251  EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
252}
253
254TEST(X86ManagedRegister, Overlaps) {
255  X86ManagedRegister reg = X86ManagedRegister::FromCpuRegister(EAX);
256  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
257  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
258  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
259  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
260  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
261  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
262  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
263  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
264  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
265
266  reg = X86ManagedRegister::FromCpuRegister(EDX);
267  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
268  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
269  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
270  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
271  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
272  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
273  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
274  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
275  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
276
277  reg = X86ManagedRegister::FromCpuRegister(EDI);
278  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
279  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
280  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
281  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
282  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
283  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
284  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
285  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
286  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
287
288  reg = X86ManagedRegister::FromCpuRegister(EBX);
289  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
290  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
291  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
292  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
293  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
294  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
295  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
296  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
297  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
298
299  reg = X86ManagedRegister::FromXmmRegister(XMM0);
300  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
301  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
302  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
303  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
304  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
305  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
306  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
307  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
308  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
309
310  reg = X86ManagedRegister::FromX87Register(ST0);
311  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
312  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
313  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
314  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
315  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
316  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
317  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
318  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
319  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
320
321  reg = X86ManagedRegister::FromRegisterPair(EAX_EDX);
322  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
323  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
324  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
325  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
326  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
327  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
328  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
329  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
330  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_ECX)));
331  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
332
333  reg = X86ManagedRegister::FromRegisterPair(EBX_EDI);
334  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
335  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
336  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
337  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
338  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
339  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
340  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
341  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
342  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
343  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_EBX)));
344
345  reg = X86ManagedRegister::FromRegisterPair(EDX_ECX);
346  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
347  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
348  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
349  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
350  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
351  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
352  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
353  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
354  EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
355  EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_EBX)));
356}
357
358}  // namespace x86
359}  // namespace art
360