OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 [](MacroAssembler* masm, int32_t in_offset, | 1299 [](MacroAssembler* masm, int32_t in_offset, |
1300 int32_t out_offset) { | 1300 int32_t out_offset) { |
1301 __ Uldc1(f0, MemOperand(a0, in_offset), t0); | 1301 __ Uldc1(f0, MemOperand(a0, in_offset), t0); |
1302 __ Usdc1(f0, MemOperand(a0, out_offset), t0); | 1302 __ Usdc1(f0, MemOperand(a0, out_offset), t0); |
1303 })); | 1303 })); |
1304 } | 1304 } |
1305 } | 1305 } |
1306 } | 1306 } |
1307 } | 1307 } |
1308 | 1308 |
| 1309 static const std::vector<uint32_t> sltu_test_values() { |
| 1310 static const uint32_t kValues[] = { |
| 1311 0, 1, 0x7ffe, 0x7fff, 0x8000, |
| 1312 0x8001, 0xfffe, 0xffff, 0xffff7ffe, 0xffff7fff, |
| 1313 0xffff8000, 0xffff8001, 0xfffffffe, 0xffffffff, |
| 1314 }; |
| 1315 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
| 1316 } |
| 1317 |
| 1318 template <typename Func> |
| 1319 bool run_Sltu(uint32_t rs, uint32_t rd, Func GenerateSltuInstructionFunc) { |
| 1320 typedef int32_t (*F_CVT)(uint32_t x0, uint32_t x1, int x2, int x3, int x4); |
| 1321 |
| 1322 Isolate* isolate = CcTest::i_isolate(); |
| 1323 HandleScope scope(isolate); |
| 1324 MacroAssembler assm(isolate, nullptr, 0, |
| 1325 v8::internal::CodeObjectRequired::kYes); |
| 1326 MacroAssembler* masm = &assm; |
| 1327 |
| 1328 GenerateSltuInstructionFunc(masm, rd); |
| 1329 __ jr(ra); |
| 1330 __ nop(); |
| 1331 |
| 1332 CodeDesc desc; |
| 1333 assm.GetCode(&desc); |
| 1334 Handle<Code> code = isolate->factory()->NewCode( |
| 1335 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1336 |
| 1337 F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); |
| 1338 int32_t res = reinterpret_cast<int32_t>( |
| 1339 CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); |
| 1340 return res == 1; |
| 1341 } |
| 1342 |
| 1343 TEST(Sltu) { |
| 1344 CcTest::InitializeVM(); |
| 1345 |
| 1346 FOR_UINT32_INPUTS(i, sltu_test_values) { |
| 1347 FOR_UINT32_INPUTS(j, sltu_test_values) { |
| 1348 uint32_t rs = *i; |
| 1349 uint32_t rd = *j; |
| 1350 |
| 1351 CHECK_EQ(rs < rd, run_Sltu(rs, rd, |
| 1352 [](MacroAssembler* masm, uint32_t imm) { |
| 1353 __ Sltu(v0, a0, Operand(imm)); |
| 1354 })); |
| 1355 CHECK_EQ(rs < rd, |
| 1356 run_Sltu(rs, rd, [](MacroAssembler* masm, |
| 1357 uint32_t imm) { __ Sltu(v0, a0, a1); })); |
| 1358 } |
| 1359 } |
| 1360 } |
| 1361 |
1309 #undef __ | 1362 #undef __ |
OLD | NEW |