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 "managed_register_x86.h"
18 
19 #include "base/globals.h"
20 #include "gtest/gtest.h"
21 
22 namespace art {
23 namespace x86 {
24 
TEST(X86ManagedRegister,NoRegister)25 TEST(X86ManagedRegister, NoRegister) {
26   X86ManagedRegister reg = ManagedRegister::NoRegister().AsX86();
27   EXPECT_TRUE(reg.IsNoRegister());
28   EXPECT_TRUE(!reg.Overlaps(reg));
29 }
30 
TEST(X86ManagedRegister,CpuRegister)31 TEST(X86ManagedRegister, CpuRegister) {
32   X86ManagedRegister reg = X86ManagedRegister::FromCpuRegister(EAX);
33   EXPECT_TRUE(!reg.IsNoRegister());
34   EXPECT_TRUE(reg.IsCpuRegister());
35   EXPECT_TRUE(!reg.IsXmmRegister());
36   EXPECT_TRUE(!reg.IsX87Register());
37   EXPECT_TRUE(!reg.IsRegisterPair());
38   EXPECT_EQ(EAX, reg.AsCpuRegister());
39 
40   reg = X86ManagedRegister::FromCpuRegister(EBX);
41   EXPECT_TRUE(!reg.IsNoRegister());
42   EXPECT_TRUE(reg.IsCpuRegister());
43   EXPECT_TRUE(!reg.IsXmmRegister());
44   EXPECT_TRUE(!reg.IsX87Register());
45   EXPECT_TRUE(!reg.IsRegisterPair());
46   EXPECT_EQ(EBX, reg.AsCpuRegister());
47 
48   reg = X86ManagedRegister::FromCpuRegister(ECX);
49   EXPECT_TRUE(!reg.IsNoRegister());
50   EXPECT_TRUE(reg.IsCpuRegister());
51   EXPECT_TRUE(!reg.IsXmmRegister());
52   EXPECT_TRUE(!reg.IsX87Register());
53   EXPECT_TRUE(!reg.IsRegisterPair());
54   EXPECT_EQ(ECX, reg.AsCpuRegister());
55 
56   reg = X86ManagedRegister::FromCpuRegister(EDI);
57   EXPECT_TRUE(!reg.IsNoRegister());
58   EXPECT_TRUE(reg.IsCpuRegister());
59   EXPECT_TRUE(!reg.IsXmmRegister());
60   EXPECT_TRUE(!reg.IsX87Register());
61   EXPECT_TRUE(!reg.IsRegisterPair());
62   EXPECT_EQ(EDI, reg.AsCpuRegister());
63 }
64 
TEST(X86ManagedRegister,XmmRegister)65 TEST(X86ManagedRegister, XmmRegister) {
66   X86ManagedRegister reg = X86ManagedRegister::FromXmmRegister(XMM0);
67   EXPECT_TRUE(!reg.IsNoRegister());
68   EXPECT_TRUE(!reg.IsCpuRegister());
69   EXPECT_TRUE(reg.IsXmmRegister());
70   EXPECT_TRUE(!reg.IsX87Register());
71   EXPECT_TRUE(!reg.IsRegisterPair());
72   EXPECT_EQ(XMM0, reg.AsXmmRegister());
73 
74   reg = X86ManagedRegister::FromXmmRegister(XMM1);
75   EXPECT_TRUE(!reg.IsNoRegister());
76   EXPECT_TRUE(!reg.IsCpuRegister());
77   EXPECT_TRUE(reg.IsXmmRegister());
78   EXPECT_TRUE(!reg.IsX87Register());
79   EXPECT_TRUE(!reg.IsRegisterPair());
80   EXPECT_EQ(XMM1, reg.AsXmmRegister());
81 
82   reg = X86ManagedRegister::FromXmmRegister(XMM7);
83   EXPECT_TRUE(!reg.IsNoRegister());
84   EXPECT_TRUE(!reg.IsCpuRegister());
85   EXPECT_TRUE(reg.IsXmmRegister());
86   EXPECT_TRUE(!reg.IsX87Register());
87   EXPECT_TRUE(!reg.IsRegisterPair());
88   EXPECT_EQ(XMM7, reg.AsXmmRegister());
89 }
90 
TEST(X86ManagedRegister,X87Register)91 TEST(X86ManagedRegister, X87Register) {
92   X86ManagedRegister reg = X86ManagedRegister::FromX87Register(ST0);
93   EXPECT_TRUE(!reg.IsNoRegister());
94   EXPECT_TRUE(!reg.IsCpuRegister());
95   EXPECT_TRUE(!reg.IsXmmRegister());
96   EXPECT_TRUE(reg.IsX87Register());
97   EXPECT_TRUE(!reg.IsRegisterPair());
98   EXPECT_EQ(ST0, reg.AsX87Register());
99 
100   reg = X86ManagedRegister::FromX87Register(ST1);
101   EXPECT_TRUE(!reg.IsNoRegister());
102   EXPECT_TRUE(!reg.IsCpuRegister());
103   EXPECT_TRUE(!reg.IsXmmRegister());
104   EXPECT_TRUE(reg.IsX87Register());
105   EXPECT_TRUE(!reg.IsRegisterPair());
106   EXPECT_EQ(ST1, reg.AsX87Register());
107 
108   reg = X86ManagedRegister::FromX87Register(ST7);
109   EXPECT_TRUE(!reg.IsNoRegister());
110   EXPECT_TRUE(!reg.IsCpuRegister());
111   EXPECT_TRUE(!reg.IsXmmRegister());
112   EXPECT_TRUE(reg.IsX87Register());
113   EXPECT_TRUE(!reg.IsRegisterPair());
114   EXPECT_EQ(ST7, reg.AsX87Register());
115 }
116 
TEST(X86ManagedRegister,RegisterPair)117 TEST(X86ManagedRegister, RegisterPair) {
118   X86ManagedRegister reg = X86ManagedRegister::FromRegisterPair(EAX_EDX);
119   EXPECT_TRUE(!reg.IsNoRegister());
120   EXPECT_TRUE(!reg.IsCpuRegister());
121   EXPECT_TRUE(!reg.IsXmmRegister());
122   EXPECT_TRUE(!reg.IsX87Register());
123   EXPECT_TRUE(reg.IsRegisterPair());
124   EXPECT_EQ(EAX, reg.AsRegisterPairLow());
125   EXPECT_EQ(EDX, reg.AsRegisterPairHigh());
126 
127   reg = X86ManagedRegister::FromRegisterPair(EAX_ECX);
128   EXPECT_TRUE(!reg.IsNoRegister());
129   EXPECT_TRUE(!reg.IsCpuRegister());
130   EXPECT_TRUE(!reg.IsXmmRegister());
131   EXPECT_TRUE(!reg.IsX87Register());
132   EXPECT_TRUE(reg.IsRegisterPair());
133   EXPECT_EQ(EAX, reg.AsRegisterPairLow());
134   EXPECT_EQ(ECX, reg.AsRegisterPairHigh());
135 
136   reg = X86ManagedRegister::FromRegisterPair(EAX_EBX);
137   EXPECT_TRUE(!reg.IsNoRegister());
138   EXPECT_TRUE(!reg.IsCpuRegister());
139   EXPECT_TRUE(!reg.IsXmmRegister());
140   EXPECT_TRUE(!reg.IsX87Register());
141   EXPECT_TRUE(reg.IsRegisterPair());
142   EXPECT_EQ(EAX, reg.AsRegisterPairLow());
143   EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
144 
145   reg = X86ManagedRegister::FromRegisterPair(EAX_EDI);
146   EXPECT_TRUE(!reg.IsNoRegister());
147   EXPECT_TRUE(!reg.IsCpuRegister());
148   EXPECT_TRUE(!reg.IsXmmRegister());
149   EXPECT_TRUE(!reg.IsX87Register());
150   EXPECT_TRUE(reg.IsRegisterPair());
151   EXPECT_EQ(EAX, reg.AsRegisterPairLow());
152   EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
153 
154   reg = X86ManagedRegister::FromRegisterPair(EDX_ECX);
155   EXPECT_TRUE(!reg.IsNoRegister());
156   EXPECT_TRUE(!reg.IsCpuRegister());
157   EXPECT_TRUE(!reg.IsXmmRegister());
158   EXPECT_TRUE(!reg.IsX87Register());
159   EXPECT_TRUE(reg.IsRegisterPair());
160   EXPECT_EQ(EDX, reg.AsRegisterPairLow());
161   EXPECT_EQ(ECX, reg.AsRegisterPairHigh());
162 
163   reg = X86ManagedRegister::FromRegisterPair(EDX_EBX);
164   EXPECT_TRUE(!reg.IsNoRegister());
165   EXPECT_TRUE(!reg.IsCpuRegister());
166   EXPECT_TRUE(!reg.IsXmmRegister());
167   EXPECT_TRUE(!reg.IsX87Register());
168   EXPECT_TRUE(reg.IsRegisterPair());
169   EXPECT_EQ(EDX, reg.AsRegisterPairLow());
170   EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
171 
172   reg = X86ManagedRegister::FromRegisterPair(EDX_EDI);
173   EXPECT_TRUE(!reg.IsNoRegister());
174   EXPECT_TRUE(!reg.IsCpuRegister());
175   EXPECT_TRUE(!reg.IsXmmRegister());
176   EXPECT_TRUE(!reg.IsX87Register());
177   EXPECT_TRUE(reg.IsRegisterPair());
178   EXPECT_EQ(EDX, reg.AsRegisterPairLow());
179   EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
180 
181   reg = X86ManagedRegister::FromRegisterPair(ECX_EBX);
182   EXPECT_TRUE(!reg.IsNoRegister());
183   EXPECT_TRUE(!reg.IsCpuRegister());
184   EXPECT_TRUE(!reg.IsXmmRegister());
185   EXPECT_TRUE(!reg.IsX87Register());
186   EXPECT_TRUE(reg.IsRegisterPair());
187   EXPECT_EQ(ECX, reg.AsRegisterPairLow());
188   EXPECT_EQ(EBX, reg.AsRegisterPairHigh());
189 
190   reg = X86ManagedRegister::FromRegisterPair(ECX_EDI);
191   EXPECT_TRUE(!reg.IsNoRegister());
192   EXPECT_TRUE(!reg.IsCpuRegister());
193   EXPECT_TRUE(!reg.IsXmmRegister());
194   EXPECT_TRUE(!reg.IsX87Register());
195   EXPECT_TRUE(reg.IsRegisterPair());
196   EXPECT_EQ(ECX, reg.AsRegisterPairLow());
197   EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
198 
199   reg = X86ManagedRegister::FromRegisterPair(EBX_EDI);
200   EXPECT_TRUE(!reg.IsNoRegister());
201   EXPECT_TRUE(!reg.IsCpuRegister());
202   EXPECT_TRUE(!reg.IsXmmRegister());
203   EXPECT_TRUE(!reg.IsX87Register());
204   EXPECT_TRUE(reg.IsRegisterPair());
205   EXPECT_EQ(EBX, reg.AsRegisterPairLow());
206   EXPECT_EQ(EDI, reg.AsRegisterPairHigh());
207 }
208 
TEST(X86ManagedRegister,Equals)209 TEST(X86ManagedRegister, Equals) {
210   X86ManagedRegister reg_eax = X86ManagedRegister::FromCpuRegister(EAX);
211   EXPECT_TRUE(reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
212   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
213   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
214   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
215   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
216   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromX87Register(ST0)));
217   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromX87Register(ST7)));
218   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
219   EXPECT_TRUE(!reg_eax.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
220 
221   X86ManagedRegister reg_xmm0 = X86ManagedRegister::FromXmmRegister(XMM0);
222   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
223   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
224   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
225   EXPECT_TRUE(reg_xmm0.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
226   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
227   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromX87Register(ST0)));
228   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromX87Register(ST7)));
229   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
230   EXPECT_TRUE(!reg_xmm0.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
231 
232   X86ManagedRegister reg_st0 = X86ManagedRegister::FromX87Register(ST0);
233   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
234   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
235   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
236   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
237   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
238   EXPECT_TRUE(reg_st0.Equals(X86ManagedRegister::FromX87Register(ST0)));
239   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromX87Register(ST7)));
240   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
241   EXPECT_TRUE(!reg_st0.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
242 
243   X86ManagedRegister reg_pair = X86ManagedRegister::FromRegisterPair(EAX_EDX);
244   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EAX)));
245   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EBX)));
246   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromCpuRegister(EDI)));
247   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromXmmRegister(XMM0)));
248   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromXmmRegister(XMM7)));
249   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromX87Register(ST0)));
250   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromX87Register(ST7)));
251   EXPECT_TRUE(reg_pair.Equals(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
252   EXPECT_TRUE(!reg_pair.Equals(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
253 }
254 
TEST(X86ManagedRegister,Overlaps)255 TEST(X86ManagedRegister, Overlaps) {
256   X86ManagedRegister reg = X86ManagedRegister::FromCpuRegister(EAX);
257   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
258   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
259   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
260   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
261   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
262   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
263   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
264   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
265   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
266 
267   reg = X86ManagedRegister::FromCpuRegister(EDX);
268   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
269   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
270   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
271   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
272   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
273   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
274   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
275   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
276   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
277 
278   reg = X86ManagedRegister::FromCpuRegister(EDI);
279   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
280   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
281   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
282   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
283   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
284   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
285   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
286   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
287   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
288 
289   reg = X86ManagedRegister::FromCpuRegister(EBX);
290   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
291   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
292   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
293   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
294   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
295   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
296   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
297   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
298   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
299 
300   reg = X86ManagedRegister::FromXmmRegister(XMM0);
301   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
302   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
303   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
304   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
305   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
306   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
307   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
308   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
309   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
310 
311   reg = X86ManagedRegister::FromX87Register(ST0);
312   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
313   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
314   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
315   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
316   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
317   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
318   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
319   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
320   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
321 
322   reg = X86ManagedRegister::FromRegisterPair(EAX_EDX);
323   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
324   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
325   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
326   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
327   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
328   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
329   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
330   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
331   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_ECX)));
332   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
333 
334   reg = X86ManagedRegister::FromRegisterPair(EBX_EDI);
335   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
336   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
337   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
338   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
339   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
340   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
341   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
342   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
343   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
344   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_EBX)));
345 
346   reg = X86ManagedRegister::FromRegisterPair(EDX_ECX);
347   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EAX)));
348   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EBX)));
349   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromCpuRegister(EDI)));
350   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM0)));
351   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromXmmRegister(XMM7)));
352   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST0)));
353   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromX87Register(ST7)));
354   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EAX_EDX)));
355   EXPECT_TRUE(!reg.Overlaps(X86ManagedRegister::FromRegisterPair(EBX_EDI)));
356   EXPECT_TRUE(reg.Overlaps(X86ManagedRegister::FromRegisterPair(EDX_EBX)));
357 }
358 
359 }  // namespace x86
360 }  // namespace art
361