Index: runtime/vm/assembler_dbc_test.cc |
diff --git a/runtime/vm/assembler_dbc_test.cc b/runtime/vm/assembler_dbc_test.cc |
index 180437ef89f1aaa57e84f812911c7c44cb6eda3a..0f99b4aa9081a7e6cca0c54a136900bb10ac79d2 100644 |
--- a/runtime/vm/assembler_dbc_test.cc |
+++ b/runtime/vm/assembler_dbc_test.cc |
@@ -1792,6 +1792,137 @@ ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { |
EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
} |
+// - If<Cond> rA, rD |
+// |
+// Cond is Le, Lt, Ge, Gt. Skips the next instruction unless |
+// FP[rA] <Cond> FP[rD]. Assumes that FP[rA] and FP[rD] are Smis. |
+ASSEMBLER_TEST_GENERATE(IfLeTrue, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
+ __ IfLe(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfLeTrue, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfLeFalse, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
+ __ IfLe(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfLeFalse, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfLtTrue, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
+ __ IfLt(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfLtTrue, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfLtFalse, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
+ __ IfLt(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfLtFalse, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfGeTrue, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
+ __ IfGe(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfGeTrue, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfGeFalse, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
+ __ IfGe(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfGeFalse, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfGtTrue, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(100))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(-5))); |
+ __ IfGt(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfGtTrue, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(IfGtFalse, assembler) { |
+ __ Frame(3); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(42))); |
+ __ LoadConstant(1, Smi::Handle(Smi::New(-5))); |
+ __ LoadConstant(2, Smi::Handle(Smi::New(100))); |
+ __ IfGt(1, 2); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(-1))); |
+ __ Return(0); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(IfGtFalse, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
} // namespace dart |
#endif // defined(TARGET_ARCH_DBC) |