Changeset 192519 in webkit
- Timestamp:
- Nov 17, 2015, 11:41:27 AM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r192516 r192519 1 2015-11-16 Mark Lam <mark.lam@apple.com> 2 3 [JSC] Support Doubles with B3's Sub. 4 https://bugs.webkit.org/show_bug.cgi?id=151322 5 6 Reviewed by Filip Pizlo. 7 8 * b3/B3LowerToAir.cpp: 9 (JSC::B3::Air::LowerToAir::lower): 10 * b3/air/AirOpcode.opcodes: 11 12 * b3/testb3.cpp: 13 (JSC::B3::testSubImmArg32): 14 (JSC::B3::testSubArgDouble): 15 (JSC::B3::testSubArgsDouble): 16 (JSC::B3::testSubArgImmDouble): 17 (JSC::B3::testSubImmArgDouble): 18 (JSC::B3::testSubImmsDouble): 19 (JSC::B3::testBitAndArgs): 20 (JSC::B3::negativeZero): 21 (JSC::B3::posInfinity): 22 (JSC::B3::negInfinity): 23 (JSC::B3::doubleOperands): 24 (JSC::B3::run): 25 - Added RUN_UNARY and RUN_BINARY macros to auto generate permutations 26 of operands for the tests. 27 - Added SubDouble tests using the new macros. 28 1 29 2015-11-17 Benjamin Poulain <bpoulain@apple.com> 2 30 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r192493 r192519 1256 1256 appendUnOp<Neg32, Neg64, Air::Oops>(m_value->child(1)); 1257 1257 else 1258 appendBinOp<Sub32, Sub64, Air::Oops>(m_value->child(0), m_value->child(1));1258 appendBinOp<Sub32, Sub64, SubDouble>(m_value->child(0), m_value->child(1)); 1259 1259 return; 1260 1260 } -
trunk/Source/JavaScriptCore/b3/air/AirOpcode.opcodes
r192493 r192519 94 94 Imm, Tmp 95 95 96 SubDouble U:F, UD:F 97 Tmp, Tmp 98 Addr, Tmp 99 96 100 Neg32 UD:G 97 101 Tmp -
trunk/Source/JavaScriptCore/b3/testb3.cpp
r192497 r192519 43 43 #include "JSCInlines.h" 44 44 #include "LinkBuffer.h" 45 #include "PureNaN.h" 45 46 #include "VM.h" 46 47 #include <cmath> 48 #include <string> 47 49 #include <wtf/Lock.h> 48 50 #include <wtf/NumberOfCores.h> … … 551 553 552 554 CHECK(compileAndRun<int>(proc, b) == a - b); 555 } 556 557 void testSubArgDouble(double a) 558 { 559 Procedure proc; 560 BasicBlock* root = proc.addBlock(); 561 Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0); 562 root->appendNew<ControlValue>( 563 proc, Return, Origin(), 564 root->appendNew<Value>(proc, Sub, Origin(), value, value)); 565 566 CHECK(isIdentical(compileAndRun<double>(proc, a), a - a)); 567 } 568 569 void testSubArgsDouble(double a, double b) 570 { 571 Procedure proc; 572 BasicBlock* root = proc.addBlock(); 573 Value* valueA = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0); 574 Value* valueB = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1); 575 root->appendNew<ControlValue>( 576 proc, Return, Origin(), 577 root->appendNew<Value>(proc, Sub, Origin(), valueA, valueB)); 578 579 CHECK(isIdentical(compileAndRun<double>(proc, a, b), a - b)); 580 } 581 582 void testSubArgImmDouble(double a, double b) 583 { 584 Procedure proc; 585 BasicBlock* root = proc.addBlock(); 586 Value* valueA = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0); 587 Value* valueB = root->appendNew<ConstDoubleValue>(proc, Origin(), b); 588 root->appendNew<ControlValue>( 589 proc, Return, Origin(), 590 root->appendNew<Value>(proc, Sub, Origin(), valueA, valueB)); 591 592 CHECK(isIdentical(compileAndRun<double>(proc, a), a - b)); 593 } 594 595 void testSubImmArgDouble(double a, double b) 596 { 597 Procedure proc; 598 BasicBlock* root = proc.addBlock(); 599 Value* valueA = root->appendNew<ConstDoubleValue>(proc, Origin(), a); 600 Value* valueB = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0); 601 root->appendNew<ControlValue>( 602 proc, Return, Origin(), 603 root->appendNew<Value>(proc, Sub, Origin(), valueA, valueB)); 604 605 CHECK(isIdentical(compileAndRun<double>(proc, b), a - b)); 606 } 607 608 void testSubImmsDouble(double a, double b) 609 { 610 Procedure proc; 611 BasicBlock* root = proc.addBlock(); 612 Value* valueA = root->appendNew<ConstDoubleValue>(proc, Origin(), a); 613 Value* valueB = root->appendNew<ConstDoubleValue>(proc, Origin(), b); 614 root->appendNew<ControlValue>( 615 proc, Return, Origin(), 616 root->appendNew<Value>(proc, Sub, Origin(), valueA, valueB)); 617 618 CHECK(isIdentical(compileAndRun<double>(proc), a - b)); 553 619 } 554 620 … … 4168 4234 } 4169 4235 4236 // Some convenience functions for brevity of the test output. 4237 double posInfinity() 4238 { 4239 return std::numeric_limits<double>::infinity(); 4240 } 4241 4242 double negInfinity() 4243 { 4244 return -std::numeric_limits<double>::infinity(); 4245 } 4246 4247 4248 struct DoubleOperand { 4249 const char* name; 4250 double value; 4251 }; 4252 4253 static const std::array<DoubleOperand, 9>& doubleOperands() 4254 { 4255 static const std::array<DoubleOperand, 9> operands = {{ 4256 { "M_PI", M_PI }, 4257 { "-M_PI", -M_PI }, 4258 { "1", 1 }, 4259 { "-1", -1 }, 4260 { "0", 0 }, 4261 { "negativeZero()", negativeZero() }, 4262 { "posInfinity()", posInfinity() }, 4263 { "negInfinity()", negInfinity() }, 4264 { "PNaN", PNaN }, 4265 }}; 4266 return operands; 4267 }; 4268 4170 4269 #define RUN(test) do { \ 4171 4270 if (!shouldRun(#test)) \ … … 4179 4278 })); \ 4180 4279 } while (false); 4280 4281 #define RUN_UNARY(test, values) \ 4282 for (auto a : values) { \ 4283 CString testStr = toCString(#test, "(", a.name, ")"); \ 4284 if (!shouldRun(testStr.data())) \ 4285 continue; \ 4286 tasks.append(createSharedTask<void()>( \ 4287 [=] () { \ 4288 dataLog(testStr, "...\n"); \ 4289 test(a.value); \ 4290 dataLog(testStr, ": OK!\n"); \ 4291 })); \ 4292 } 4293 4294 #define RUN_BINARY(test, valuesA, valuesB) \ 4295 for (auto a : valuesA) { \ 4296 for (auto b : valuesB) { \ 4297 CString testStr = toCString(#test, "(", a.name, ", ", b.name, ")"); \ 4298 if (!shouldRun(testStr.data())) \ 4299 continue; \ 4300 tasks.append(createSharedTask<void()>( \ 4301 [=] () { \ 4302 dataLog(testStr, "...\n"); \ 4303 test(a.value, b.value); \ 4304 dataLog(testStr, ": OK!\n"); \ 4305 })); \ 4306 } \ 4307 } 4181 4308 4182 4309 void run(const char* filter) … … 4321 4448 RUN(testSubImmArg32(13, -42)); 4322 4449 RUN(testSubImmArg32(-13, 42)); 4450 4451 RUN_UNARY(testSubArgDouble, doubleOperands()); 4452 RUN_BINARY(testSubArgsDouble, doubleOperands(), doubleOperands()); 4453 RUN_BINARY(testSubArgImmDouble, doubleOperands(), doubleOperands()); 4454 RUN_BINARY(testSubImmArgDouble, doubleOperands(), doubleOperands()); 4455 RUN_BINARY(testSubImmsDouble, doubleOperands(), doubleOperands()); 4323 4456 4324 4457 RUN(testBitAndArgs(43, 43));
Note:
See TracChangeset
for help on using the changeset viewer.