Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: runtime/vm/assembler_arm_test.cc

Issue 12390039: Adds vstm, vldm to ARM simulator, assembler, disassembler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/constants_arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1033 }
1034 1034
1035 1035
1036 ASSEMBLER_TEST_RUN(AddressShiftLdrLSLNegPreIndex, test) { 1036 ASSEMBLER_TEST_RUN(AddressShiftLdrLSLNegPreIndex, test) {
1037 EXPECT(test != NULL); 1037 EXPECT(test != NULL);
1038 typedef int (*Tst)(); 1038 typedef int (*Tst)();
1039 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 1039 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1040 } 1040 }
1041 1041
1042 1042
1043 // Make sure we can store and reload the D registers using vstmd and vldmd
1044 ASSEMBLER_TEST_GENERATE(VstmdVldmd, assembler) {
1045 __ LoadDImmediate(D0, 0.0, R0);
1046 __ LoadDImmediate(D1, 1.0, R0);
1047 __ LoadDImmediate(D2, 2.0, R0);
1048 __ LoadDImmediate(D3, 3.0, R0);
1049 __ LoadDImmediate(D4, 4.0, R0);
1050 __ vstmd(DB_W, SP, D0, D4); // Push D0 - D4 onto the stack, dec SP
1051 __ LoadDImmediate(D0, 0.0, R0);
1052 __ LoadDImmediate(D1, 0.0, R0);
1053 __ LoadDImmediate(D2, 0.0, R0);
1054 __ LoadDImmediate(D3, 0.0, R0);
1055 __ LoadDImmediate(D4, 0.0, R0);
1056 __ vldmd(IA_W, SP, D0, D4); // Pop stack into D0 - D4, inc SP
1057
1058 // Load success value into R0
1059 __ mov(R0, ShifterOperand(42));
1060
1061 // Check that 4.0 is back in D4
1062 __ LoadDImmediate(D5, 4.0, R1);
1063 __ vcmpd(D4, D5);
1064 __ vmstat();
1065 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1066
1067 // Check that 3.0 is back in D3
1068 __ LoadDImmediate(D5, 3.0, R1);
1069 __ vcmpd(D3, D5);
1070 __ vmstat();
1071 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1072
1073
1074 // Check that 2.0 is back in D2
1075 __ LoadDImmediate(D5, 2.0, R1);
1076 __ vcmpd(D2, D5);
1077 __ vmstat();
1078 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1079
1080 // Check that 1.0 is back in D1
1081 __ LoadDImmediate(D5, 1.0, R1);
1082 __ vcmpd(D1, D5);
1083 __ vmstat();
1084 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1085
1086 __ mov(PC, ShifterOperand(LR));
1087 }
1088
1089
1090 ASSEMBLER_TEST_RUN(VstmdVldmd, test) {
1091 EXPECT(test != NULL);
1092 typedef int (*Tst)();
1093 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1094 }
1095
1096
1097 // Make sure we can store and reload the S registers using vstms and vldms
1098 ASSEMBLER_TEST_GENERATE(VstmsVldms, assembler) {
1099 __ LoadSImmediate(S0, 0.0);
1100 __ LoadSImmediate(S1, 1.0);
1101 __ LoadSImmediate(S2, 2.0);
1102 __ LoadSImmediate(S3, 3.0);
1103 __ LoadSImmediate(S4, 4.0);
1104 __ vstms(DB_W, SP, S0, S4); // Push S0 - S4 onto the stack, dec SP
1105 __ LoadSImmediate(S0, 0.0);
1106 __ LoadSImmediate(S1, 0.0);
1107 __ LoadSImmediate(S2, 0.0);
1108 __ LoadSImmediate(S3, 0.0);
1109 __ LoadSImmediate(S4, 0.0);
1110 __ vldms(IA_W, SP, S0, S4); // Pop stack into S0 - S4, inc SP
1111
1112 // Load success value into R0
1113 __ mov(R0, ShifterOperand(42));
1114
1115 // Check that 4.0 is back in S4
1116 __ LoadSImmediate(S5, 4.0);
1117 __ vcmps(S4, S5);
1118 __ vmstat();
1119 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1120
1121 // Check that 3.0 is back in S3
1122 __ LoadSImmediate(S5, 3.0);
1123 __ vcmps(S3, S5);
1124 __ vmstat();
1125 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1126
1127 // Check that 2.0 is back in S2
1128 __ LoadSImmediate(S5, 2.0);
1129 __ vcmps(S2, S5);
1130 __ vmstat();
1131 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1132
1133 // Check that 1.0 is back in S1
1134 __ LoadSImmediate(S5, 1.0);
1135 __ vcmps(S1, S5);
1136 __ vmstat();
1137 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1138
1139 __ mov(PC, ShifterOperand(LR));
1140 }
1141
1142
1143 ASSEMBLER_TEST_RUN(VstmsVldms, test) {
1144 EXPECT(test != NULL);
1145 typedef int (*Tst)();
1146 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1147 }
1148
1149
1150 // Make sure we can start somewhere other than D0
1151 ASSEMBLER_TEST_GENERATE(VstmdVldmd1, assembler) {
1152 __ LoadDImmediate(D1, 1.0, R0);
1153 __ LoadDImmediate(D2, 2.0, R0);
1154 __ LoadDImmediate(D3, 3.0, R0);
1155 __ LoadDImmediate(D4, 4.0, R0);
1156 __ vstmd(DB_W, SP, D1, D4); // Push D1 - D4 onto the stack, dec SP
1157 __ LoadDImmediate(D1, 0.0, R0);
1158 __ LoadDImmediate(D2, 0.0, R0);
1159 __ LoadDImmediate(D3, 0.0, R0);
1160 __ LoadDImmediate(D4, 0.0, R0);
1161 __ vldmd(IA_W, SP, D1, D4); // Pop stack into D1 - D4, inc SP
1162
1163 // Load success value into R0
1164 __ mov(R0, ShifterOperand(42));
1165
1166 // Check that 4.0 is back in D4
1167 __ LoadDImmediate(D5, 4.0, R1);
1168 __ vcmpd(D4, D5);
1169 __ vmstat();
1170 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1171
1172 // Check that 3.0 is back in D3
1173 __ LoadDImmediate(D5, 3.0, R1);
1174 __ vcmpd(D3, D5);
1175 __ vmstat();
1176 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1177
1178
1179 // Check that 2.0 is back in D2
1180 __ LoadDImmediate(D5, 2.0, R1);
1181 __ vcmpd(D2, D5);
1182 __ vmstat();
1183 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1184
1185 // Check that 1.0 is back in D1
1186 __ LoadDImmediate(D5, 1.0, R1);
1187 __ vcmpd(D1, D5);
1188 __ vmstat();
1189 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1190
1191 __ mov(PC, ShifterOperand(LR));
1192 }
1193
1194
1195 ASSEMBLER_TEST_RUN(VstmdVldmd1, test) {
1196 EXPECT(test != NULL);
1197 typedef int (*Tst)();
1198 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1199 }
1200
1201
1202 // Make sure we can start somewhere other than S0
1203 ASSEMBLER_TEST_GENERATE(VstmsVldms1, assembler) {
1204 __ LoadSImmediate(S1, 1.0);
1205 __ LoadSImmediate(S2, 2.0);
1206 __ LoadSImmediate(S3, 3.0);
1207 __ LoadSImmediate(S4, 4.0);
1208 __ vstms(DB_W, SP, S1, S4); // Push S0 - S4 onto the stack, dec SP
1209 __ LoadSImmediate(S1, 0.0);
1210 __ LoadSImmediate(S2, 0.0);
1211 __ LoadSImmediate(S3, 0.0);
1212 __ LoadSImmediate(S4, 0.0);
1213 __ vldms(IA_W, SP, S1, S4); // Pop stack into S0 - S4, inc SP
1214
1215 // Load success value into R0
1216 __ mov(R0, ShifterOperand(42));
1217
1218 // Check that 4.0 is back in S4
1219 __ LoadSImmediate(S5, 4.0);
1220 __ vcmps(S4, S5);
1221 __ vmstat();
1222 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1223
1224 // Check that 3.0 is back in S3
1225 __ LoadSImmediate(S5, 3.0);
1226 __ vcmps(S3, S5);
1227 __ vmstat();
1228 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1229
1230 // Check that 2.0 is back in S2
1231 __ LoadSImmediate(S5, 2.0);
1232 __ vcmps(S2, S5);
1233 __ vmstat();
1234 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1235
1236 // Check that 1.0 is back in S1
1237 __ LoadSImmediate(S5, 1.0);
1238 __ vcmps(S1, S5);
1239 __ vmstat();
1240 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1241
1242 __ mov(PC, ShifterOperand(LR));
1243 }
1244
1245
1246 ASSEMBLER_TEST_RUN(VstmsVldms1, test) {
1247 EXPECT(test != NULL);
1248 typedef int (*Tst)();
1249 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1250 }
1251
1252
1253 // Make sure we can store the D registers using vstmd and
1254 // load them into a different set using vldmd
1255 ASSEMBLER_TEST_GENERATE(VstmdVldmd_off, assembler) {
1256 __ LoadDImmediate(D0, 0.0, R0);
1257 __ LoadDImmediate(D1, 1.0, R0);
1258 __ LoadDImmediate(D2, 2.0, R0);
1259 __ LoadDImmediate(D3, 3.0, R0);
1260 __ LoadDImmediate(D4, 4.0, R0);
1261 __ LoadDImmediate(D5, 5.0, R0);
1262 __ vstmd(DB_W, SP, D0, D4); // Push D0 - D4 onto the stack, dec SP
1263 __ vldmd(IA_W, SP, D5, D9); // Pop stack into D5 - D9, inc SP
1264
1265 // Load success value into R0
1266 __ mov(R0, ShifterOperand(42));
1267
1268 // Check that 4.0 is in D9
1269 __ LoadDImmediate(D10, 4.0, R1);
1270 __ vcmpd(D9, D10);
1271 __ vmstat();
1272 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1273
1274 // Check that 3.0 is in D8
1275 __ LoadDImmediate(D10, 3.0, R1);
1276 __ vcmpd(D8, D10);
1277 __ vmstat();
1278 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1279
1280
1281 // Check that 2.0 is in D7
1282 __ LoadDImmediate(D10, 2.0, R1);
1283 __ vcmpd(D7, D10);
1284 __ vmstat();
1285 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1286
1287 // Check that 1.0 is in D6
1288 __ LoadDImmediate(D10, 1.0, R1);
1289 __ vcmpd(D6, D10);
1290 __ vmstat();
1291 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1292
1293 // Check that 0.0 is in D5
1294 __ LoadDImmediate(D10, 0.0, R1);
1295 __ vcmpd(D5, D10);
1296 __ vmstat();
1297 __ mov(R0, ShifterOperand(0), NE); // Put failure into R0 if NE
1298
1299 __ mov(PC, ShifterOperand(LR));
1300 }
1301
1302
1303 ASSEMBLER_TEST_RUN(VstmdVldmd_off, test) {
1304 EXPECT(test != NULL);
1305 typedef int (*Tst)();
1306 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1307 }
1308
1309
1310 // Make sure we can start somewhere other than S0
1311 ASSEMBLER_TEST_GENERATE(VstmsVldms_off, assembler) {
1312 __ LoadSImmediate(S0, 0.0);
1313 __ LoadSImmediate(S1, 1.0);
1314 __ LoadSImmediate(S2, 2.0);
1315 __ LoadSImmediate(S3, 3.0);
1316 __ LoadSImmediate(S4, 4.0);
1317 __ LoadSImmediate(S5, 5.0);
1318 __ vstms(DB_W, SP, S0, S4); // Push S0 - S4 onto the stack, dec SP
1319 __ vldms(IA_W, SP, S5, S9); // Pop stack into S5 - S9, inc SP
1320
1321 // Load success value into R0
1322 __ mov(R0, ShifterOperand(42));
1323
1324 // Check that 4.0 is in S9
1325 __ LoadSImmediate(S10, 4.0);
1326 __ vcmps(S9, S10);
1327 __ vmstat();
1328 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1329
1330 // Check that 3.0 is in S8
1331 __ LoadSImmediate(S10, 3.0);
1332 __ vcmps(S8, S10);
1333 __ vmstat();
1334 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1335
1336 // Check that 2.0 is in S7
1337 __ LoadSImmediate(S10, 2.0);
1338 __ vcmps(S7, S10);
1339 __ vmstat();
1340 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1341
1342 // Check that 1.0 is back in S6
1343 __ LoadSImmediate(S10, 1.0);
1344 __ vcmps(S6, S10);
1345 __ vmstat();
1346 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1347
1348 // Check that 0.0 is back in S5
1349 __ LoadSImmediate(S10, 0.0);
1350 __ vcmps(S5, S10);
1351 __ vmstat();
1352 __ mov(R0, ShifterOperand(0), NE); // Put failure value into R0 if NE
1353
1354 __ mov(PC, ShifterOperand(LR));
1355 }
1356
1357
1358 ASSEMBLER_TEST_RUN(VstmsVldms_off, test) {
1359 EXPECT(test != NULL);
1360 typedef int (*Tst)();
1361 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
1362 }
1363
1043 } // namespace dart 1364 } // namespace dart
1044 1365
1045 #endif // defined TARGET_ARCH_ARM 1366 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/constants_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698