| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 __ mul(R0, R1, R2); | 1057 __ mul(R0, R1, R2); |
| 1058 __ ret(); | 1058 __ ret(); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 ASSEMBLER_TEST_RUN(Mult_neg, test) { | 1062 ASSEMBLER_TEST_RUN(Mult_neg, test) { |
| 1063 typedef int (*SimpleCode)(); | 1063 typedef int (*SimpleCode)(); |
| 1064 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); | 1064 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 |
| 1068 // Loading immediate values without the object pool. |
| 1069 ASSEMBLER_TEST_GENERATE(LoadImmediateSmall, assembler) { |
| 1070 __ LoadImmediate(R0, 42, kNoRegister); |
| 1071 __ ret(); |
| 1072 } |
| 1073 |
| 1074 |
| 1075 ASSEMBLER_TEST_RUN(LoadImmediateSmall, test) { |
| 1076 typedef int (*SimpleCode)(); |
| 1077 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1078 } |
| 1079 |
| 1080 |
| 1081 ASSEMBLER_TEST_GENERATE(LoadImmediateMed, assembler) { |
| 1082 __ LoadImmediate(R0, 0xf1234123, kNoRegister); |
| 1083 __ ret(); |
| 1084 } |
| 1085 |
| 1086 |
| 1087 ASSEMBLER_TEST_RUN(LoadImmediateMed, test) { |
| 1088 typedef int (*SimpleCode)(); |
| 1089 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1090 } |
| 1091 |
| 1092 |
| 1093 ASSEMBLER_TEST_GENERATE(LoadImmediateMed2, assembler) { |
| 1094 __ LoadImmediate(R0, 0x4321f1234123, kNoRegister); |
| 1095 __ ret(); |
| 1096 } |
| 1097 |
| 1098 |
| 1099 ASSEMBLER_TEST_RUN(LoadImmediateMed2, test) { |
| 1100 typedef int (*SimpleCode)(); |
| 1101 EXPECT_EQ(0x4321f1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1102 } |
| 1103 |
| 1104 |
| 1105 ASSEMBLER_TEST_GENERATE(LoadImmediateLarge, assembler) { |
| 1106 __ LoadImmediate(R0, 0x9287436598237465, kNoRegister); |
| 1107 __ ret(); |
| 1108 } |
| 1109 |
| 1110 |
| 1111 ASSEMBLER_TEST_RUN(LoadImmediateLarge, test) { |
| 1112 typedef int (*SimpleCode)(); |
| 1113 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), |
| 1114 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1115 } |
| 1116 |
| 1117 |
| 1118 ASSEMBLER_TEST_GENERATE(LoadImmediateSmallNeg, assembler) { |
| 1119 __ LoadImmediate(R0, -42, kNoRegister); |
| 1120 __ ret(); |
| 1121 } |
| 1122 |
| 1123 |
| 1124 ASSEMBLER_TEST_RUN(LoadImmediateSmallNeg, test) { |
| 1125 typedef int (*SimpleCode)(); |
| 1126 EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1127 } |
| 1128 |
| 1129 |
| 1130 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg, assembler) { |
| 1131 __ LoadImmediate(R0, -0x1212341234, kNoRegister); |
| 1132 __ ret(); |
| 1133 } |
| 1134 |
| 1135 |
| 1136 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg, test) { |
| 1137 typedef int (*SimpleCode)(); |
| 1138 EXPECT_EQ(-0x1212341234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1139 } |
| 1140 |
| 1141 |
| 1142 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg2, assembler) { |
| 1143 __ LoadImmediate(R0, -0x1212340000, kNoRegister); |
| 1144 __ ret(); |
| 1145 } |
| 1146 |
| 1147 |
| 1148 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg2, test) { |
| 1149 typedef int (*SimpleCode)(); |
| 1150 EXPECT_EQ(-0x1212340000, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1151 } |
| 1152 |
| 1153 |
| 1154 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg3, assembler) { |
| 1155 __ LoadImmediate(R0, -0x1200001234, kNoRegister); |
| 1156 __ ret(); |
| 1157 } |
| 1158 |
| 1159 |
| 1160 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg3, test) { |
| 1161 typedef int (*SimpleCode)(); |
| 1162 EXPECT_EQ(-0x1200001234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1163 } |
| 1164 |
| 1165 |
| 1166 ASSEMBLER_TEST_GENERATE(LoadImmediateMedNeg4, assembler) { |
| 1167 __ LoadImmediate(R0, -0x12341234, kNoRegister); |
| 1168 __ ret(); |
| 1169 } |
| 1170 |
| 1171 |
| 1172 ASSEMBLER_TEST_RUN(LoadImmediateMedNeg4, test) { |
| 1173 typedef int (*SimpleCode)(); |
| 1174 EXPECT_EQ(-0x12341234, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1175 } |
| 1176 |
| 1177 |
| 1178 // Loading immediate values with the object pool. |
| 1179 ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) { |
| 1180 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1181 __ LoadPoolPointer(PP); |
| 1182 __ LoadImmediate(R0, 42, PP); |
| 1183 __ Pop(PP); |
| 1184 __ ret(); |
| 1185 } |
| 1186 |
| 1187 |
| 1188 ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) { |
| 1189 typedef int (*SimpleCode)(); |
| 1190 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1191 } |
| 1192 |
| 1193 |
| 1194 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) { |
| 1195 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1196 __ LoadPoolPointer(PP); |
| 1197 __ LoadImmediate(R0, 0xf1234123, PP); |
| 1198 __ Pop(PP); |
| 1199 __ ret(); |
| 1200 } |
| 1201 |
| 1202 |
| 1203 ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) { |
| 1204 typedef int (*SimpleCode)(); |
| 1205 EXPECT_EQ(0xf1234123, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1206 } |
| 1207 |
| 1208 |
| 1209 ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) { |
| 1210 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1211 __ LoadPoolPointer(PP); |
| 1212 __ LoadImmediate(R0, 0x4321f1234124, PP); |
| 1213 __ Pop(PP); |
| 1214 __ ret(); |
| 1215 } |
| 1216 |
| 1217 |
| 1218 ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) { |
| 1219 typedef int (*SimpleCode)(); |
| 1220 EXPECT_EQ(0x4321f1234124, EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1221 } |
| 1222 |
| 1223 |
| 1224 ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) { |
| 1225 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1226 __ LoadPoolPointer(PP); |
| 1227 __ LoadImmediate(R0, 0x9287436598237465, PP); |
| 1228 __ Pop(PP); |
| 1229 __ ret(); |
| 1230 } |
| 1231 |
| 1232 |
| 1233 ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) { |
| 1234 typedef int (*SimpleCode)(); |
| 1235 EXPECT_EQ(static_cast<int64_t>(0x9287436598237465), |
| 1236 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1237 } |
| 1238 |
| 1239 |
| 1240 // LoadObject null. |
| 1241 ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) { |
| 1242 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1243 __ LoadPoolPointer(PP); |
| 1244 __ LoadObject(R0, Object::null_object(), PP); |
| 1245 __ Pop(PP); |
| 1246 __ ret(); |
| 1247 } |
| 1248 |
| 1249 |
| 1250 ASSEMBLER_TEST_RUN(LoadObjectNull, test) { |
| 1251 typedef int (*SimpleCode)(); |
| 1252 EXPECT_EQ(reinterpret_cast<int64_t>(Object::null()), |
| 1253 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1254 } |
| 1255 |
| 1256 |
| 1257 ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) { |
| 1258 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1259 __ LoadPoolPointer(PP); |
| 1260 __ LoadObject(R0, Bool::True(), PP); |
| 1261 __ Pop(PP); |
| 1262 __ ret(); |
| 1263 } |
| 1264 |
| 1265 |
| 1266 ASSEMBLER_TEST_RUN(LoadObjectTrue, test) { |
| 1267 typedef int (*SimpleCode)(); |
| 1268 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::True().raw()), |
| 1269 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1270 } |
| 1271 |
| 1272 |
| 1273 ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) { |
| 1274 __ Push(PP); // Save caller's pool pointer and load a new one here. |
| 1275 __ LoadPoolPointer(PP); |
| 1276 __ LoadObject(R0, Bool::False(), PP); |
| 1277 __ Pop(PP); |
| 1278 __ ret(); |
| 1279 } |
| 1280 |
| 1281 |
| 1282 ASSEMBLER_TEST_RUN(LoadObjectFalse, test) { |
| 1283 typedef int (*SimpleCode)(); |
| 1284 EXPECT_EQ(reinterpret_cast<int64_t>(Bool::False().raw()), |
| 1285 EXECUTE_TEST_CODE_INT64(SimpleCode, test->entry())); |
| 1286 } |
| 1287 |
| 1067 } // namespace dart | 1288 } // namespace dart |
| 1068 | 1289 |
| 1069 #endif // defined(TARGET_ARCH_ARM64) | 1290 #endif // defined(TARGET_ARCH_ARM64) |
| OLD | NEW |