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

Side by Side Diff: test/compiler-unittests/arm/instruction-selector-arm-unittest.cc

Issue 500343002: [turbofan] Add backend support for load/store float32 values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "test/compiler-unittests/instruction-selector-unittest.h" 5 #include "test/compiler-unittests/instruction-selector-unittest.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 // ----------------------------------------------------------------------------- 1190 // -----------------------------------------------------------------------------
1191 // Memory access instructions. 1191 // Memory access instructions.
1192 1192
1193 1193
1194 namespace { 1194 namespace {
1195 1195
1196 struct MemoryAccess { 1196 struct MemoryAccess {
1197 MachineType type; 1197 MachineType type;
1198 ArchOpcode ldr_opcode; 1198 ArchOpcode ldr_opcode;
1199 ArchOpcode str_opcode; 1199 ArchOpcode str_opcode;
1200 bool (InstructionSelectorTest::Stream::*val_predicate)(
1201 const InstructionOperand*) const;
1200 const int32_t immediates[40]; 1202 const int32_t immediates[40];
1201 }; 1203 };
1202 1204
1203 1205
1204 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) { 1206 std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
1205 OStringStream ost; 1207 OStringStream ost;
1206 ost << memacc.type; 1208 ost << memacc.type;
1207 return os << ost.c_str(); 1209 return os << ost.c_str();
1208 } 1210 }
1209 1211
1210 1212
1211 static const MemoryAccess kMemoryAccesses[] = { 1213 static const MemoryAccess kMemoryAccesses[] = {
1212 {kMachInt8, 1214 {kMachInt8,
1213 kArmLdrsb, 1215 kArmLdrsb,
1214 kArmStrb, 1216 kArmStrb,
1217 &InstructionSelectorTest::Stream::IsInteger,
1215 {-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89, 1218 {-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
1216 -87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109, 1219 -87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
1217 115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}}, 1220 115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
1218 {kMachUint8, 1221 {kMachUint8,
1219 kArmLdrb, 1222 kArmLdrb,
1220 kArmStrb, 1223 kArmStrb,
1224 &InstructionSelectorTest::Stream::IsInteger,
1221 {-4095, -3914, -3536, -3234, -3185, -3169, -1073, -990, -859, -720, -434, 1225 {-4095, -3914, -3536, -3234, -3185, -3169, -1073, -990, -859, -720, -434,
1222 -127, -124, -122, -105, -91, -86, -64, -55, -53, -30, -10, -3, 0, 20, 28, 1226 -127, -124, -122, -105, -91, -86, -64, -55, -53, -30, -10, -3, 0, 20, 28,
1223 39, 58, 64, 73, 75, 100, 108, 121, 686, 963, 1363, 2759, 3449, 4095}}, 1227 39, 58, 64, 73, 75, 100, 108, 121, 686, 963, 1363, 2759, 3449, 4095}},
1224 {kMachInt16, 1228 {kMachInt16,
1225 kArmLdrsh, 1229 kArmLdrsh,
1226 kArmStrh, 1230 kArmStrh,
1231 &InstructionSelectorTest::Stream::IsInteger,
1227 {-255, -251, -232, -220, -144, -138, -130, -126, -116, -115, -102, -101, 1232 {-255, -251, -232, -220, -144, -138, -130, -126, -116, -115, -102, -101,
1228 -98, -69, -59, -56, -39, -35, -23, -19, -7, 0, 22, 26, 37, 68, 83, 87, 98, 1233 -98, -69, -59, -56, -39, -35, -23, -19, -7, 0, 22, 26, 37, 68, 83, 87, 98,
1229 102, 108, 111, 117, 171, 195, 203, 204, 245, 246, 255}}, 1234 102, 108, 111, 117, 171, 195, 203, 204, 245, 246, 255}},
1230 {kMachUint16, 1235 {kMachUint16,
1231 kArmLdrh, 1236 kArmLdrh,
1232 kArmStrh, 1237 kArmStrh,
1238 &InstructionSelectorTest::Stream::IsInteger,
1233 {-255, -230, -201, -172, -125, -119, -118, -105, -98, -79, -54, -42, -41, 1239 {-255, -230, -201, -172, -125, -119, -118, -105, -98, -79, -54, -42, -41,
1234 -32, -12, -11, -5, -4, 0, 5, 9, 25, 28, 51, 58, 60, 89, 104, 108, 109, 1240 -32, -12, -11, -5, -4, 0, 5, 9, 25, 28, 51, 58, 60, 89, 104, 108, 109,
1235 114, 116, 120, 138, 150, 161, 166, 172, 228, 255}}, 1241 114, 116, 120, 138, 150, 161, 166, 172, 228, 255}},
1236 {kMachInt32, 1242 {kMachInt32,
1237 kArmLdr, 1243 kArmLdr,
1238 kArmStr, 1244 kArmStr,
1245 &InstructionSelectorTest::Stream::IsInteger,
1239 {-4095, -1898, -1685, -1562, -1408, -1313, -344, -128, -116, -100, -92, 1246 {-4095, -1898, -1685, -1562, -1408, -1313, -344, -128, -116, -100, -92,
1240 -80, -72, -71, -56, -25, -21, -11, -9, 0, 3, 5, 27, 28, 42, 52, 63, 88, 1247 -80, -72, -71, -56, -25, -21, -11, -9, 0, 3, 5, 27, 28, 42, 52, 63, 88,
1241 93, 97, 125, 846, 1037, 2102, 2403, 2597, 2632, 2997, 3935, 4095}}, 1248 93, 97, 125, 846, 1037, 2102, 2403, 2597, 2632, 2997, 3935, 4095}},
1249 {kMachFloat32,
1250 kArmVldr32,
1251 kArmVstr32,
1252 &InstructionSelectorTest::Stream::IsDouble,
1253 {-1020, -928, -896, -772, -728, -680, -660, -488, -372, -112, -100, -92,
1254 -84, -80, -72, -64, -60, -56, -52, -48, -36, -32, -20, -8, -4, 0, 8, 20,
1255 24, 40, 64, 112, 204, 388, 516, 852, 856, 976, 988, 1020}},
1242 {kMachFloat64, 1256 {kMachFloat64,
1243 kArmVldr64, 1257 kArmVldr64,
1244 kArmVstr64, 1258 kArmVstr64,
1259 &InstructionSelectorTest::Stream::IsDouble,
1245 {-1020, -948, -796, -696, -612, -364, -320, -308, -128, -112, -108, -104, 1260 {-1020, -948, -796, -696, -612, -364, -320, -308, -128, -112, -108, -104,
1246 -96, -84, -80, -56, -48, -40, -20, 0, 24, 28, 36, 48, 64, 84, 96, 100, 1261 -96, -84, -80, -56, -48, -40, -20, 0, 24, 28, 36, 48, 64, 84, 96, 100,
1247 108, 116, 120, 140, 156, 408, 432, 444, 772, 832, 940, 1020}}}; 1262 108, 116, 120, 140, 156, 408, 432, 444, 772, 832, 940, 1020}}};
1248 1263
1249 } // namespace 1264 } // namespace
1250 1265
1251 1266
1252 typedef InstructionSelectorTestWithParam<MemoryAccess> 1267 typedef InstructionSelectorTestWithParam<MemoryAccess>
1253 InstructionSelectorMemoryAccessTest; 1268 InstructionSelectorMemoryAccessTest;
1254 1269
1255 1270
1256 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) { 1271 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
1257 const MemoryAccess memacc = GetParam(); 1272 const MemoryAccess memacc = GetParam();
1258 StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32); 1273 StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
1259 m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1))); 1274 m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
1260 Stream s = m.Build(); 1275 Stream s = m.Build();
1261 ASSERT_EQ(1U, s.size()); 1276 ASSERT_EQ(1U, s.size());
1262 EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode()); 1277 EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
1263 EXPECT_EQ(kMode_Offset_RR, s[0]->addressing_mode()); 1278 EXPECT_EQ(kMode_Offset_RR, s[0]->addressing_mode());
1264 EXPECT_EQ(2U, s[0]->InputCount()); 1279 EXPECT_EQ(2U, s[0]->InputCount());
1265 EXPECT_EQ(1U, s[0]->OutputCount()); 1280 ASSERT_EQ(1U, s[0]->OutputCount());
1281 EXPECT_TRUE((s.*memacc.val_predicate)(s[0]->Output()));
1266 } 1282 }
1267 1283
1268 1284
1269 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) { 1285 TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) {
1270 const MemoryAccess memacc = GetParam(); 1286 const MemoryAccess memacc = GetParam();
1271 TRACED_FOREACH(int32_t, index, memacc.immediates) { 1287 TRACED_FOREACH(int32_t, index, memacc.immediates) {
1272 StreamBuilder m(this, memacc.type, kMachPtr); 1288 StreamBuilder m(this, memacc.type, kMachPtr);
1273 m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index))); 1289 m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
1274 Stream s = m.Build(); 1290 Stream s = m.Build();
1275 ASSERT_EQ(1U, s.size()); 1291 ASSERT_EQ(1U, s.size());
1276 EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode()); 1292 EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
1277 EXPECT_EQ(kMode_Offset_RI, s[0]->addressing_mode()); 1293 EXPECT_EQ(kMode_Offset_RI, s[0]->addressing_mode());
1278 ASSERT_EQ(2U, s[0]->InputCount()); 1294 ASSERT_EQ(2U, s[0]->InputCount());
1279 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); 1295 ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
1280 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1))); 1296 EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1)));
1281 EXPECT_EQ(1U, s[0]->OutputCount()); 1297 ASSERT_EQ(1U, s[0]->OutputCount());
1298 EXPECT_TRUE((s.*memacc.val_predicate)(s[0]->Output()));
1282 } 1299 }
1283 } 1300 }
1284 1301
1285 1302
1286 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { 1303 TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
1287 const MemoryAccess memacc = GetParam(); 1304 const MemoryAccess memacc = GetParam();
1288 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type); 1305 StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
1289 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2)); 1306 m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2));
1290 m.Return(m.Int32Constant(0)); 1307 m.Return(m.Int32Constant(0));
1291 Stream s = m.Build(); 1308 Stream s = m.Build();
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 ASSERT_EQ(3U, s[0]->InputCount()); 1892 ASSERT_EQ(3U, s[0]->InputCount());
1876 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1))); 1893 EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
1877 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2))); 1894 EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2)));
1878 } 1895 }
1879 } 1896 }
1880 } 1897 }
1881 1898
1882 } // namespace compiler 1899 } // namespace compiler
1883 } // namespace internal 1900 } // namespace internal
1884 } // namespace v8 1901 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/compiler-unittests/arm64/instruction-selector-arm64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698