6#if defined(TARGET_ARCH_ARM)
25#define AS_UINT32(v) (bit_cast<uint32_t, float>(v))
26#define EXPECT_BITWISE_EQ(a, b) EXPECT_EQ(AS_UINT32(a), AS_UINT32(b))
63#undef EXPECT_BITWISE_EQ
69#define EXPECT_DISASSEMBLY(expected)
71#define EXPECT_DISASSEMBLY(expected) \
72 EXPECT_STREQ(expected, test->RelativeDisassembly())
76 __ mov(
R0, Operand(42));
82 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(SimpleCode,
test->entry()));
86 __ mvn_(
R0, Operand(42));
93 EXPECT_EQ(~42, EXECUTE_TEST_CODE_INT32(MoveNegated,
test->entry()));
108 EXPECT_EQ(0x30550003, EXECUTE_TEST_CODE_INT32(MoveRotImm,
test->entry()));
112 __ LoadPatchableImmediate(
R0, 0x12345678);
119 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INT32(MovImm16,
test->entry()));
123 __ mov(
R0, Operand(0));
124 __ cmp(
R0, Operand(0));
125 __ LoadImmediate(
R0, 0x12345678, EQ);
126 __ LoadImmediate(
R0, 0x87654321,
NE);
133 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INT32(LoadImmediate,
test->entry()));
144 typedef intptr_t (*LoadHalfWordUnaligned)(intptr_t)
DART_UNUSED;
153 static_cast<int16_t
>(
static_cast<uint16_t
>(0xAB89)),
154 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadHalfWordUnaligned,
test->entry(),
155 reinterpret_cast<intptr_t
>(&
buffer[0])));
157 static_cast<int16_t
>(
static_cast<uint16_t
>(0xCDAB)),
158 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadHalfWordUnaligned,
test->entry(),
159 reinterpret_cast<intptr_t
>(&
buffer[1])));
163 __ LoadHalfWordUnsignedUnaligned(
R1,
R0,
TMP);
170 typedef intptr_t (*LoadHalfWordUnsignedUnaligned)(intptr_t)
DART_UNUSED;
178 EXPECT_EQ(0xAB89, EXECUTE_TEST_CODE_INTPTR_INTPTR(
179 LoadHalfWordUnsignedUnaligned,
test->entry(),
180 reinterpret_cast<intptr_t
>(&
buffer[0])));
181 EXPECT_EQ(0xCDAB, EXECUTE_TEST_CODE_INTPTR_INTPTR(
182 LoadHalfWordUnsignedUnaligned,
test->entry(),
183 reinterpret_cast<intptr_t
>(&
buffer[1])));
187 __ LoadImmediate(
R1, 0x1111ABCD);
195 typedef intptr_t (*StoreHalfWordUnaligned)(intptr_t)
DART_UNUSED;
203 EXPECT_EQ(0x1111ABCD, EXECUTE_TEST_CODE_INTPTR_INTPTR(
204 StoreHalfWordUnaligned,
test->entry(),
205 reinterpret_cast<intptr_t
>(&
buffer[0])));
206 EXPECT_EQ(0xCD,
buffer[0]);
207 EXPECT_EQ(0xAB,
buffer[1]);
210 EXPECT_EQ(0x1111ABCD, EXECUTE_TEST_CODE_INTPTR_INTPTR(
211 StoreHalfWordUnaligned,
test->entry(),
212 reinterpret_cast<intptr_t
>(&
buffer[1])));
213 EXPECT_EQ(0xCD,
buffer[1]);
214 EXPECT_EQ(0xAB,
buffer[2]);
226 typedef intptr_t (*LoadWordUnaligned)(intptr_t)
DART_UNUSED;
227 uint8_t
buffer[8] = {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0};
230 static_cast<intptr_t
>(0x78563412),
231 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadWordUnaligned,
test->entry(),
232 reinterpret_cast<intptr_t
>(&
buffer[0])));
234 static_cast<intptr_t
>(0x9A785634),
235 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadWordUnaligned,
test->entry(),
236 reinterpret_cast<intptr_t
>(&
buffer[1])));
238 static_cast<intptr_t
>(0xBC9A7856),
239 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadWordUnaligned,
test->entry(),
240 reinterpret_cast<intptr_t
>(&
buffer[2])));
242 static_cast<intptr_t
>(0xDEBC9A78),
243 EXECUTE_TEST_CODE_INTPTR_INTPTR(LoadWordUnaligned,
test->entry(),
244 reinterpret_cast<intptr_t
>(&
buffer[3])));
248 __ LoadImmediate(
R1, 0x12345678);
256 typedef intptr_t (*StoreWordUnaligned)(intptr_t)
DART_UNUSED;
257 uint8_t
buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
259 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INTPTR_INTPTR(
260 StoreWordUnaligned,
test->entry(),
261 reinterpret_cast<intptr_t
>(&
buffer[0])));
262 EXPECT_EQ(0x78,
buffer[0]);
263 EXPECT_EQ(0x56,
buffer[1]);
264 EXPECT_EQ(0x34,
buffer[2]);
265 EXPECT_EQ(0x12,
buffer[3]);
267 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INTPTR_INTPTR(
268 StoreWordUnaligned,
test->entry(),
269 reinterpret_cast<intptr_t
>(&
buffer[1])));
270 EXPECT_EQ(0x78,
buffer[1]);
271 EXPECT_EQ(0x56,
buffer[2]);
272 EXPECT_EQ(0x34,
buffer[3]);
273 EXPECT_EQ(0x12,
buffer[4]);
275 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INTPTR_INTPTR(
276 StoreWordUnaligned,
test->entry(),
277 reinterpret_cast<intptr_t
>(&
buffer[2])));
278 EXPECT_EQ(0x78,
buffer[2]);
279 EXPECT_EQ(0x56,
buffer[3]);
280 EXPECT_EQ(0x34,
buffer[4]);
281 EXPECT_EQ(0x12,
buffer[5]);
283 EXPECT_EQ(0x12345678, EXECUTE_TEST_CODE_INTPTR_INTPTR(
284 StoreWordUnaligned,
test->entry(),
285 reinterpret_cast<intptr_t
>(&
buffer[3])));
286 EXPECT_EQ(0x78,
buffer[3]);
287 EXPECT_EQ(0x56,
buffer[4]);
288 EXPECT_EQ(0x34,
buffer[5]);
289 EXPECT_EQ(0x12,
buffer[6]);
293 __ mov(
R3, Operand(43));
294 __ mov(
R1, Operand(41));
310 EXPECT_EQ(2, EXECUTE_TEST_CODE_INT32(Vmov,
test->entry()));
314 __ LoadImmediate(
R0, bit_cast<int32_t, float>(12.3f));
327 float res = EXECUTE_TEST_CODE_FLOAT(SingleVLoadStore,
test->entry());
328 EXPECT_FLOAT_EQ(2 * 12.3f, res, 0.001f);
332 __ LoadImmediate(
R0, bit_cast<int32_t, float>(12.3f));
350 float res = EXECUTE_TEST_CODE_FLOAT(SingleVLoadStore,
test->entry());
351 EXPECT_FLOAT_EQ(2 * 12.3f, res, 0.001f);
355 int64_t
value = bit_cast<int64_t, double>(12.3);
372 float res = EXECUTE_TEST_CODE_DOUBLE(DoubleVLoadStore,
test->entry());
373 EXPECT_FLOAT_EQ(2 * 12.3f, res, 0.001f);
377 __ LoadSImmediate(
S0, 12.3f);
378 __ LoadSImmediate(
S1, 3.4f);
392 float res = EXECUTE_TEST_CODE_FLOAT(SingleFPOperations,
test->entry());
393 EXPECT_FLOAT_EQ(3.8340579f, res, 0.001f);
397 __ LoadDImmediate(
D0, 12.3,
R0);
398 __ LoadDImmediate(
D1, 3.4,
R0);
411 typedef double (*DoubleFPOperations)()
DART_UNUSED;
412 double res = EXECUTE_TEST_CODE_DOUBLE(DoubleFPOperations,
test->entry());
413 EXPECT_FLOAT_EQ(3.8340579, res, 0.001);
418 __ LoadDImmediate(
D1, -1.0,
R0);
422 __ mov(
R0, Operand(1),
VS);
423 __ mov(
R0, Operand(0),
VC);
430 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg,
test->entry()));
434 __ mov(
R3, Operand(6));
442 typedef double (*IntToDoubleConversionCode)()
DART_UNUSED;
444 EXECUTE_TEST_CODE_DOUBLE(IntToDoubleConversionCode,
test->entry());
445 EXPECT_FLOAT_EQ(6.0, res, 0.001);
449 int64_t
value = 60000000000LL;
456 __ LoadDImmediate(
D2, 1.0 * (1LL << 32),
R0);
463 typedef double (*LongToDoubleConversionCode)()
DART_UNUSED;
465 EXECUTE_TEST_CODE_DOUBLE(LongToDoubleConversionCode,
test->entry());
466 EXPECT_FLOAT_EQ(60000000000.0, res, 0.001);
470 __ mov(
R3, Operand(6));
479 float res = EXECUTE_TEST_CODE_FLOAT(IntToFloatConversionCode,
test->entry());
480 EXPECT_FLOAT_EQ(6.0, res, 0.001);
492 EXPECT_EQ(12, EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion,
test->entry(),
494 EXPECT_EQ(INT32_MIN, EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion,
495 test->entry(), -FLT_MAX));
496 EXPECT_EQ(INT32_MAX, EXECUTE_TEST_CODE_INT32_F(FloatToIntConversion,
497 test->entry(), FLT_MAX));
509 EXPECT_EQ(12, EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion,
test->entry(),
511 EXPECT_EQ(INT32_MIN, EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion,
512 test->entry(), -DBL_MAX));
513 EXPECT_EQ(INT32_MAX, EXECUTE_TEST_CODE_INT32_D(DoubleToIntConversion,
514 test->entry(), DBL_MAX));
518 __ LoadSImmediate(
S2, 12.8f);
524 typedef double (*FloatToDoubleConversionCode)()
DART_UNUSED;
527 EXECUTE_TEST_CODE_DOUBLE(FloatToDoubleConversionCode,
test->entry());
528 EXPECT_FLOAT_EQ(12.8, res, 0.001);
532 __ LoadDImmediate(
D1, 12.8,
R0);
541 EXECUTE_TEST_CODE_FLOAT(DoubleToFloatConversionCode,
test->entry());
542 EXPECT_FLOAT_EQ(12.8, res, 0.001);
547 __ LoadSImmediate(
S0, 12.3f);
548 __ LoadSImmediate(
S1, 12.5f);
551 __ mov(
R0, Operand(0));
555 __ add(
R0,
R0, Operand(2), GT);
556 __ add(
R0,
R0, Operand(4), EQ);
561 __ LoadSImmediate(
S1, 0.0f);
574 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(FloatCompare,
test->entry()));
579 __ LoadDImmediate(
D0, 12.3,
R1);
580 __ LoadDImmediate(
D1, 12.5,
R1);
583 __ mov(
R0, Operand(0));
587 __ add(
R0,
R0, Operand(2), GT);
588 __ add(
R0,
R0, Operand(4), EQ);
593 __ LoadDImmediate(
D1, 0.0,
R1);
606 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(DoubleCompare,
test->entry()));
611 __ mov(
R0, Operand(1));
612 __ mov(
R1, Operand(2));
616 __ b(&loop_entry,
NE);
623 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop,
test->entry()));
628 __ mov(
R0, Operand(42));
630 __ mov(
R0, Operand(11));
638 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(ForwardBranch,
test->entry()));
643 __ set_use_far_branches(
true);
644 __ mov(
R0, Operand(1));
645 __ mov(
R1, Operand(2));
649 __ b(&loop_entry,
NE);
656 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop,
test->entry()));
661 __ set_use_far_branches(
true);
662 __ mov(
R0, Operand(1));
663 __ mov(
R1, Operand(2));
665 for (
int i = 0;
i < (1 << 22);
i++) {
670 __ b(&loop_entry,
NE);
677 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Loop,
test->entry()));
681 __ mov(
R1, Operand(123));
690 EXPECT_EQ(123, EXECUTE_TEST_CODE_INT32(LoadStore,
test->entry()));
694 __ mov(
R2, Operand(12));
695 __ mov(
R3, Operand(21));
696 __ PushRegisterPair(
R2,
R3);
705 EXPECT_EQ(12, EXECUTE_TEST_CODE_INT32(PushRegisterPair,
test->entry()));
709 __ mov(
R3, Operand(12));
710 __ mov(
R2, Operand(21));
711 __ PushRegisterPair(
R3,
R2);
721 EXECUTE_TEST_CODE_INT32(PushRegisterPairReversed,
test->entry()));
725 __ mov(
R2, Operand(12));
726 __ mov(
R3, Operand(21));
729 __ PopRegisterPair(
R0,
R1);
736 EXPECT_EQ(12, EXECUTE_TEST_CODE_INT32(PopRegisterPair,
test->entry()));
740 __ mov(
R3, Operand(12));
741 __ mov(
R2, Operand(21));
744 __ PopRegisterPair(
R1,
R0);
752 EXECUTE_TEST_CODE_INT32(PopRegisterPairReversed,
test->entry()));
756 __ mov(
R0, Operand(40));
757 __ mov(
R1, Operand(42));
763 __ tst(
IP, Operand(0));
772 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Semaphore,
test->entry()));
776 __ mov(
R0, Operand(40));
777 __ mov(
R1, Operand(42));
790 EXPECT_EQ(41, EXECUTE_TEST_CODE_INT32(FailedSemaphore,
test->entry()));
794 __ mov(
R1, Operand(40));
795 __ sub(
R1,
R1, Operand(2));
796 __ add(
R0,
R1, Operand(4));
797 __ rsbs(
R0,
R0, Operand(100));
798 __ rsc(
R0,
R0, Operand(100));
805 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(AddSub,
test->entry()));
809 __ LoadImmediate(
R2, 0xFFFFFFFF);
810 __ mov(
R1, Operand(1));
811 __ mov(
R0, Operand(0));
820 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarry,
test->entry()));
824 __ LoadImmediate(
R2, 0xFFFFFFFF);
825 __ mov(
R1, Operand(1));
826 __ mov(
R0, Operand(0));
836 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(AddCarryInOut,
test->entry()));
840 __ LoadImmediate(
R2, 0x0);
841 __ mov(
R1, Operand(1));
842 __ mov(
R0, Operand(0));
851 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarry,
test->entry()));
855 __ mov(
R1, Operand(1));
856 __ mov(
R0, Operand(0));
866 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(SubCarryInOut,
test->entry()));
870 __ LoadImmediate(
R0, 0xFFFFFFFF);
871 __ LoadImmediate(
R1, 0x7FFFFFFF);
872 __ adds(
IP,
R0, Operand(1));
873 __ adcs(
IP,
R1, Operand(0));
874 __ mov(
R0, Operand(1),
VS);
881 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Overflow,
test->entry()));
885 __ mov(
R1, Operand(40));
886 __ mov(
R2, Operand(0));
888 __ mov(
R3, Operand(42));
896 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(AndOrr,
test->entry()));
900 __ mov(
R0, Operand(0));
902 __ orrs(
R0,
R0, Operand(1));
904 __ mov(
R0, Operand(42));
906 __ mov(
R0, Operand(2));
913 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Orrs,
test->entry()));
917 __ mov(
R1, Operand(20));
918 __ mov(
R2, Operand(40));
927 EXPECT_EQ(800, EXECUTE_TEST_CODE_INT32(Multiply,
test->entry()));
944 typedef int64_t (*QuotientRemainder)(int64_t dividend, int64_t divisor)
946 EXPECT_EQ(0x1000400000da8LL,
947 EXECUTE_TEST_CODE_INT64_LL(QuotientRemainder,
test->entry(),
948 0x12345678, 0x1234));
964 typedef int64_t (*Multiply64To64)(int64_t operand0, int64_t operand1)
967 EXECUTE_TEST_CODE_INT64_LL(Multiply64To64,
test->entry(), -3, -2));
977 typedef int64_t (*Multiply32To64)(int64_t operand0, int64_t operand1)
980 EXECUTE_TEST_CODE_INT64_LL(Multiply32To64,
test->entry(), -3, -2));
990 typedef int64_t (*MultiplyAccumAccum32To64)(int64_t operand0,
992 EXPECT_EQ(3 + 7 + 5 * 11,
993 EXECUTE_TEST_CODE_INT64_LL(MultiplyAccumAccum32To64,
test->entry(),
994 (3LL << 32) + 7, (5LL << 32) + 11));
1000 __ mov(
R0, Operand(0));
1002 __ cmp(
R1, Operand(32));
1004 __ mov(
R2, Operand(42));
1006 __ cmp(
R2, Operand(26));
1008 __ mvn_(
R0, Operand(0));
1010 __ cmp(
R1, Operand(0));
1012 __ Lsr(
R0,
R0, Operand(3));
1014 __ cmp(
R1, Operand(3));
1016 __ mov(
R0, Operand(0));
1019 __ mov(
R0, Operand(1));
1026 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Clz,
test->entry()));
1030 __ mov(
R0, Operand(0x15));
1038 const int32_t expected = 0xa8000000;
1039 EXPECT_EQ(expected, EXECUTE_TEST_CODE_INT32(Rbit,
test->entry()));
1045 __ mov(
R0, Operand(42));
1046 __ mov(
R1, Operand(40));
1047 __ tst(
R1, Operand(0));
1049 __ mov(
R0, Operand(0));
1057 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1063 __ mov(
R0, Operand(1));
1065 __ mov(
R1, Operand(1));
1073 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1079 __ mov(
R0, Operand(4));
1081 __ mov(
R1, Operand(1));
1089 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1095 __ mov(
R0, Operand(1));
1096 __ Lsl(
R0,
R0, Operand(31));
1097 __ Lsr(
R0,
R0, Operand(31));
1104 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1110 __ mov(
R0, Operand(1));
1111 __ Lsl(
R0,
R0, Operand(31));
1112 __ Asr(
R0,
R0, Operand(31));
1119 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1123 __ mov(
R3, Operand(10));
1124 __ rsb(
R0,
R3, Operand(42));
1131 EXPECT_EQ(32, EXECUTE_TEST_CODE_INT32(Rsb,
test->entry()));
1135 Label Test1, Test2, Test3,
Done;
1137 __ mov(
R1, Operand(0x11));
1141 __ cmp(
R0, Operand(0x11));
1143 __ mov(
R0, Operand(1));
1147 __ mov(
R0, Operand(0x22));
1150 __ cmp(
R1, Operand(0x22));
1152 __ mov(
R0, Operand(1));
1156 __ mov(
R0, Operand(0));
1158 __ strh(
R0, Address(
R2));
1159 __ ldrh(
R1, Address(
R2));
1160 __ cmp(
R1, Operand(0));
1162 __ mov(
R0, Operand(1));
1166 __ mov(
R0, Operand(0));
1175 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1179 __ mov(
R1, Operand(0xFF));
1190 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1194 __ mov(
R1, Operand(0xFF));
1205 EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1209 __ mov(
R1, Operand(0xFF));
1220 EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1224 __ mov(
R1, Operand(0xFF));
1235 EXPECT_EQ(0xff, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1253 typedef int64_t (*Tst)(int64_t r0r1, int64_t r2r3)
DART_UNUSED;
1254 EXPECT_EQ(0x0000444400002222LL,
1255 EXECUTE_TEST_CODE_INT64_LL(Tst,
test->entry(), 0x0000111100000000LL,
1256 0x0000333300002222LL));
1260 __ mov(
R0, Operand(1));
1261 __ mov(
R1, Operand(7));
1262 __ mov(
R2, Operand(11));
1263 __ mov(
R3, Operand(31));
1297 EXPECT_EQ(-52, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1301 __ mov(
R2, Operand(42));
1311 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1315 __ mov(
R2, Operand(42));
1325 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1329 __ mov(
R2, Operand(42));
1339 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1343 __ mov(
R2, Operand(42));
1353 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1357 __ mov(
R2, Operand(42));
1369 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1373 __ mov(
R2, Operand(42));
1383 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1388 __ LoadDImmediate(
D0, 0.0,
R0);
1389 __ LoadDImmediate(
D1, 1.0,
R0);
1390 __ LoadDImmediate(
D2, 2.0,
R0);
1391 __ LoadDImmediate(
D3, 3.0,
R0);
1392 __ LoadDImmediate(
D4, 4.0,
R0);
1394 __ LoadDImmediate(
D0, 0.0,
R0);
1395 __ LoadDImmediate(
D1, 0.0,
R0);
1396 __ LoadDImmediate(
D2, 0.0,
R0);
1397 __ LoadDImmediate(
D3, 0.0,
R0);
1398 __ LoadDImmediate(
D4, 0.0,
R0);
1402 __ mov(
R0, Operand(42));
1405 __ LoadDImmediate(
D5, 4.0,
R1);
1408 __ mov(
R0, Operand(0),
NE);
1411 __ LoadDImmediate(
D5, 3.0,
R1);
1414 __ mov(
R0, Operand(0),
NE);
1417 __ LoadDImmediate(
D5, 2.0,
R1);
1420 __ mov(
R0, Operand(0),
NE);
1423 __ LoadDImmediate(
D5, 1.0,
R1);
1426 __ mov(
R0, Operand(0),
NE);
1433 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1438 __ LoadSImmediate(
S0, 0.0);
1439 __ LoadSImmediate(
S1, 1.0);
1440 __ LoadSImmediate(
S2, 2.0);
1441 __ LoadSImmediate(
S3, 3.0);
1442 __ LoadSImmediate(
S4, 4.0);
1444 __ LoadSImmediate(
S0, 0.0);
1445 __ LoadSImmediate(
S1, 0.0);
1446 __ LoadSImmediate(
S2, 0.0);
1447 __ LoadSImmediate(
S3, 0.0);
1448 __ LoadSImmediate(
S4, 0.0);
1452 __ mov(
R0, Operand(42));
1455 __ LoadSImmediate(
S5, 4.0);
1458 __ mov(
R0, Operand(0),
NE);
1461 __ LoadSImmediate(
S5, 3.0);
1464 __ mov(
R0, Operand(0),
NE);
1467 __ LoadSImmediate(
S5, 2.0);
1470 __ mov(
R0, Operand(0),
NE);
1473 __ LoadSImmediate(
S5, 1.0);
1476 __ mov(
R0, Operand(0),
NE);
1483 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1488 __ LoadDImmediate(
D1, 1.0,
R0);
1489 __ LoadDImmediate(
D2, 2.0,
R0);
1490 __ LoadDImmediate(
D3, 3.0,
R0);
1491 __ LoadDImmediate(
D4, 4.0,
R0);
1493 __ LoadDImmediate(
D1, 0.0,
R0);
1494 __ LoadDImmediate(
D2, 0.0,
R0);
1495 __ LoadDImmediate(
D3, 0.0,
R0);
1496 __ LoadDImmediate(
D4, 0.0,
R0);
1500 __ mov(
R0, Operand(42));
1503 __ LoadDImmediate(
D5, 4.0,
R1);
1506 __ mov(
R0, Operand(0),
NE);
1509 __ LoadDImmediate(
D5, 3.0,
R1);
1512 __ mov(
R0, Operand(0),
NE);
1515 __ LoadDImmediate(
D5, 2.0,
R1);
1518 __ mov(
R0, Operand(0),
NE);
1521 __ LoadDImmediate(
D5, 1.0,
R1);
1524 __ mov(
R0, Operand(0),
NE);
1531 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1536 __ LoadSImmediate(
S1, 1.0);
1537 __ LoadSImmediate(
S2, 2.0);
1538 __ LoadSImmediate(
S3, 3.0);
1539 __ LoadSImmediate(
S4, 4.0);
1541 __ LoadSImmediate(
S1, 0.0);
1542 __ LoadSImmediate(
S2, 0.0);
1543 __ LoadSImmediate(
S3, 0.0);
1544 __ LoadSImmediate(
S4, 0.0);
1548 __ mov(
R0, Operand(42));
1551 __ LoadSImmediate(
S5, 4.0);
1554 __ mov(
R0, Operand(0),
NE);
1557 __ LoadSImmediate(
S5, 3.0);
1560 __ mov(
R0, Operand(0),
NE);
1563 __ LoadSImmediate(
S5, 2.0);
1566 __ mov(
R0, Operand(0),
NE);
1569 __ LoadSImmediate(
S5, 1.0);
1572 __ mov(
R0, Operand(0),
NE);
1579 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1587 __ LoadDImmediate(
D0, 0.0,
R0);
1588 __ LoadDImmediate(
D1, 1.0,
R0);
1589 __ LoadDImmediate(
D2, 2.0,
R0);
1590 __ LoadDImmediate(
D3, 3.0,
R0);
1591 __ LoadDImmediate(
D4, 4.0,
R0);
1592 __ LoadDImmediate(
D5, 5.0,
R0);
1597 __ mov(
R0, Operand(42));
1600 __ LoadDImmediate(
D10, 4.0,
R1);
1603 __ mov(
R0, Operand(0),
NE);
1606 __ LoadDImmediate(
D10, 3.0,
R1);
1609 __ mov(
R0, Operand(0),
NE);
1612 __ LoadDImmediate(
D10, 2.0,
R1);
1615 __ mov(
R0, Operand(0),
NE);
1618 __ LoadDImmediate(
D10, 1.0,
R1);
1621 __ mov(
R0, Operand(0),
NE);
1624 __ LoadDImmediate(
D10, 0.0,
R1);
1627 __ mov(
R0, Operand(0),
NE);
1637 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1642 __ LoadSImmediate(
S0, 0.0);
1643 __ LoadSImmediate(
S1, 1.0);
1644 __ LoadSImmediate(
S2, 2.0);
1645 __ LoadSImmediate(
S3, 3.0);
1646 __ LoadSImmediate(
S4, 4.0);
1647 __ LoadSImmediate(
S5, 5.0);
1652 __ mov(
R0, Operand(42));
1655 __ LoadSImmediate(
S10, 4.0);
1658 __ mov(
R0, Operand(0),
NE);
1661 __ LoadSImmediate(
S10, 3.0);
1664 __ mov(
R0, Operand(0),
NE);
1667 __ LoadSImmediate(
S10, 2.0);
1670 __ mov(
R0, Operand(0),
NE);
1673 __ LoadSImmediate(
S10, 1.0);
1676 __ mov(
R0, Operand(0),
NE);
1679 __ LoadSImmediate(
S10, 0.0);
1682 __ mov(
R0, Operand(0),
NE);
1689 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1694static constexpr uint32_t kBfxTestBits = 0b00010000001000001000010001001011;
1696static int32_t ExpectedUbfxBitPattern(uint8_t lsb, uint8_t
width) {
1704static int32_t ExpectedSbfxBitPattern(uint8_t lsb, uint8_t
width) {
1705 const uint32_t no_extension = ExpectedUbfxBitPattern(lsb,
width);
1706 const uint32_t sign_extension =
1708 return no_extension | sign_extension;
1712#define BFX_TEST_CASES(V) \
1715 V(0, 11, true) V(0, 19, false) V(3, 20, false) V(10, 19, true) V(31, 1, false)
1717#define GENERATE_BFX_TEST(L, W, S) \
1718 ASSEMBLER_TEST_GENERATE(UbfxLSB##L##Width##W, assembler) { \
1719 __ LoadImmediate(R1, kBfxTestBits); \
1720 __ ubfx(R0, R1, L, W); \
1723 ASSEMBLER_TEST_RUN(UbfxLSB##L##Width##W, test) { \
1724 EXPECT(test != nullptr); \
1725 typedef int (*Tst)() DART_UNUSED; \
1726 ASSERT((ExpectedUbfxBitPattern(L, W) == ExpectedSbfxBitPattern(L, W)) != \
1728 EXPECT_EQ(ExpectedUbfxBitPattern(L, W), \
1729 EXECUTE_TEST_CODE_INT32(Tst, test->entry())); \
1731 ASSEMBLER_TEST_GENERATE(SbfxLSB##L##Width##W, assembler) { \
1732 __ LoadImmediate(R1, kBfxTestBits); \
1733 __ sbfx(R0, R1, L, W); \
1736 ASSEMBLER_TEST_RUN(SbfxLSB##L##Width##W, test) { \
1737 EXPECT(test != nullptr); \
1738 typedef int (*Tst)() DART_UNUSED; \
1739 ASSERT((ExpectedUbfxBitPattern(L, W) == ExpectedSbfxBitPattern(L, W)) != \
1741 EXPECT_EQ(ExpectedSbfxBitPattern(L, W), \
1742 EXECUTE_TEST_CODE_INT32(Tst, test->entry())); \
1745BFX_TEST_CASES(GENERATE_BFX_TEST)
1747#undef GENERATE_BFX_TEST
1748#undef BFX_TEST_CASES
1752 __ mov(
R0, Operand(27));
1753 __ mov(
R1, Operand(9));
1764 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1766 "e3a0001b mov r0, #27\n"
1767 "e3a01009 mov r1, #9\n"
1768 "e732f110 udiv r2, r0, r1\n"
1769 "e1a00002 mov r0, r2\n"
1770 "e12fff1e bx lr\n");
1776 __ mov(
R0, Operand(27));
1777 __ LoadImmediate(
R1, -9);
1788 EXPECT_EQ(-3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1790 "e3a0001b mov r0, #27\n"
1791 "e3e01008 mvn r1, #8\n"
1792 "e712f110 sdiv r2, r0, r1\n"
1793 "e1a00002 mov r0, r2\n"
1794 "e12fff1e bx lr\n");
1800 __ mov(
R0, Operand(27));
1801 __ mov(
R1, Operand(0));
1812 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1818 __ mov(
R0, Operand(27));
1819 __ mov(
R1, Operand(0));
1830 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1836 __ LoadImmediate(
R0, 0x80000000);
1837 __ LoadImmediate(
R1, 0xffffffff);
1848 EXPECT_EQ(0, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1854 __ LoadImmediate(
R0, 0x80000000);
1855 __ LoadImmediate(
R1, 0xffffffff);
1866 EXPECT_EQ(
static_cast<int32_t
>(0x80000000),
1867 EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1872#if defined(USING_SIMULATOR)
1875 __ mov(
R0, Operand(27));
1876 __ mov(
R1, Operand(9));
1881 __ mov(
R0, Operand(27));
1882 __ mov(
R1, Operand(9));
1890#if defined(USING_SIMULATOR)
1894 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1898 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1903#if defined(USING_SIMULATOR)
1906 __ mov(
R0, Operand(27));
1907 __ mov(
R1, Operand(9));
1912 __ mov(
R0, Operand(27));
1913 __ mov(
R1, Operand(9));
1921#if defined(USING_SIMULATOR)
1925 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1929 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1934 __ mov(
R0, Operand(3));
1935 __ LoadImmediate(
R1, -9);
1937 __ mov(
R0, Operand(42),
MI);
1944 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1949 __ mov(
R0, Operand(1));
1951 __ mov(
R0, Operand(2));
1953 __ mov(
R0, Operand(3));
1955 __ mov(
R0, Operand(4));
1957 __ mov(
R0, Operand(5));
1959 __ mov(
R0, Operand(6));
1961 __ mov(
R0, Operand(7));
1963 __ mov(
R0, Operand(8));
1984 EXPECT_EQ(36, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
1990 __ mov(
R0, Operand(1));
1992 __ mov(
R0, Operand(2));
1994 __ mov(
R0, Operand(3));
1996 __ mov(
R0, Operand(4));
1998 __ mov(
R0, Operand(5));
2000 __ mov(
R0, Operand(6));
2002 __ mov(
R0, Operand(7));
2004 __ mov(
R0, Operand(8));
2025 EXPECT_EQ(36, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2031 __ mov(
R0, Operand(1));
2033 __ mov(
R0, Operand(2));
2035 __ mov(
R0, Operand(3));
2037 __ mov(
R0, Operand(4));
2039 __ mov(
R0, Operand(5));
2041 __ mov(
R0, Operand(6));
2043 __ mov(
R0, Operand(7));
2045 __ mov(
R0, Operand(8));
2066 EXPECT_EQ(36, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2072 __ mov(
R0, Operand(1));
2074 __ mov(
R0, Operand(2));
2076 __ mov(
R0, Operand(3));
2078 __ mov(
R0, Operand(4));
2095 EXPECT_EQ(10, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2102 __ LoadImmediate(
R1, 21);
2103 __ LoadImmediate(
R0, 1);
2113 __ CompareImmediate(
R0, 42);
2114 __ LoadImmediate(
R0, 0);
2116 __ CompareImmediate(
R1, 42);
2117 __ LoadImmediate(
R0, 0);
2120 __ LoadImmediate(
R0, 1);
2130 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2137 __ LoadImmediate(
R1, -84);
2138 __ LoadImmediate(
R0, -1);
2148 __ CompareImmediate(
R0, -42);
2149 __ LoadImmediate(
R0, 0);
2151 __ CompareImmediate(
R1, -42);
2152 __ LoadImmediate(
R0, 0);
2155 __ LoadImmediate(
R0, 1);
2165 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2184 __ veorq(temp, temp, temp);
2186 __ LoadImmediate(shift, 32);
2187 __ LoadImmediate(
R2, 1 << 7);
2190 __ vmovsr(stemp0, shift);
2194 __ rsb(shift, shift, Operand(0));
2195 __ vmovsr(stemp0, shift);
2200 __ vmovrs(shift, sout0);
2201 __ CompareImmediate(shift, -1);
2203 __ vmovrs(shift, sout1);
2204 __ CompareImmediate(shift, -1);
2207 __ LoadImmediate(
R0, 1);
2211 __ LoadImmediate(
R0, 0);
2220 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2239 __ veorq(temp, temp, temp);
2241 __ LoadImmediate(shift, 60);
2242 __ LoadImmediate(
R2, 1 << 7);
2245 __ vmovsr(stemp0, shift);
2249 __ rsb(shift, shift, Operand(0));
2250 __ vmovsr(stemp0, shift);
2255 __ vmovrs(shift, sout0);
2256 __ CompareImmediate(shift, -1);
2258 __ vmovrs(shift, sout1);
2259 __ CompareImmediate(shift, -1);
2262 __ LoadImmediate(
R0, 0);
2266 __ LoadImmediate(
R0, 1);
2275 EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2281 __ mov(
R0, Operand(1));
2283 __ mov(
R0, Operand(2));
2285 __ mov(
R0, Operand(3));
2287 __ mov(
R0, Operand(4));
2289 __ mov(
R0, Operand(2));
2291 __ mov(
R0, Operand(4));
2293 __ mov(
R0, Operand(6));
2295 __ mov(
R0, Operand(8));
2316 EXPECT_EQ(10, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2322 __ mov(
R0, Operand(1));
2324 __ mov(
R0, Operand(2));
2326 __ mov(
R0, Operand(3));
2328 __ mov(
R0, Operand(4));
2330 __ mov(
R0, Operand(2));
2332 __ mov(
R0, Operand(4));
2334 __ mov(
R0, Operand(6));
2336 __ mov(
R0, Operand(8));
2357 EXPECT_EQ(10, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2363 __ mov(
R0, Operand(1));
2365 __ mov(
R0, Operand(2));
2367 __ mov(
R0, Operand(3));
2369 __ mov(
R0, Operand(4));
2371 __ mov(
R0, Operand(2));
2373 __ mov(
R0, Operand(4));
2375 __ mov(
R0, Operand(6));
2377 __ mov(
R0, Operand(8));
2398 EXPECT_EQ(10, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2404 __ mov(
R0, Operand(1));
2406 __ mov(
R0, Operand(2));
2408 __ mov(
R0, Operand(2));
2410 __ mov(
R0, Operand(4));
2427 EXPECT_EQ(3, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2433 __ mov(
R0, Operand(1));
2435 __ mov(
R0, Operand(2));
2437 __ mov(
R0, Operand(3));
2439 __ mov(
R0, Operand(4));
2441 __ mov(
R0, Operand(5));
2443 __ mov(
R0, Operand(6));
2445 __ mov(
R0, Operand(7));
2447 __ mov(
R0, Operand(8));
2468 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2474 __ mov(
R0, Operand(1));
2476 __ mov(
R0, Operand(2));
2478 __ mov(
R0, Operand(3));
2480 __ mov(
R0, Operand(4));
2482 __ mov(
R0, Operand(5));
2484 __ mov(
R0, Operand(6));
2486 __ mov(
R0, Operand(7));
2488 __ mov(
R0, Operand(8));
2509 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2515 __ mov(
R0, Operand(1));
2517 __ mov(
R0, Operand(2));
2519 __ mov(
R0, Operand(3));
2521 __ mov(
R0, Operand(4));
2523 __ mov(
R0, Operand(5));
2525 __ mov(
R0, Operand(6));
2527 __ mov(
R0, Operand(7));
2529 __ mov(
R0, Operand(8));
2550 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2556 __ LoadSImmediate(
S0, 1.0);
2557 __ LoadSImmediate(
S1, 2.0);
2558 __ LoadSImmediate(
S2, 3.0);
2559 __ LoadSImmediate(
S3, 4.0);
2560 __ LoadSImmediate(
S4, 5.0);
2561 __ LoadSImmediate(
S5, 6.0);
2562 __ LoadSImmediate(
S6, 7.0);
2563 __ LoadSImmediate(
S7, 8.0);
2581 EXPECT_EQ(36, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2587 __ LoadSImmediate(
S0, 1.0);
2588 __ LoadSImmediate(
S1, 2.0);
2589 __ LoadSImmediate(
S2, 3.0);
2590 __ LoadSImmediate(
S3, 4.0);
2591 __ LoadSImmediate(
S4, 2.0);
2592 __ LoadSImmediate(
S5, 4.0);
2593 __ LoadSImmediate(
S6, 6.0);
2594 __ LoadSImmediate(
S7, 8.0);
2612 EXPECT_EQ(10, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2618 __ LoadSImmediate(
S0, 1.0);
2619 __ LoadSImmediate(
S1, 2.0);
2620 __ LoadSImmediate(
S2, 3.0);
2621 __ LoadSImmediate(
S3, 4.0);
2622 __ LoadSImmediate(
S4, 5.0);
2623 __ LoadSImmediate(
S5, 6.0);
2624 __ LoadSImmediate(
S6, 7.0);
2625 __ LoadSImmediate(
S7, 8.0);
2643 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2650 __ LoadImmediate(
R0, 0x03020100);
2655 __ LoadSImmediate(
S2, 1.0);
2656 __ LoadSImmediate(
S3, 2.0);
2657 __ LoadSImmediate(
S4, 3.0);
2658 __ LoadSImmediate(
S5, 4.0);
2669 __ LoadImmediate(
R0, 0);
2670 __ CompareImmediate(
R2, 1);
2672 __ CompareImmediate(
R3, 1);
2674 __ LoadImmediate(
R0, 42);
2683 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2690 __ LoadImmediate(
R0, 0x07060504);
2695 __ LoadSImmediate(
S2, 2.0);
2696 __ LoadSImmediate(
S3, 1.0);
2697 __ LoadSImmediate(
S4, 3.0);
2698 __ LoadSImmediate(
S5, 4.0);
2709 __ LoadImmediate(
R0, 0);
2710 __ CompareImmediate(
R2, 1);
2712 __ CompareImmediate(
R3, 1);
2714 __ LoadImmediate(
R0, 42);
2723 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2730 __ LoadImmediate(
R0, 0x0b0a0908);
2735 __ LoadSImmediate(
S2, 2.0);
2736 __ LoadSImmediate(
S3, 3.0);
2737 __ LoadSImmediate(
S4, 1.0);
2738 __ LoadSImmediate(
S5, 4.0);
2749 __ LoadImmediate(
R0, 0);
2750 __ CompareImmediate(
R2, 1);
2752 __ CompareImmediate(
R3, 1);
2754 __ LoadImmediate(
R0, 42);
2763 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2770 __ LoadImmediate(
R0, 0x0f0e0d0c);
2775 __ LoadSImmediate(
S2, 2.0);
2776 __ LoadSImmediate(
S3, 3.0);
2777 __ LoadSImmediate(
S4, 4.0);
2778 __ LoadSImmediate(
S5, 1.0);
2789 __ LoadImmediate(
R0, 0);
2790 __ CompareImmediate(
R2, 1);
2792 __ CompareImmediate(
R3, 1);
2794 __ LoadImmediate(
R0, 42);
2803 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2810 __ LoadImmediate(
R0, 0xaaaaaaab);
2817 __ LoadImmediate(
R0, 0x55555555);
2842 EXPECT_EQ(-8, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2849 __ LoadImmediate(
R0, 0xfffffff0);
2856 __ LoadImmediate(
R0, 0);
2881 EXPECT_EQ(60, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2888 __ LoadImmediate(
R0, 0xaaaaaaaa);
2895 __ LoadImmediate(
R0, 0x55555555);
2920 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2927 __ LoadImmediate(
R0, 0xaaaaaaab);
2934 __ LoadImmediate(
R0, 0x55555555);
2959 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2966 __ LoadSImmediate(
S0, 1.0);
2972 __ LoadSImmediate(
S4, -1.0);
2993 EXPECT_EQ(4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
2999 __ LoadImmediate(
R1, 42);
3012 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3018 __ LoadImmediate(
R0, 0x00000000);
3019 __ LoadImmediate(
R1, 0x00ff0000);
3042 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3048 __ LoadImmediate(
R0, 0xffff0000);
3049 __ LoadImmediate(
R1, 0x00000000);
3072 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3078 __ LoadImmediate(
R0, 0x00000000);
3079 __ LoadImmediate(
R1, 0xffffffff);
3102 EXPECT_EQ(-4, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3108 __ LoadSImmediate(
S0, 0.0);
3109 __ LoadSImmediate(
S1, 1.0);
3110 __ LoadSImmediate(
S2, 2.0);
3111 __ LoadSImmediate(
S3, 3.0);
3112 __ LoadSImmediate(
S4, 4.0);
3113 __ LoadSImmediate(
S5, 5.0);
3114 __ LoadSImmediate(
S6, 6.0);
3115 __ LoadSImmediate(
S7, 7.0);
3132 float res = EXECUTE_TEST_CODE_FLOAT(Vzipqw,
test->entry());
3133 EXPECT_FLOAT_EQ(8.0, res, 0.0001f);
3139 __ mov(
R0, Operand(1));
3141 __ mov(
R0, Operand(2));
3143 __ mov(
R0, Operand(3));
3145 __ mov(
R0, Operand(4));
3147 __ mov(
R0, Operand(1));
3149 __ mov(
R0, Operand(20));
3151 __ mov(
R0, Operand(3));
3153 __ mov(
R0, Operand(40));
3174 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3180 __ LoadSImmediate(
S0, 1.0);
3181 __ LoadSImmediate(
S1, 2.0);
3182 __ LoadSImmediate(
S2, 3.0);
3183 __ LoadSImmediate(
S3, 4.0);
3184 __ LoadSImmediate(
S4, 1.0);
3185 __ LoadSImmediate(
S5, 4.0);
3186 __ LoadSImmediate(
S6, 3.0);
3187 __ LoadSImmediate(
S7, 8.0);
3207 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3213 __ mov(
R0, Operand(1));
3215 __ mov(
R0, Operand(2));
3217 __ mov(
R0, Operand(3));
3219 __ mov(
R0, Operand(4));
3221 __ mov(
R0, Operand(1));
3223 __ mov(
R0, Operand(1));
3225 __ mov(
R0, Operand(3));
3227 __ mov(
R0, Operand(1));
3248 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3254 __ mov(
R0, Operand(1));
3256 __ mov(
R0, Operand(2));
3258 __ mov(
R0, Operand(3));
3260 __ mov(
R0, Operand(4));
3262 __ LoadImmediate(
R0, -1);
3264 __ mov(
R0, Operand(1));
3266 __ LoadImmediate(
R0, -3);
3268 __ mov(
R0, Operand(1));
3289 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3295 __ LoadSImmediate(
S0, 1.0);
3296 __ LoadSImmediate(
S1, 2.0);
3297 __ LoadSImmediate(
S2, 3.0);
3298 __ LoadSImmediate(
S3, 4.0);
3299 __ LoadSImmediate(
S4, 1.0);
3300 __ LoadSImmediate(
S5, 1.0);
3301 __ LoadSImmediate(
S6, 3.0);
3302 __ LoadSImmediate(
S7, 1.0);
3322 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3328 __ mov(
R0, Operand(1));
3330 __ mov(
R0, Operand(2));
3332 __ mov(
R0, Operand(3));
3334 __ mov(
R0, Operand(4));
3336 __ mov(
R0, Operand(2));
3338 __ mov(
R0, Operand(1));
3340 __ mov(
R0, Operand(4));
3342 __ mov(
R0, Operand(1));
3363 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3369 __ mov(
R0, Operand(1));
3371 __ mov(
R0, Operand(2));
3373 __ mov(
R0, Operand(3));
3375 __ mov(
R0, Operand(4));
3377 __ LoadImmediate(
R0, -1);
3379 __ mov(
R0, Operand(1));
3381 __ LoadImmediate(
R0, -3);
3383 __ mov(
R0, Operand(1));
3404 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3410 __ LoadSImmediate(
S0, 1.0);
3411 __ LoadSImmediate(
S1, 2.0);
3412 __ LoadSImmediate(
S2, 3.0);
3413 __ LoadSImmediate(
S3, 4.0);
3414 __ LoadSImmediate(
S4, 2.0);
3415 __ LoadSImmediate(
S5, 1.0);
3416 __ LoadSImmediate(
S6, 4.0);
3417 __ LoadSImmediate(
S7, 1.0);
3437 EXPECT_EQ(-2, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3455 float res = EXECUTE_TEST_CODE_FLOAT(Tst,
test->entry());
3456 EXPECT_EQ(
true, signbit(res) && (res == 0.0));
3462 __ LoadSImmediate(
S0, 1.0);
3463 __ LoadSImmediate(
S1, 2.0);
3464 __ LoadSImmediate(
S2, 3.0);
3465 __ LoadSImmediate(
S3, 4.0);
3467 __ LoadSImmediate(
S4, 2.0);
3468 __ LoadSImmediate(
S5, 1.0);
3469 __ LoadSImmediate(
S6, 6.0);
3470 __ LoadSImmediate(
S7, 3.0);
3488 EXPECT_EQ(8, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3506 float res = EXECUTE_TEST_CODE_FLOAT(Tst,
test->entry());
3507 EXPECT_EQ(
true, !signbit(res) && (res == 0.0));
3513 __ LoadSImmediate(
S0, 1.0);
3514 __ LoadSImmediate(
S1, 2.0);
3515 __ LoadSImmediate(
S2, 3.0);
3516 __ LoadSImmediate(
S3, 4.0);
3518 __ LoadSImmediate(
S4, 2.0);
3519 __ LoadSImmediate(
S5, 1.0);
3520 __ LoadSImmediate(
S6, 6.0);
3521 __ LoadSImmediate(
S7, 3.0);
3539 EXPECT_EQ(14, EXECUTE_TEST_CODE_INT32(Tst,
test->entry()));
3545 __ LoadSImmediate(
S4, 147.0);
3558 float res = EXECUTE_TEST_CODE_FLOAT(Vrecpeqs,
test->entry());
3565 __ LoadSImmediate(
S4, 5.0);
3566 __ LoadSImmediate(
S5, 2.0);
3567 __ LoadSImmediate(
S6, 3.0);
3568 __ LoadSImmediate(
S7, 4.0);
3570 __ LoadSImmediate(
S8, 10.0);
3571 __ LoadSImmediate(
S9, 1.0);
3572 __ LoadSImmediate(
S10, 6.0);
3573 __ LoadSImmediate(
S11, 3.0);
3584 float res = EXECUTE_TEST_CODE_FLOAT(Vrecpsqs,
test->entry());
3585 EXPECT_FLOAT_EQ(2.0 - 10.0 * 5.0, res, 0.0001f);
3591 __ LoadSImmediate(
S4, 147000.0);
3611 float res = EXECUTE_TEST_CODE_FLOAT(Reciprocal,
test->entry());
3612 EXPECT_FLOAT_EQ(1.0 / 147000.0, res, 0.0001f);
3618 __ LoadSImmediate(
S4, 147.0);
3632 float res = EXECUTE_TEST_CODE_FLOAT(Vrsqrteqs,
test->entry());
3639 __ LoadSImmediate(
S4, 5.0);
3640 __ LoadSImmediate(
S5, 2.0);
3641 __ LoadSImmediate(
S6, 3.0);
3642 __ LoadSImmediate(
S7, 4.0);
3644 __ LoadSImmediate(
S8, 10.0);
3645 __ LoadSImmediate(
S9, 1.0);
3646 __ LoadSImmediate(
S10, 6.0);
3647 __ LoadSImmediate(
S11, 3.0);
3658 float res = EXECUTE_TEST_CODE_FLOAT(Vrsqrtsqs,
test->entry());
3659 EXPECT_FLOAT_EQ((3.0 - 10.0 * 5.0) / 2.0, res, 0.0001f);
3665 __ LoadSImmediate(
S4, 147000.0);
3689 float res = EXECUTE_TEST_CODE_FLOAT(ReciprocalSqrt,
test->entry());
3690 EXPECT_FLOAT_EQ(1.0 /
sqrt(147000.0), res, 0.0001f);
3696 __ LoadSImmediate(
S4, 147000.0);
3730 float res = EXECUTE_TEST_CODE_FLOAT(SIMDSqrt,
test->entry());
3731 EXPECT_FLOAT_EQ(
sqrt(147000.0), res, 0.0001f);
3737 __ LoadSImmediate(
S4, 1.0);
3738 __ LoadSImmediate(
S5, 4.0);
3739 __ LoadSImmediate(
S6, 9.0);
3740 __ LoadSImmediate(
S7, 16.0);
3775 float res = EXECUTE_TEST_CODE_FLOAT(SIMDSqrt2,
test->entry());
3776 EXPECT_FLOAT_EQ(10.0, res, 0.0001f);
3782 __ LoadSImmediate(
S4, 1.0);
3783 __ LoadSImmediate(
S5, 4.0);
3784 __ LoadSImmediate(
S6, 9.0);
3785 __ LoadSImmediate(
S7, 16.0);
3787 __ LoadSImmediate(
S12, 4.0);
3788 __ LoadSImmediate(
S13, 16.0);
3789 __ LoadSImmediate(
S14, 36.0);
3790 __ LoadSImmediate(
S15, 64.0);
3812 float res = EXECUTE_TEST_CODE_FLOAT(SIMDDiv,
test->entry());
3813 EXPECT_FLOAT_EQ(16.0, res, 0.0001f);
3819 __ LoadSImmediate(
S4, 1.0);
3820 __ LoadSImmediate(
S5, -1.0);
3821 __ LoadSImmediate(
S6, 1.0);
3822 __ LoadSImmediate(
S7, -1.0);
3837 float res = EXECUTE_TEST_CODE_FLOAT(Vabsqs,
test->entry());
3838 EXPECT_FLOAT_EQ(4.0, res, 0.0001f);
3844 __ LoadSImmediate(
S4, 1.0);
3845 __ LoadSImmediate(
S5, -2.0);
3846 __ LoadSImmediate(
S6, 1.0);
3847 __ LoadSImmediate(
S7, -2.0);
3862 float res = EXECUTE_TEST_CODE_FLOAT(Vnegqs,
test->entry());
3863 EXPECT_FLOAT_EQ(2.0, res, 0.0001f);
3873 SPILLS_LR_TO_FRAME(
__ PushList((1 <<
LR) | (1 <<
THR)));
3877 RESTORES_LR_FROM_FRAME(
__ PopList((1 <<
LR) | (1 <<
THR)));
3886 __ LoadImmediate(return_reg, Immediate(0));
3889 __ LoadImmediate(return_reg, Immediate(1));
3896 RangeCheck(assembler,
value, temp);
3901 result =
test->Invoke<intptr_t, intptr_t>(kErrorCid);
3903 result =
test->Invoke<intptr_t, intptr_t>(kUnwindErrorCid);
3905 result =
test->Invoke<intptr_t, intptr_t>(kFunctionCid);
3907 result =
test->Invoke<intptr_t, intptr_t>(kMintCid);
3914 RangeCheck(assembler,
value, temp);
3919 result =
test->Invoke<intptr_t, intptr_t>(kErrorCid);
3921 result =
test->Invoke<intptr_t, intptr_t>(kUnwindErrorCid);
3923 result =
test->Invoke<intptr_t, intptr_t>(kFunctionCid);
3925 result =
test->Invoke<intptr_t, intptr_t>(kMintCid);
3937 __ mov(return_reg, Operand(
value));
3943 result =
test->Invoke<intptr_t, intptr_t>(kErrorCid);
3944 EXPECT_EQ(kErrorCid,
result);
3945 result =
test->Invoke<intptr_t, intptr_t>(kUnwindErrorCid);
3946 EXPECT_EQ(kUnwindErrorCid,
result);
3947 result =
test->Invoke<intptr_t, intptr_t>(kFunctionCid);
3948 EXPECT_EQ(kFunctionCid,
result);
3949 result =
test->Invoke<intptr_t, intptr_t>(kMintCid);
3950 EXPECT_EQ(kMintCid,
result);
3957 __ LoadPoolPointer(
PP);
3967 const auto& do_nothing_just_return =
3971 SPILLS_LR_TO_FRAME({
__ PushRegister(
LR); });
3973 const RegisterSet clobbered_regs(
3976 __ PushRegisters(clobbered_regs);
3980 const auto check_all_allocatable_registers_are_preserved_by_call = [&]() {
3982 __ LoadImmediate(reg,
static_cast<int32_t
>(reg));
3984 __ BranchLink(do_nothing_just_return);
3987 if (!FLAG_precompiled_mode && reg ==
CODE_REG)
continue;
3989 __ CompareImmediate(reg,
static_cast<int32_t
>(reg));
3990 __ LoadImmediate(
R0, reg,
NE);
3995 check_all_allocatable_registers_are_preserved_by_call();
3997 FLAG_precompiled_mode =
true;
3998 check_all_allocatable_registers_are_preserved_by_call();
3999 FLAG_precompiled_mode =
false;
4001 __ LoadImmediate(
R0, 42);
4003 __ PopRegisters(clobbered_regs);
4004 RESTORES_LR_FROM_FRAME({
__ PopRegister(
LR); });
4010 const intptr_t
result =
test->InvokeWithCodeAndThread<int64_t>();
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static void fail(const SkString &err)
static bool skip(SkStream *stream, size_t amount)
static const Code & Generate(const char *name, const std::function< void(compiler::Assembler *assembler)> &generator)
static const Register ArgumentRegisters[]
static constexpr Register kReturnReg
static intptr_t data_offset()
static void set_integer_division_supported(bool supported)
static bool neon_supported()
static bool integer_division_supported()
static int32_t Low32Bits(int64_t value)
static constexpr T NBitMask(size_t n)
static int32_t High32Bits(int64_t value)
static constexpr bool TestBit(T mask, size_t position)
static bool CanHold(uint32_t immediate, Operand *o)
const uint8_t uint32_t uint32_t GError ** error
static constexpr intptr_t kWordSize
void LeaveTestFrame(Assembler *assembler)
ASSEMBLER_TEST_GENERATE(InstantiateTypeArgumentsHashKeys, assembler)
void EnterTestFrame(Assembler *assembler)
float ReciprocalSqrtEstimate(float op)
static DRegister EvenDRegisterOf(QRegister q)
static Utils::BitsRange< Register > RegisterRange(uint32_t regs)
float ReciprocalStep(float op1, float op2)
static const ClassId kLastErrorCid
static const ClassId kFirstErrorCid
static SRegister OddSRegisterOf(DRegister d)
constexpr RegList kDartAvailableCpuRegs
ASSEMBLER_TEST_RUN(StoreIntoObject, test)
TEST_CASE(DirectoryCurrent)
float ReciprocalSqrtStep(float op1, float op2)
float ReciprocalEstimate(float op)
static SRegister EvenSRegisterOf(DRegister d)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static bool Bind(PassBindingsCacheMTL &pass, ShaderStage stage, size_t bind_index, const BufferView &view)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)