Changeset 217127 in webkit for trunk/Source/JavaScriptCore/b3/testb3.cpp
- Timestamp:
- May 19, 2017, 8:48:40 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/b3/testb3.cpp
r216989 r217127 4446 4446 } 4447 4447 4448 double correctSqrt(double value) 4449 { 4450 #if CPU(X86) || CPU(X86_64) 4451 double result; 4452 asm ("sqrtsd %1, %0" : "=x"(result) : "x"(value)); 4453 return result; 4454 #else 4455 return sqrt(value); 4456 #endif 4457 } 4458 4448 4459 void testSqrtArg(double a) 4449 4460 { … … 4456 4467 root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0))); 4457 4468 4458 CHECK(isIdentical(compileAndRun<double>(proc, a), sqrt(a)));4469 CHECK(isIdentical(compileAndRun<double>(proc, a), correctSqrt(a))); 4459 4470 } 4460 4471 … … 4468 4479 root->appendNew<Value>(proc, Sqrt, Origin(), argument)); 4469 4480 4470 CHECK(isIdentical(compileAndRun<double>(proc), sqrt(a)));4481 CHECK(isIdentical(compileAndRun<double>(proc), correctSqrt(a))); 4471 4482 } 4472 4483 … … 4481 4492 root->appendNew<Value>(proc, Sqrt, Origin(), loadDouble)); 4482 4493 4483 CHECK(isIdentical(compileAndRun<double>(proc, &a), sqrt(a)));4494 CHECK(isIdentical(compileAndRun<double>(proc, &a), correctSqrt(a))); 4484 4495 } 4485 4496 … … 4495 4506 root->appendNewControlValue(proc, Return, Origin(), result32); 4496 4507 4497 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>( sqrt(a)))));4508 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>(correctSqrt(a))))); 4498 4509 } 4499 4510 … … 4507 4518 root->appendNewControlValue(proc, Return, Origin(), result32); 4508 4519 4509 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>( sqrt(a)))));4520 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>(correctSqrt(a))))); 4510 4521 } 4511 4522 … … 4520 4531 root->appendNewControlValue(proc, Return, Origin(), result32); 4521 4532 4522 CHECK(isIdentical(compileAndRun<int32_t>(proc, &a), bitwise_cast<int32_t>(static_cast<float>( sqrt(a)))));4533 CHECK(isIdentical(compileAndRun<int32_t>(proc, &a), bitwise_cast<int32_t>(static_cast<float>(correctSqrt(a))))); 4523 4534 } 4524 4535 … … 4536 4547 root->appendNewControlValue(proc, Return, Origin(), result32); 4537 4548 4538 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>( sqrt(a)))));4549 CHECK(isIdentical(compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a)), bitwise_cast<int32_t>(static_cast<float>(correctSqrt(a))))); 4539 4550 } 4540 4551 … … 4556 4567 double effect = 0; 4557 4568 int32_t resultValue = compileAndRun<int32_t>(proc, bitwise_cast<int32_t>(a), &effect); 4558 CHECK(isIdentical(resultValue, bitwise_cast<int32_t>(static_cast<float>(sqrt(a))))); 4559 CHECK(isIdentical(effect, static_cast<double>(sqrt(a)))); 4569 CHECK(isIdentical(resultValue, bitwise_cast<int32_t>(static_cast<float>(correctSqrt(a))))); 4570 double expected = static_cast<double>(correctSqrt(a)); 4571 CHECK(isIdentical(effect, expected)); 4560 4572 } 4561 4573 … … 5794 5806 checkUsesInstruction(*code, "stl"); 5795 5807 } 5808 if (isX86()) 5809 checkUsesInstruction(*code, "xchg"); 5796 5810 CHECK(!invoke<int>(*code, amount)); 5797 5811 CHECK(slot == 37 + amount); … … 5867 5881 checkUsesInstruction(*code, "stl"); 5868 5882 } 5883 if (isX86()) 5884 checkUsesInstruction(*code, "xchg"); 5869 5885 CHECK(!invoke<int>(*code, amount)); 5870 5886 CHECK(slot == 37 + amount); … … 5906 5922 checkUsesInstruction(*code, "stl"); 5907 5923 } 5924 if (isX86()) 5925 checkUsesInstruction(*code, "xchg"); 5908 5926 CHECK(!invoke<int>(*code, amount)); 5909 5927 CHECK(slot == 37 + amount); … … 5979 5997 checkUsesInstruction(*code, "stl"); 5980 5998 } 5999 if (isX86()) 6000 checkUsesInstruction(*code, "xchg"); 5981 6001 CHECK(!invoke<int>(*code, amount)); 5982 6002 CHECK(slot == 37 + amount); … … 6048 6068 checkUsesInstruction(*code, "stl"); 6049 6069 } 6070 if (isX86()) 6071 checkUsesInstruction(*code, "xchg"); 6050 6072 CHECK(!invoke<int>(*code, amount)); 6051 6073 CHECK(slot == 37000000000ll + amount); … … 13980 14002 for (Air::BasicBlock* block : proc.code()) { 13981 14003 for (Air::Inst& inst : *block) { 13982 if (inst.kind. traps)14004 if (inst.kind.effects) 13983 14005 trapsCount++; 13984 14006 } … … 14013 14035 for (Air::BasicBlock* block : proc.code()) { 14014 14036 for (Air::Inst& inst : *block) { 14015 if (inst.kind. traps)14037 if (inst.kind.effects) 14016 14038 trapsCount++; 14017 14039 } … … 14039 14061 for (Air::BasicBlock* block : proc.code()) { 14040 14062 for (Air::Inst& inst : *block) { 14041 if (inst.kind. traps)14063 if (inst.kind.effects) 14042 14064 traps = true; 14043 14065 } … … 14059 14081 for (Air::BasicBlock* block : proc.code()) { 14060 14082 for (Air::Inst& inst : *block) { 14061 if (inst.kind. traps)14083 if (inst.kind.effects) 14062 14084 trapsCount++; 14063 14085 }
Note:
See TracChangeset
for help on using the changeset viewer.