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_arm.h"
19#include "gtest/gtest.h"
20
21namespace art {
22namespace arm {
23
24TEST(ArmManagedRegister, NoRegister) {
25  ArmManagedRegister reg = ManagedRegister::NoRegister().AsArm();
26  EXPECT_TRUE(reg.IsNoRegister());
27  EXPECT_TRUE(!reg.Overlaps(reg));
28}
29
30TEST(ArmManagedRegister, CoreRegister) {
31  ArmManagedRegister reg = ArmManagedRegister::FromCoreRegister(R0);
32  EXPECT_TRUE(!reg.IsNoRegister());
33  EXPECT_TRUE(reg.IsCoreRegister());
34  EXPECT_TRUE(!reg.IsSRegister());
35  EXPECT_TRUE(!reg.IsDRegister());
36  EXPECT_TRUE(!reg.IsRegisterPair());
37  EXPECT_EQ(R0, reg.AsCoreRegister());
38
39  reg = ArmManagedRegister::FromCoreRegister(R1);
40  EXPECT_TRUE(!reg.IsNoRegister());
41  EXPECT_TRUE(reg.IsCoreRegister());
42  EXPECT_TRUE(!reg.IsSRegister());
43  EXPECT_TRUE(!reg.IsDRegister());
44  EXPECT_TRUE(!reg.IsOverlappingDRegister());
45  EXPECT_TRUE(!reg.IsRegisterPair());
46  EXPECT_EQ(R1, reg.AsCoreRegister());
47
48  reg = ArmManagedRegister::FromCoreRegister(R8);
49  EXPECT_TRUE(!reg.IsNoRegister());
50  EXPECT_TRUE(reg.IsCoreRegister());
51  EXPECT_TRUE(!reg.IsSRegister());
52  EXPECT_TRUE(!reg.IsDRegister());
53  EXPECT_TRUE(!reg.IsOverlappingDRegister());
54  EXPECT_TRUE(!reg.IsRegisterPair());
55  EXPECT_EQ(R8, reg.AsCoreRegister());
56
57  reg = ArmManagedRegister::FromCoreRegister(R15);
58  EXPECT_TRUE(!reg.IsNoRegister());
59  EXPECT_TRUE(reg.IsCoreRegister());
60  EXPECT_TRUE(!reg.IsSRegister());
61  EXPECT_TRUE(!reg.IsDRegister());
62  EXPECT_TRUE(!reg.IsOverlappingDRegister());
63  EXPECT_TRUE(!reg.IsRegisterPair());
64  EXPECT_EQ(R15, reg.AsCoreRegister());
65}
66
67
68TEST(ArmManagedRegister, SRegister) {
69  ArmManagedRegister reg = ArmManagedRegister::FromSRegister(S0);
70  EXPECT_TRUE(!reg.IsNoRegister());
71  EXPECT_TRUE(!reg.IsCoreRegister());
72  EXPECT_TRUE(reg.IsSRegister());
73  EXPECT_TRUE(!reg.IsDRegister());
74  EXPECT_TRUE(!reg.IsOverlappingDRegister());
75  EXPECT_TRUE(!reg.IsRegisterPair());
76  EXPECT_EQ(S0, reg.AsSRegister());
77
78  reg = ArmManagedRegister::FromSRegister(S1);
79  EXPECT_TRUE(!reg.IsNoRegister());
80  EXPECT_TRUE(!reg.IsCoreRegister());
81  EXPECT_TRUE(reg.IsSRegister());
82  EXPECT_TRUE(!reg.IsDRegister());
83  EXPECT_TRUE(!reg.IsOverlappingDRegister());
84  EXPECT_TRUE(!reg.IsRegisterPair());
85  EXPECT_EQ(S1, reg.AsSRegister());
86
87  reg = ArmManagedRegister::FromSRegister(S3);
88  EXPECT_TRUE(!reg.IsNoRegister());
89  EXPECT_TRUE(!reg.IsCoreRegister());
90  EXPECT_TRUE(reg.IsSRegister());
91  EXPECT_TRUE(!reg.IsDRegister());
92  EXPECT_TRUE(!reg.IsOverlappingDRegister());
93  EXPECT_TRUE(!reg.IsRegisterPair());
94  EXPECT_EQ(S3, reg.AsSRegister());
95
96  reg = ArmManagedRegister::FromSRegister(S15);
97  EXPECT_TRUE(!reg.IsNoRegister());
98  EXPECT_TRUE(!reg.IsCoreRegister());
99  EXPECT_TRUE(reg.IsSRegister());
100  EXPECT_TRUE(!reg.IsDRegister());
101  EXPECT_TRUE(!reg.IsOverlappingDRegister());
102  EXPECT_TRUE(!reg.IsRegisterPair());
103  EXPECT_EQ(S15, reg.AsSRegister());
104
105  reg = ArmManagedRegister::FromSRegister(S30);
106  EXPECT_TRUE(!reg.IsNoRegister());
107  EXPECT_TRUE(!reg.IsCoreRegister());
108  EXPECT_TRUE(reg.IsSRegister());
109  EXPECT_TRUE(!reg.IsDRegister());
110  EXPECT_TRUE(!reg.IsOverlappingDRegister());
111  EXPECT_TRUE(!reg.IsRegisterPair());
112  EXPECT_EQ(S30, reg.AsSRegister());
113
114  reg = ArmManagedRegister::FromSRegister(S31);
115  EXPECT_TRUE(!reg.IsNoRegister());
116  EXPECT_TRUE(!reg.IsCoreRegister());
117  EXPECT_TRUE(reg.IsSRegister());
118  EXPECT_TRUE(!reg.IsDRegister());
119  EXPECT_TRUE(!reg.IsOverlappingDRegister());
120  EXPECT_TRUE(!reg.IsRegisterPair());
121  EXPECT_EQ(S31, reg.AsSRegister());
122}
123
124
125TEST(ArmManagedRegister, DRegister) {
126  ArmManagedRegister reg = ArmManagedRegister::FromDRegister(D0);
127  EXPECT_TRUE(!reg.IsNoRegister());
128  EXPECT_TRUE(!reg.IsCoreRegister());
129  EXPECT_TRUE(!reg.IsSRegister());
130  EXPECT_TRUE(reg.IsDRegister());
131  EXPECT_TRUE(reg.IsOverlappingDRegister());
132  EXPECT_TRUE(!reg.IsRegisterPair());
133  EXPECT_EQ(D0, reg.AsDRegister());
134  EXPECT_EQ(S0, reg.AsOverlappingDRegisterLow());
135  EXPECT_EQ(S1, reg.AsOverlappingDRegisterHigh());
136  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromSRegisterPair(S0)));
137
138  reg = ArmManagedRegister::FromDRegister(D1);
139  EXPECT_TRUE(!reg.IsNoRegister());
140  EXPECT_TRUE(!reg.IsCoreRegister());
141  EXPECT_TRUE(!reg.IsSRegister());
142  EXPECT_TRUE(reg.IsDRegister());
143  EXPECT_TRUE(reg.IsOverlappingDRegister());
144  EXPECT_TRUE(!reg.IsRegisterPair());
145  EXPECT_EQ(D1, reg.AsDRegister());
146  EXPECT_EQ(S2, reg.AsOverlappingDRegisterLow());
147  EXPECT_EQ(S3, reg.AsOverlappingDRegisterHigh());
148  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromSRegisterPair(S2)));
149
150  reg = ArmManagedRegister::FromDRegister(D6);
151  EXPECT_TRUE(!reg.IsNoRegister());
152  EXPECT_TRUE(!reg.IsCoreRegister());
153  EXPECT_TRUE(!reg.IsSRegister());
154  EXPECT_TRUE(reg.IsDRegister());
155  EXPECT_TRUE(reg.IsOverlappingDRegister());
156  EXPECT_TRUE(!reg.IsRegisterPair());
157  EXPECT_EQ(D6, reg.AsDRegister());
158  EXPECT_EQ(S12, reg.AsOverlappingDRegisterLow());
159  EXPECT_EQ(S13, reg.AsOverlappingDRegisterHigh());
160  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromSRegisterPair(S12)));
161
162  reg = ArmManagedRegister::FromDRegister(D14);
163  EXPECT_TRUE(!reg.IsNoRegister());
164  EXPECT_TRUE(!reg.IsCoreRegister());
165  EXPECT_TRUE(!reg.IsSRegister());
166  EXPECT_TRUE(reg.IsDRegister());
167  EXPECT_TRUE(reg.IsOverlappingDRegister());
168  EXPECT_TRUE(!reg.IsRegisterPair());
169  EXPECT_EQ(D14, reg.AsDRegister());
170  EXPECT_EQ(S28, reg.AsOverlappingDRegisterLow());
171  EXPECT_EQ(S29, reg.AsOverlappingDRegisterHigh());
172  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromSRegisterPair(S28)));
173
174  reg = ArmManagedRegister::FromDRegister(D15);
175  EXPECT_TRUE(!reg.IsNoRegister());
176  EXPECT_TRUE(!reg.IsCoreRegister());
177  EXPECT_TRUE(!reg.IsSRegister());
178  EXPECT_TRUE(reg.IsDRegister());
179  EXPECT_TRUE(reg.IsOverlappingDRegister());
180  EXPECT_TRUE(!reg.IsRegisterPair());
181  EXPECT_EQ(D15, reg.AsDRegister());
182  EXPECT_EQ(S30, reg.AsOverlappingDRegisterLow());
183  EXPECT_EQ(S31, reg.AsOverlappingDRegisterHigh());
184  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromSRegisterPair(S30)));
185
186#ifdef VFPv3_D32
187  reg = ArmManagedRegister::FromDRegister(D16);
188  EXPECT_TRUE(!reg.IsNoRegister());
189  EXPECT_TRUE(!reg.IsCoreRegister());
190  EXPECT_TRUE(!reg.IsSRegister());
191  EXPECT_TRUE(reg.IsDRegister());
192  EXPECT_TRUE(!reg.IsOverlappingDRegister());
193  EXPECT_TRUE(!reg.IsRegisterPair());
194  EXPECT_EQ(D16, reg.AsDRegister());
195
196  reg = ArmManagedRegister::FromDRegister(D18);
197  EXPECT_TRUE(!reg.IsNoRegister());
198  EXPECT_TRUE(!reg.IsCoreRegister());
199  EXPECT_TRUE(!reg.IsSRegister());
200  EXPECT_TRUE(reg.IsDRegister());
201  EXPECT_TRUE(!reg.IsOverlappingDRegister());
202  EXPECT_TRUE(!reg.IsRegisterPair());
203  EXPECT_EQ(D18, reg.AsDRegister());
204
205  reg = ArmManagedRegister::FromDRegister(D30);
206  EXPECT_TRUE(!reg.IsNoRegister());
207  EXPECT_TRUE(!reg.IsCoreRegister());
208  EXPECT_TRUE(!reg.IsSRegister());
209  EXPECT_TRUE(reg.IsDRegister());
210  EXPECT_TRUE(!reg.IsOverlappingDRegister());
211  EXPECT_TRUE(!reg.IsRegisterPair());
212  EXPECT_EQ(D30, reg.AsDRegister());
213
214  reg = ArmManagedRegister::FromDRegister(D31);
215  EXPECT_TRUE(!reg.IsNoRegister());
216  EXPECT_TRUE(!reg.IsCoreRegister());
217  EXPECT_TRUE(!reg.IsSRegister());
218  EXPECT_TRUE(reg.IsDRegister());
219  EXPECT_TRUE(!reg.IsOverlappingDRegister());
220  EXPECT_TRUE(!reg.IsRegisterPair());
221  EXPECT_EQ(D31, reg.AsDRegister());
222#endif  // VFPv3_D32
223}
224
225
226TEST(ArmManagedRegister, Pair) {
227  ArmManagedRegister reg = ArmManagedRegister::FromRegisterPair(R0_R1);
228  EXPECT_TRUE(!reg.IsNoRegister());
229  EXPECT_TRUE(!reg.IsCoreRegister());
230  EXPECT_TRUE(!reg.IsSRegister());
231  EXPECT_TRUE(!reg.IsDRegister());
232  EXPECT_TRUE(!reg.IsOverlappingDRegister());
233  EXPECT_TRUE(reg.IsRegisterPair());
234  EXPECT_EQ(R0_R1, reg.AsRegisterPair());
235  EXPECT_EQ(R0, reg.AsRegisterPairLow());
236  EXPECT_EQ(R1, reg.AsRegisterPairHigh());
237  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromCoreRegisterPair(R0)));
238
239  reg = ArmManagedRegister::FromRegisterPair(R1_R2);
240  EXPECT_TRUE(!reg.IsNoRegister());
241  EXPECT_TRUE(!reg.IsCoreRegister());
242  EXPECT_TRUE(!reg.IsSRegister());
243  EXPECT_TRUE(!reg.IsDRegister());
244  EXPECT_TRUE(!reg.IsOverlappingDRegister());
245  EXPECT_TRUE(reg.IsRegisterPair());
246  EXPECT_EQ(R1_R2, reg.AsRegisterPair());
247  EXPECT_EQ(R1, reg.AsRegisterPairLow());
248  EXPECT_EQ(R2, reg.AsRegisterPairHigh());
249  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromCoreRegisterPair(R1)));
250
251  reg = ArmManagedRegister::FromRegisterPair(R2_R3);
252  EXPECT_TRUE(!reg.IsNoRegister());
253  EXPECT_TRUE(!reg.IsCoreRegister());
254  EXPECT_TRUE(!reg.IsSRegister());
255  EXPECT_TRUE(!reg.IsDRegister());
256  EXPECT_TRUE(!reg.IsOverlappingDRegister());
257  EXPECT_TRUE(reg.IsRegisterPair());
258  EXPECT_EQ(R2_R3, reg.AsRegisterPair());
259  EXPECT_EQ(R2, reg.AsRegisterPairLow());
260  EXPECT_EQ(R3, reg.AsRegisterPairHigh());
261  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromCoreRegisterPair(R2)));
262
263  reg = ArmManagedRegister::FromRegisterPair(R4_R5);
264  EXPECT_TRUE(!reg.IsNoRegister());
265  EXPECT_TRUE(!reg.IsCoreRegister());
266  EXPECT_TRUE(!reg.IsSRegister());
267  EXPECT_TRUE(!reg.IsDRegister());
268  EXPECT_TRUE(!reg.IsOverlappingDRegister());
269  EXPECT_TRUE(reg.IsRegisterPair());
270  EXPECT_EQ(R4_R5, reg.AsRegisterPair());
271  EXPECT_EQ(R4, reg.AsRegisterPairLow());
272  EXPECT_EQ(R5, reg.AsRegisterPairHigh());
273  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromCoreRegisterPair(R4)));
274
275  reg = ArmManagedRegister::FromRegisterPair(R6_R7);
276  EXPECT_TRUE(!reg.IsNoRegister());
277  EXPECT_TRUE(!reg.IsCoreRegister());
278  EXPECT_TRUE(!reg.IsSRegister());
279  EXPECT_TRUE(!reg.IsDRegister());
280  EXPECT_TRUE(!reg.IsOverlappingDRegister());
281  EXPECT_TRUE(reg.IsRegisterPair());
282  EXPECT_EQ(R6_R7, reg.AsRegisterPair());
283  EXPECT_EQ(R6, reg.AsRegisterPairLow());
284  EXPECT_EQ(R7, reg.AsRegisterPairHigh());
285  EXPECT_TRUE(reg.Equals(ArmManagedRegister::FromCoreRegisterPair(R6)));
286}
287
288
289TEST(ArmManagedRegister, Equals) {
290  ManagedRegister no_reg = ManagedRegister::NoRegister();
291  EXPECT_TRUE(no_reg.Equals(ArmManagedRegister::NoRegister()));
292  EXPECT_TRUE(!no_reg.Equals(ArmManagedRegister::FromCoreRegister(R0)));
293  EXPECT_TRUE(!no_reg.Equals(ArmManagedRegister::FromCoreRegister(R1)));
294  EXPECT_TRUE(!no_reg.Equals(ArmManagedRegister::FromSRegister(S0)));
295  EXPECT_TRUE(!no_reg.Equals(ArmManagedRegister::FromDRegister(D0)));
296  EXPECT_TRUE(!no_reg.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
297
298  ArmManagedRegister reg_R0 = ArmManagedRegister::FromCoreRegister(R0);
299  EXPECT_TRUE(!reg_R0.Equals(ArmManagedRegister::NoRegister()));
300  EXPECT_TRUE(reg_R0.Equals(ArmManagedRegister::FromCoreRegister(R0)));
301  EXPECT_TRUE(!reg_R0.Equals(ArmManagedRegister::FromCoreRegister(R1)));
302  EXPECT_TRUE(!reg_R0.Equals(ArmManagedRegister::FromSRegister(S0)));
303  EXPECT_TRUE(!reg_R0.Equals(ArmManagedRegister::FromDRegister(D0)));
304  EXPECT_TRUE(!reg_R0.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
305
306  ArmManagedRegister reg_R1 = ArmManagedRegister::FromCoreRegister(R1);
307  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::NoRegister()));
308  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromCoreRegister(R0)));
309  EXPECT_TRUE(reg_R1.Equals(ArmManagedRegister::FromCoreRegister(R1)));
310  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromSRegister(S0)));
311  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromDRegister(D0)));
312  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromSRegister(S1)));
313  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromDRegister(D1)));
314  EXPECT_TRUE(!reg_R1.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
315
316  ArmManagedRegister reg_R8 = ArmManagedRegister::FromCoreRegister(R8);
317  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::NoRegister()));
318  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromCoreRegister(R0)));
319  EXPECT_TRUE(reg_R8.Equals(ArmManagedRegister::FromCoreRegister(R8)));
320  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromSRegister(S0)));
321  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromDRegister(D0)));
322  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromSRegister(S1)));
323  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromDRegister(D1)));
324  EXPECT_TRUE(!reg_R8.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
325
326  ArmManagedRegister reg_S0 = ArmManagedRegister::FromSRegister(S0);
327  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::NoRegister()));
328  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromCoreRegister(R0)));
329  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromCoreRegister(R1)));
330  EXPECT_TRUE(reg_S0.Equals(ArmManagedRegister::FromSRegister(S0)));
331  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromSRegister(S1)));
332  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromDRegister(D0)));
333  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromDRegister(D1)));
334  EXPECT_TRUE(!reg_S0.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
335
336  ArmManagedRegister reg_S1 = ArmManagedRegister::FromSRegister(S1);
337  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::NoRegister()));
338  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromCoreRegister(R0)));
339  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromCoreRegister(R1)));
340  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromSRegister(S0)));
341  EXPECT_TRUE(reg_S1.Equals(ArmManagedRegister::FromSRegister(S1)));
342  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromDRegister(D0)));
343  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromDRegister(D1)));
344  EXPECT_TRUE(!reg_S1.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
345
346  ArmManagedRegister reg_S31 = ArmManagedRegister::FromSRegister(S31);
347  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::NoRegister()));
348  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromCoreRegister(R0)));
349  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromCoreRegister(R1)));
350  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromSRegister(S0)));
351  EXPECT_TRUE(reg_S31.Equals(ArmManagedRegister::FromSRegister(S31)));
352  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromDRegister(D0)));
353  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromDRegister(D1)));
354  EXPECT_TRUE(!reg_S31.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
355
356  ArmManagedRegister reg_D0 = ArmManagedRegister::FromDRegister(D0);
357  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::NoRegister()));
358  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromCoreRegister(R0)));
359  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromCoreRegister(R1)));
360  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromSRegister(S0)));
361  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromSRegister(S31)));
362  EXPECT_TRUE(reg_D0.Equals(ArmManagedRegister::FromDRegister(D0)));
363  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromDRegister(D1)));
364  EXPECT_TRUE(!reg_D0.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
365
366  ArmManagedRegister reg_D15 = ArmManagedRegister::FromDRegister(D15);
367  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::NoRegister()));
368  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromCoreRegister(R0)));
369  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromCoreRegister(R1)));
370  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromSRegister(S0)));
371  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromSRegister(S31)));
372  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromDRegister(D0)));
373  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromDRegister(D1)));
374  EXPECT_TRUE(reg_D15.Equals(ArmManagedRegister::FromDRegister(D15)));
375  EXPECT_TRUE(!reg_D15.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
376
377#ifdef VFPv3_D32
378  ArmManagedRegister reg_D16 = ArmManagedRegister::FromDRegister(D16);
379  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::NoRegister()));
380  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromCoreRegister(R0)));
381  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromCoreRegister(R1)));
382  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromSRegister(S0)));
383  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromSRegister(S31)));
384  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromDRegister(D0)));
385  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromDRegister(D1)));
386  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromDRegister(D15)));
387  EXPECT_TRUE(reg_D16.Equals(ArmManagedRegister::FromDRegister(D16)));
388  EXPECT_TRUE(!reg_D16.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
389
390  ArmManagedRegister reg_D30 = ArmManagedRegister::FromDRegister(D30);
391  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::NoRegister()));
392  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromCoreRegister(R0)));
393  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromCoreRegister(R1)));
394  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromSRegister(S0)));
395  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromSRegister(S31)));
396  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromDRegister(D0)));
397  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromDRegister(D1)));
398  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromDRegister(D15)));
399  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromDRegister(D16)));
400  EXPECT_TRUE(reg_D30.Equals(ArmManagedRegister::FromDRegister(D30)));
401  EXPECT_TRUE(!reg_D30.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
402
403  ArmManagedRegister reg_D31 = ArmManagedRegister::FromDRegister(D30);
404  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::NoRegister()));
405  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromCoreRegister(R0)));
406  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromCoreRegister(R1)));
407  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromSRegister(S0)));
408  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromSRegister(S31)));
409  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromDRegister(D0)));
410  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromDRegister(D1)));
411  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromDRegister(D15)));
412  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromDRegister(D16)));
413  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromDRegister(D30)));
414  EXPECT_TRUE(reg_D31.Equals(ArmManagedRegister::FromDRegister(D31)));
415  EXPECT_TRUE(!reg_D31.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
416#endif  // VFPv3_D32
417
418  ArmManagedRegister reg_R0R1 = ArmManagedRegister::FromRegisterPair(R0_R1);
419  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::NoRegister()));
420  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromCoreRegister(R0)));
421  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromCoreRegister(R1)));
422  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromSRegister(S0)));
423  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromSRegister(S31)));
424  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromDRegister(D0)));
425  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromDRegister(D1)));
426  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromDRegister(D15)));
427  EXPECT_TRUE(reg_R0R1.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
428  EXPECT_TRUE(!reg_R0R1.Equals(ArmManagedRegister::FromRegisterPair(R2_R3)));
429
430  ArmManagedRegister reg_R4R5 = ArmManagedRegister::FromRegisterPair(R4_R5);
431  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::NoRegister()));
432  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromCoreRegister(R0)));
433  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromCoreRegister(R1)));
434  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromSRegister(S0)));
435  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromSRegister(S31)));
436  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromDRegister(D0)));
437  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromDRegister(D1)));
438  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromDRegister(D15)));
439  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
440  EXPECT_TRUE(reg_R4R5.Equals(ArmManagedRegister::FromRegisterPair(R4_R5)));
441  EXPECT_TRUE(!reg_R4R5.Equals(ArmManagedRegister::FromRegisterPair(R6_R7)));
442
443  ArmManagedRegister reg_R6R7 = ArmManagedRegister::FromRegisterPair(R6_R7);
444  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::NoRegister()));
445  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromCoreRegister(R0)));
446  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromCoreRegister(R1)));
447  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromSRegister(S0)));
448  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromSRegister(S31)));
449  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromDRegister(D0)));
450  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromDRegister(D1)));
451  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromDRegister(D15)));
452  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromRegisterPair(R0_R1)));
453  EXPECT_TRUE(!reg_R6R7.Equals(ArmManagedRegister::FromRegisterPair(R4_R5)));
454  EXPECT_TRUE(reg_R6R7.Equals(ArmManagedRegister::FromRegisterPair(R6_R7)));
455}
456
457
458TEST(ArmManagedRegister, Overlaps) {
459  ArmManagedRegister reg = ArmManagedRegister::FromCoreRegister(R0);
460  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
461  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
462  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
463  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
464  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
465  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
466  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
467  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
468  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
469  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
470  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
471  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
472  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
473  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
474#ifdef VFPv3_D32
475  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
476  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
477#endif  // VFPv3_D32
478  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
479  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
480
481  reg = ArmManagedRegister::FromCoreRegister(R1);
482  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
483  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
484  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
485  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
486  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
487  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
488  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
489  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
490  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
491  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
492  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
493  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
494  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
495  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
496#ifdef VFPv3_D32
497  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
498  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
499#endif  // VFPv3_D32
500  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
501  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
502
503  reg = ArmManagedRegister::FromCoreRegister(R7);
504  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
505  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
506  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
507  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
508  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
509  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
510  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
511  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
512  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
513  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
514  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
515  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
516  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
517  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
518#ifdef VFPv3_D32
519  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
520  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
521#endif  // VFPv3_D32
522  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
523  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
524
525  reg = ArmManagedRegister::FromSRegister(S0);
526  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
527  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
528  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
529  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
530  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
531  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
532  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
533  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
534  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
535  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
536  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
537  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
538  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
539  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
540#ifdef VFPv3_D32
541  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
542  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
543#endif  // VFPv3_D32
544  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
545  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
546
547  reg = ArmManagedRegister::FromSRegister(S1);
548  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
549  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
550  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
551  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
552  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
553  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
554  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
555  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
556  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
557  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
558  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
559  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
560  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
561  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
562#ifdef VFPv3_D32
563  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
564  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
565#endif  // VFPv3_D32
566  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
567  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
568
569  reg = ArmManagedRegister::FromSRegister(S15);
570  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
571  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
572  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
573  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
574  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
575  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
576  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
577  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
578  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
579  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
580  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
581  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
582  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
583  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
584#ifdef VFPv3_D32
585  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
586  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
587#endif  // VFPv3_D32
588  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
589  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
590
591  reg = ArmManagedRegister::FromSRegister(S31);
592  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
593  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
594  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
595  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
596  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
597  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
598  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
599  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
600  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
601  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
602  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
603  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
604  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
605  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
606#ifdef VFPv3_D32
607  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
608  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
609#endif  // VFPv3_D32
610  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
611  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
612
613  reg = ArmManagedRegister::FromDRegister(D0);
614  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
615  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
616  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
617  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
618  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
619  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
620  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
621  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
622  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
623  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
624  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
625  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
626  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
627  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
628#ifdef VFPv3_D32
629  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
630  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
631#endif  // VFPv3_D32
632  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
633  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
634
635  reg = ArmManagedRegister::FromDRegister(D7);
636  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
637  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
638  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
639  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
640  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
641  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
642  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
643  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
644  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
645  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
646  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
647  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
648  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
649  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
650#ifdef VFPv3_D32
651  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
652  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
653#endif  // VFPv3_D32
654  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
655  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
656
657  reg = ArmManagedRegister::FromDRegister(D15);
658  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
659  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
660  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
661  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
662  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
663  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
664  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
665  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
666  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
667  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
668  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
669  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
670  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
671  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
672#ifdef VFPv3_D32
673  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
674  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
675#endif  // VFPv3_D32
676  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
677  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
678
679#ifdef VFPv3_D32
680  reg = ArmManagedRegister::FromDRegister(D16);
681  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
682  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
683  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
684  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
685  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
686  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
687  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
688  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
689  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
690  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
691  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
692  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
693  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
694  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
695  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
696  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
697  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
698  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
699
700  reg = ArmManagedRegister::FromDRegister(D31);
701  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
702  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
703  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
704  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
705  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
706  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
707  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
708  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
709  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
710  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
711  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
712  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
713  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
714  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
715  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
716  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
717  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
718  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
719#endif  // VFPv3_D32
720
721  reg = ArmManagedRegister::FromRegisterPair(R0_R1);
722  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
723  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
724  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
725  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
726  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
727  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
728  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
729  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
730  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
731  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
732  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
733  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
734  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
735  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
736#ifdef VFPv3_D32
737  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
738  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
739#endif  // VFPv3_D32
740  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
741  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
742
743  reg = ArmManagedRegister::FromRegisterPair(R4_R5);
744  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R0)));
745  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R1)));
746  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R7)));
747  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromCoreRegister(R8)));
748  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S0)));
749  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S1)));
750  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S2)));
751  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S15)));
752  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S30)));
753  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromSRegister(S31)));
754  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D0)));
755  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D1)));
756  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D7)));
757  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D15)));
758#ifdef VFPv3_D32
759  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D16)));
760  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromDRegister(D31)));
761#endif  // VFPv3_D32
762  EXPECT_TRUE(!reg.Overlaps(ArmManagedRegister::FromRegisterPair(R0_R1)));
763  EXPECT_TRUE(reg.Overlaps(ArmManagedRegister::FromRegisterPair(R4_R5)));
764}
765
766}  // namespace arm
767}  // namespace art
768